Related articles |
---|
writing a JavaScript Scanner/Parser kilik3000@gmail.com (Kilik) (2008-01-17) |
Re: writing a JavaScript Scanner/Parser oliverhunt@gmail.com (oliverhunt@gmail.com) (2008-01-28) |
From: | "oliverhunt@gmail.com" <oliverhunt@gmail.com> |
Newsgroups: | comp.compilers |
Date: | Mon, 28 Jan 2008 22:59:47 -0800 (PST) |
Organization: | Compilers Central |
References: | 08-01-047 |
Keywords: | tools, practice |
Posted-Date: | 29 Jan 2008 02:05:02 EST |
If your goal is merely to learn about writing parsers i would strongly
advise you look at another language -- javascript has some excitingly
complex constructs. Just to get a feel for it you may want to look at
the bison grammar from JavaScriptCore:
http://trac.webkit.org/projects/webkit/browser/trunk/JavaScriptCore/kjs/gramm
ar.y
That includes the semicolon handling (there are places where
semicolons can be left out in JS) as well as most of the other pre-JS2
idiosyncrasies.
--Oliver
On Jan 17, 1:20 pm, Kilik <kilik3...@gmail.com> wrote:
> As a purely academic exercise I would like to write a scanner/parser
> for JavaScript. I know that there are many existing alternatives for
> this, but I want to do my own so that I can learn. I'm thinking that
> the output of my program will be an abstract syntax tree for
> JavaScript. No need for a full blown JS runtime or anything like
> that.
>
> I would, however, like to get off on the right foot. Can anyone
> recommend the best place to start? For example should I use a parser
> generator or try to implement this by hand. ...
Return to the
comp.compilers page.
Search the
comp.compilers archives again.