Mailing List Archive


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

Re: [tlug] presentation wish list



On 2014年10月13日 18:28, Benjamin Kowarsch wrote:
> In our case, it turned out far less trouble and effort to write a
> lexer and parser from scratch by hand using recursive descent.

I am a huge fan of recursive descent parsing, as it is simple yet quite
powerful! :)

> Even so, there are other parsing tools that are easier to use than
> flex/bison and have other features that are helpful to language
> designers/experimenters.

These days, I prefer PEG/packrat over LL(n):
* http://bford.info/pub/lang/peg.pdf
* http://bford.info/pub/lang/packrat-icfp02.pdf

For anybody interested in an example, here is a grammar for JavaScript:
* https://github.com/dmajda/pegjs/blob/master/examples/javascript.pegjs

> Anyway, I could give a presentation that covers:
> 
> (1) the concept of recursive descent parsing
> (2) how to craft an LL(n) grammar that can be parsed using RD
> (3) how to translate an LL(n) grammar directly into code
> (4) how to use ANTLR to visualise and verify a grammar and visualise conflicts
> (5) summarise the benefits of LL parsing in general and ANTLR as a
> prototyping tool
> 
> However, parsing is a fairly complex subject matter. I doubt that it
> would be a good idea to cover a presentation for LR parsing and
> flex/bison as well as LL parsing and RD/ANTLR on a single day. It is
> probably better to do this on two separate meetings.

That does indeed sound like it would be a bit much for one meeting!

Cheers,

Travis


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links