For Programmers: Free Programming Magazines  


Home > Archive > Compilers > October 2006 > Simple Recursive Decent Parser question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Simple Recursive Decent Parser question
typingcat@gmail.com

2006-10-06, 7:03 pm

I'm writing a recursive decent parser for a language called c- for a
school project. Is it OK to merge two or more EBNF rules into one rule
(to reduce the number of functions)? This question looks (a little bit
| very) dumb but I wonder if it causes some kind of associativity
problem or something.

For example,
2. declaration-list->{declaration}+
3. declaration->var-declaration | fun-declaration

declaration-list->{var-declaration | fun-declaration}+

Thank you in advance.
Hans-Peter Diettrich

2006-10-07, 4:14 am

typingcat@gmail.com wrote:

> I'm writing a recursive decent parser for a language called c- for a
> school project. Is it OK to merge two or more EBNF rules into one rule
> (to reduce the number of functions)?


This depends (only) on the kind/definition of EBNF you're using. If you
have an translator into BNF, you can compare the results of your
modifications to the grammar, on BNF level.

DoDi

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com