The example is out-of-date. Something like this would work better:
module tut1::Entities
extend lang::std::Layout; // for spaces and such
extend lang::std::Id; // for the Id non-terminal
start syntax Entities
= entities: Entity* entities;
syntax Entity
= @Foldable entity: "entity" Id name "{" Field* "}";
syntax Field
= field: Id symbol Id name; // now Id is used instead of Symbol and "symbol" is just the name of a slot in the rule
Some explanation:
- the imports/extends have gone, they were unnecessary and might be confusing
- there was a missing definition for the
Symbol
non-terminal. I don't know what it was supposed to do, but it should have been definedsyntax Symbol = ...
, but it did not make sense to me and instead I reusedId
to define the type of a field. - the type checker (under development) would have warned you before using the
parse
function.