Generate enums for the automatic AST, using a special syntax
pczarn opened this issue · 0 comments
pczarn commented
Similar to Oak's >
operator. Require the user to specify variant names in place of inline actions.
The syntax conflicts with the potential syntax for inline actions without curly braces.
Names of these variants can be used for general naming of rule alternatives, which may enable various advanced features. For instance, grammar composition and modification.
Example:
foo ::=
bar => Bar
| baz => Baz;
will generare the definition
enum Foo {
Bar(/* type of bar */),
Baz(/* type of baz */),
}
Alternative in terms of notation
foo ::=
Bar:bar | Baz:baz