Never move the start rule of a grammar into the lexical grammar
This preserves a useful invariant that the root node of the AST is never a token.
This commit is contained in:
parent
48681c3f0e
commit
493db39363
3 changed files with 34 additions and 13 deletions
|
|
@ -83,10 +83,7 @@ class ParseTableBuilderImpl : public ParseTableBuilder {
|
|||
ParseStateId error_state_id = add_parse_state({}, ParseItemSet{});
|
||||
|
||||
// Add the starting state.
|
||||
Symbol start_symbol = grammar.variables.empty() ?
|
||||
Symbol::terminal(0) :
|
||||
Symbol::non_terminal(0);
|
||||
|
||||
Symbol start_symbol = Symbol::non_terminal(0);
|
||||
Production start_production({{start_symbol, 0, rules::AssociativityNone, rules::Alias{}}}, 0);
|
||||
|
||||
add_parse_state({}, ParseItemSet{{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue