News for hackers. Stuff that matters.
Re:PEG.js - parser generator for JavaScript by raganwald on Wednesday March 17, 2010 @11:14AM (#1198722)
Are there PEGs available for languages like Javascript? Given recent discussion of Perl being undecidable, I assume there isn't one for Perl. Has anyone tackled such a thing for Ruby?

Update: Thanks for the links! That being said, I didn't mean parsers written in Javascript or Ruby, I mean PEGs or CFGs that parse Javascript and/or Ruby programs :-)

Re:PEG.js - parser generator for JavaScript by moserware on Wednesday March 17, 2010 @11:44AM (#1198812)
You might look at OMeta/JS: http://tinlizzie.org/ometa-js/#JavaScript_Compiler

OMeta is based upon PEGs and is worth a look because it has some great meta-meta ideas from the 60's that were ignored.

(Also, there are several ports of OMeta to other languages)

Re:PEG.js - parser generator for JavaScript by dmajda on Wednesday March 17, 2010 @01:08PM (#1199040)
ECMAScript 5 PEG parser: http://boshi.inimino.org/3box/PEG/build/ES5.html

(Hmm, I must definitely try to port it to PEG.js :-)

As for Ruby, I am not sure if it is even possible to create a PEG grammar. Its lexer and parser are heavily interconnected and there is a lot of state involved. If the grammar will be created, I don't think it would be pretty.

Re:PEG.js - parser generator for JavaScript by ErrantX on Wednesday March 17, 2010 @11:44AM (#1198811)
http://treetop.rubyforge.org/

Im writing a programming language in Ruby at the moment - and after playing with that for a few days I've gone back to "hand coded lexer plus Racc for grammar". It's probably personal preference but I find that a little more tunable.

Re:PEG.js - parser generator for JavaScript by dmajda on Wednesday March 17, 2010 @11:46AM (#1198821)
What exactly you didn't like?
Re:PEG.js - parser generator for JavaScript by ErrantX on Wednesday March 17, 2010 @11:48AM (#1198828)
Just personal preference: I prefer the grammar structure for parsers like Racc
Re:PEG.js - parser generator for JavaScript by scythe on Wednesday March 17, 2010 @12:58PM (#1199018)
They're native in Perl 6, and people above have linked to libraries for Lua and Clojure. I think there's a library for Python as well somewhere or other.

Also peg/leg for C is intended (iirc) as a direct competitor to flex/bison et al.