On Sun, Mar 31, 2019 at 10:45:04PM -0700, Louis Santillan wrote: > There's options. Have you tried Lemon Parser [0] or miniyacc + qbe > [1][2]? ucpp [3] lexes/parses C-like languages with C pre-processing. > re2c [4] is a great lexer. Crockford prefers Pratt's Top-Down > Operator Precedence [5][6] and his webpage source repo even includes a > nifty lexer that is easy to translate from JS to C [7]. > > HTH, > > [0] https://www.hwaci.com/sw/lemon/ > [1] http://c9x.me/yacc/ > [2] http://c9x.me/compile/ > [3] https://github.com/lpsantil/ucpp > [4] http://re2c.org/ > [5] http://crockford.com/javascript/tdop/tdop.html > [6] https://www.oilshell.org/blog/2016/11/02.html > [7] https://github.com/douglascrockford/TDOP/blob/master/tokens.js
As I said earlier: yacc and lex are overkill. Moreover, like Markus pointed out, I do get the flexibility to go hardcore on error reporting, if it needs to be (namely I leave the door open for such fine grained error reporting). *AND* the code is damn simple and easy to understand: it's very easy to keep a full mental picture of what's happening. That said, your list has valuable ressource since the gcc C preprocessor is now c++ garbage. It opens the door at mitigating the wintel grade mistakes done by the "gcc steering committee" (the guys with the admin rights on the only one official gcc repo). Replacing the gcc C preprocessor will kill gcc error reporting though, and I am not optimistic on gcc CPP->C protocol being not a massive brain f*ckage. And JS is useless by itself: the really hardcore part is the dynamic DOM behind. That's why the "web" is now equal to "chrome", even microsoft trash with their billions of dollars were not able to code an alternative dynamic DOM engine (they only got their hands on w3c html specs...). Only one way to go, noscript with basic (x)html. -- Sylvain