Shevek (shevek) wrote,

Having spent some time using antlr, I have come to the regrettable conclusion that whatever the task, antlr is the wrong way to address it. As is common with LL parser generators, it has no clear distinction between the syntax and the semantics of the target language; the grammar specification is overcomplex and underpowered, and involves an unholy mixture of code and data; and the API is generally a botch job which leaves one to invent a great many uninteresting wheels.

The right answer is almost always SableCC.

Protip: When using sablecc, feel free to add arbitrary semantic constructs to your AST, even if they aren't the target of any transformation the CST. You can transform to these constructs later in your semantic analyzer visitor, and it's an elegant way of generating the extra classes and visitor hooks. This trick also allows one to resolve parser ambiguities in an early-stage visitor.

  • (no subject)

    I have yet to read a Java vs python comparison which was written by anyone with any serious enterprise development experience. If enterprises were…

  • (no subject)

    Today I was browsing my screenshots, and I found that I had failed the UK citizenship test. I took it again, just for fun, and failed with flying…

  • (no subject)

    Nobody in the USA has heard of Flanders and Swann. If the country had an editor, I would write to him to express my unmitigated disgust.

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.