|
|
|
|
|
by chubot
854 days ago
|
|
This is sort of a category error... re2c is a lexer generator, and YAML and Python are recursive/nested formats. You can definitely use re2c to lex them, including indentation, but it's not the whole solution. You need a parser too. I use it for everything possible in https://www.oilshell.org, and it's amazing. It really reduces the amount of fiddly C code you need to parse languages, and it drops in anywhere. Parser generators usually have some downside, but there's not much downside to the lexer generators IMO. It just saves you work. And the regex syntax is better than Perl/Python because literals are consistently quoted. |
|
Lexers can use re2c, but it's not even the whole story. This is good because it means it's "policy free" and you can use it anywhere.