big problem in the lexer currently, consider a digit which would match [0-9] and a non-zero-digit which would match [1-9].
Solution i initially went with was to create terminals which created unique ranges i.e. zero and one_through_nine and wrote digit and non-zero-digit as productions like
digit -> zero | one_through_nine
non-zero-digit -> one_through_nine
This is a working solution, but far from ideal in my opinion. What im currently considering is modifying the production definition to allow constraints, but this is leading to reduce-reduce conflicts because the name of the token still matches as digit (in a slightly more complex case).
Going to keep working on the second solution, but also looking for a third.
big problem in the lexer currently, consider a
digit
which would match[0-9]
and anon-zero-digit
which would match[1-9]
.Solution i initially went with was to create terminals which created unique ranges i.e.
zero
andone_through_nine
and wrotedigit
andnon-zero-digit
as productions likeThis is a working solution, but far from ideal in my opinion. What im currently considering is modifying the production definition to allow constraints, but this is leading to reduce-reduce conflicts because the name of the token still matches as digit (in a slightly more complex case).
Going to keep working on the second solution, but also looking for a third.