8 Feb 2004 22:08:49 -0500

Related articles |
---|

Parser then Attribute Grammar for C++ dezakin@usa.net (2004-02-08) |

Re: Parser then Attribute Grammar for C++ vidar@hokstad.name (2004-02-12) |

From: | dezakin@usa.net (Dez Akin) |

Newsgroups: | comp.compilers |

Date: | 8 Feb 2004 22:08:49 -0500 |

Organization: | http://groups.google.com |

Keywords: | C++, parse, question |

Posted-Date: | 08 Feb 2004 22:08:49 EST |

I've been looking into constructing a compiler front end for C++, and

how to do it. After doing some reading on various grammers and parser

generators, Boost Spirit looks promising (an LL(k) recursive decent

parser) but another paper I read called "A Generated Parser of C++" by

Warwick Irwin and Neville Churcher seems to indicate that there are

semantic constructs that are necissary to be inferred before parsing

the language.

What I'm interested in is if its possible to do the parsing of C++ in

stages, making a regular grammar for the lexer, a LL(k) grammmer for

the first parser, and an attribute grammar to decorate the resulting

syntax tree, or if the semantic ambiguities in C++ actually prevent

such a clean layering.

If you can do it this way, is there a formal notation for Attribute

grammars analagous to EBNF for context free grammars?

Also given that regular grammars are a subset of LL(1) grammars are a

subset of LR(1) grammars are a subset of arbitrary context free

grammars, can you have a layered universal parser that runs better

than the O(n^3) Early algorithm by breaking up the grammar into its

modular lexical, LL(1), LR(1), and CFG components? Then extend this to

context sensitive grammars?

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.