- ignore the problem
After a full week-end working on this thing, I had a parser "almost" working. Some more evenings and I had a compressor, but without renaming variables (yet).
Now I'm trying to finish the parser. As always, the latest 5% takes 90% of time. My parser is compliant except for:
- Virtual semicolons
- Regular expressions
I have only modified my grammar so it is able to add virtual semicolons before '}' and before the end of file. These are the two most useful points where you can unambiguosly do not put the semicolon.
Regular expressions are also a bit hard to parse with a LALR(1) grammar. I'm thinking of matching a '/' or '/=' token for a primary expression, and then switching the lexer so that it can parse the regular expression and parse it, all in the action of these two tokens. (At least that is what Rhino does.)
If I fail, I will rewrite the parser to a LL(1) one. I will have the same problems, but this time the parser will be hand made, and thus I should be able to put inside these hacks as I need them.
The good news are that my code is fully parsed and written back correctly, except for the two regular expressions I use. I will then start working on most advanced compression features, not yet available anywhere else.
I will keep you posted!