Similar to the narcissus parser implemented by Malte, such LALR(1) based parsers could be used for generating outline views and syntax checks running in a background worker thread. What it can't be used for is syntax highlighting, because LALR(1) based parsers need to reparse the whole file for every change to a document and that makes them too slow for syntax highlighting in realtime.
Tuesday, March 31, 2009
Javascript based parser generator system
I hope this is real (because April 1 is approaching, see my previous post): The first ever LALR(1) parser generator system written in and for Javascript. Would be interesting to add this to bespin, declarative grammars (as used in flex/yacc) are relatively easy to define, compared to codemirror which I used for the new, alternative bespin syntax engine and which is an interruptible-resumable continuation-passing style parser and needs to be written programatically for each language.
Subscribe to:
Post Comments (Atom)
4 comments:
Just to clarify: The narcissus parser was used by malte and created by Brendan Eich :)
You can use Antlr 3.1 to generate Javascript grammars. I'd love to see a review of it by a Javascript expert.
Sam, thanks, found it: http://code.google.com/p/antlr-javascript
Hey Roberto, Did you have any luck getting antlr-javscript to work? I'm wrestling with it at the moment. I'm starting to think about writing a parser for what I need from scratch :(..
Post a Comment