Hello!
I’m rewriting a lezer parser for a custom language, and I’m trying to parse hierarchically-organized paths like a.b.c
, where a.b
is the “scope”, and c
is the “name”. Using a grammar like
@top Expr { (Name ".")* ExprName { Name } }
@tokens {
Name { ($[0-9a-zA-Z_] | "\\" ![^\\])+ }
}
works, but I would also like to give a name to the “scope” part. However, when I add an inline rule for the scope path like so
@top Expr { ExprScope { (Name ".")* } ExprName { Name } }
@tokens {
Name { ($[0-9a-zA-Z_] | "\\" ![^\\])+ }
}
I get a shift/reduce error. Can anybode help here? I’m probably misunderstanding something, but I thougt “naming” the scope part via an inline rule should not alter the parser?