Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

FWIW I encountered re2c in the Ninja lexer

https://github.com/ninja-build/ninja/blob/master/src/lexer.i...

and then used it for my own huge shell lexer:

The Oil Lexer: Introduction and Recap http://www.oilshell.org/blog/2017/12/15.html

The nice thing about it is that it doesn't impose any constraints on the structure of your code.

lex/flex probably have options not generate piles of messy C code with global variables at this point, but IMO there's no reason not to use re2c instead, so it's moot.



update: Also re2c gives you "semantic actions" like Ragel or yacc, which is better IMO. Not sure if lex/flex does that. I think it has a hard-coded notion of tokens.


lex/flex definitely supports semantic actions and definitely does not have a hardcoded notion of tokens.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: