[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Thank you!



Etienne:

Just a quick "thank you!" for creating SableCC.

My current full-time is to maintain our product's internal scripting language (hand-written recursive-decent lexer and parser).  SableCC let me develop a mechanical translator (cross compiler) to another widely available scripting language in just one week.  This makes the idea of moving to a different script language much more palatable, should we decide to move that direction.  Very cool stuff!

The most difficult part of the project was reintroducing comments back into the generated output.  I handled this by building a FIFO of comment tokens.  On every production that contains a token, I make a call that compares the head of the comment queue to a token from that production, outputting the comment if the line or position of the comment is less-than or equal-to the specified token.  This forces comments to appear just before a token; which is perfectly acceptable.

Question: At first (before implementing the full translator), I tried to simplify the expression AST but had some difficulty.  My grammar has the full 16-levels of C/C++ precedence.  If I now understand correctly, I should add a hidden "generic expression" production to each of these levels, then "hoist" the information up the production tree each time I hit a "chain-to-next-level" production... is this correct?

Anyway, looking forward to Version 3.0.  I am particularly interested in the ability to target C++ code and in a means of building a custom (simplified) AST during the parse.  A means of expressing operator precedence would also be very nice.

Thanks again!

Anagon