Re: LL(1)/Recursive Descent Parsing Question

"jacob navia" <>
21 Mar 2002 21:45:31 -0500

          From comp.compilers

Related articles
LL(1)/Recursive Descent Parsing Question (2002-03-19)
Re: LL(1)/Recursive Descent Parsing Question (jacob navia) (2002-03-21)
Re: LL(1)/Recursive Descent Parsing Question (Peter H. Froehlich) (2002-03-21)
Re: LL(1)/Recursive Descent Parsing Question (Joachim Durchholz) (2002-03-22)
Re: LL(1)/Recursive Descent Parsing Question (SLK Parsers) (2002-03-25)
| List of all articles for this month |

From: "jacob navia" <>
Newsgroups: comp.compilers
Date: 21 Mar 2002 21:45:31 -0500
Organization: Wanadoo, l'internet avec France Telecom
References: 02-03-106
Keywords: parse, LL(1)
Posted-Date: 21 Mar 2002 21:45:31 EST

"Neelakantan Krishnaswami" <> wrote in message
> I'm working on the syntax for a small programming language, and I'd
> like to make sure that my language is parseable with an LL(1) grammar.
> However, I'm still messing around with the grammar, and it's quite
> unpleasant to have to write my grammar rules in an epsilon-free,
> left-factored left-recursion-free form.
Yes, grammars are difficult.


> Eg, I might write
> sequence(start:RPAREN, element:<expr>, delimiter:COMMA, close:LPAREN)
You want then:

')' <expr> ',' expr , ... until you hit '('

The right paren is quite difficult for a start. At any expresion you can
        a = (b+C);
That right parentheses could be mis-understood.

I am supposing that you mean:

( (expr ,) *)

i.e. a sequence of expressions separated by commas enclosed in parentheses.

You scan an expression, looking for the "end of expression" marker, in this
case either the comma or (probably) the semi-colon. Your software knows if
it is in a sequence or not after it has scanned the first expression. You
are in a sequence only if a comma has been seen.

Not very difficult. Keep things simple, with as little complexity as

Enclosing a sequence of expressions in parentheses and attach some meaning
to that?

Interesting... I associate it with a parallel language, statement lists that
could be executed in parallel.

A bucket would be a set of independent calculations, that can be performed
in parallel, separated by commas.

good luck


Post a followup to this message

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