Is there a JavaScript framework that allows to define a parsing grammar using JavaScript syntax, similar to the way Irony does it for C#?
+2
A:
I don't know much about how Irony works, but Chris Double has a library that lets you define grammars in JavaScript here: http://www.bluishcoder.co.nz/2007/10/javascript-parser-combinators.html. It looks like you need to use git to download the code. If you don't have access to git, I could create an archive you can download somewhere else.
It's a "parser combinator" library which means you combine parsers for each production in your grammar into a larger parser that parses the whole thing. Each "sub-grammar" is a just a function that you create by calling the library functions.
Matthew Crumley
2009-06-24 01:46:58
Thanks, that seems to be the thing I was looking for, I'll take a closer look.
Andrey Shchekin
2009-06-24 05:53:46
A:
This is not exactly what you need but this article goes through making a recursive descent parser in javascript for javascript itself.
eulerfx
2009-06-24 01:54:00
That's actually top down operator precedence. I think it's also found in a chapter of the book, "Beautiful Code."
Nosredna
2009-06-24 02:00:37
recursive descent is top down - the "descent" implies top down and "recursive" means that productions rules as functions call themselves. operator precedence refers to how look ahead is resolved.
eulerfx
2009-06-24 05:57:51