nimly
nimly copied to clipboard
Ability to define two parsers from the same lexer
If you define a lexer niml lexer[MyToken]
and then two parsers nimy parserOne[MyToken]
and nimy parserTwo[MyToken]
you get an error due to a redefinition of the function parse
(parsegen.nim:1001
)
@fish-face Thank you for the reporting! I won't fix this, but maybe I can help you.
nimy
is designed as a macro to make the parsing table and define the function parse
for the table.
So, if you define two parse
in one module (with the same token type), these names are conflicted.
But, you can use two (or more) different nimy
parser in one module if you define two (or more) parsers in two (or more) other modules.
https://github.com/loloicci/nimly/blob/master/tests/test_lr_lalr.nim is a good example to use two parsers in one module. (using https://github.com/loloicci/nimly/blob/master/tests/parser_415.nim and https://github.com/loloicci/nimly/blob/master/tests/parser_415_lr.nim)
Does it solve your problem?