GerHobbelt / jison

bison / YACC / LEX in JavaScript (LALR(1), SLR(1), etc. lexer/parser generator)
https://gerhobbelt.github.io/jison/
MIT License
118 stars 20 forks source link

have look at magic-strings by way of optimize-js for the jison parser kernel code stripper #2

Closed GerHobbelt closed 7 years ago

GerHobbelt commented 7 years ago

For inspiration:

GerHobbelt commented 7 years ago

Since 0.6.0-191: lexer has started to use recast/prettier, though still no lexer-level (action) code analyzer in place. jison itself (parser generator) still uses regexes for code analysis and code stripping/injecting, but that is to change in the later builds/releases as recast et al get introduced there.

I'll be testing these libraries (and optimize-js + magic-string) further, for I haven't found a clear winner yet. AST traversal and code flow analysis are obviously the way forward to produce leaner (and thus faster) code, but the dev cost is pretty high compared to the current regex-based analysis/strip/inject approach: I find the current method dev-cost heavy, but so is the AST-based alternative.

GerHobbelt commented 7 years ago

Closing this one. It was just one direction I was looking; the recast/...whatever... work is being done (slowly) and this is now just a hint.