Writing a compiler compiler

"Vladimir Lushnikov" <vladimir.d.lushnikov@gmail.com>
17 Apr 2006 01:36:56 -0400

          From comp.compilers

Related articles
Writing a compiler compiler vladimir.d.lushnikov@gmail.com (Vladimir Lushnikov) (2006-04-17)
Re: Writing a compiler compiler haberg@math.su.se (2006-04-17)
Re: Writing a compiler compiler rsc@swtch.com (Russ Cox) (2006-04-17)
RE: Writing a compiler compiler qtj-query@shaw.ca (Quinn Tyler Jackson) (2006-04-17)
| List of all articles for this month |
From: "Vladimir Lushnikov" <vladimir.d.lushnikov@gmail.com>
Newsgroups: comp.compilers
Date: 17 Apr 2006 01:36:56 -0400
Organization: http://groups.google.com
Keywords: parse, question, comment
Posted-Date: 17 Apr 2006 01:36:56 EDT

Hello,


Firstly, let it be known that I am quite new to the subject of parser
generators, and having written only simple parsers for frivoulous
grammars by hand have little experience.


My objective is thus - to create a parser generator that will
eventually generate a parser for a dynamic language. However, my
undestanding of different parser types and distinctions between is
minimal; but as the web is a good enough resourse please assume my
knowledge of those areas.


The target for this parser generator would be a language similar to
C#, and I have found Jay (a yacc clone to C# and Java). The initial
implementation language is to be C++.


So here goes my question - how do you start writing a parser generator?
I am probably considering a LALR parser, but what are the main
differences between the different types? Specifically, why is an LR
parser unable to parse Python or C++? [source: Wikipedia]


Thank you for your time,
Vladimir Lushnikov
[These topics are all covered in compiler textbooks, many of which are
listed in the FAQ. Assuming by "dyamic language" you mean that the
syntax can change on the fly, you should learn about Early and Tomita
parsers, and pay particular attention to the reasons that even though
they're technically perfectly sound, few people use them. As to why
an LR parser can't parse Python or C++, LR parsers only handle a
subset of BNF. In particular they can't handle the ambiguity of C++
declarations. -John


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.