|LL(1)/Recursive Descent Parsing Question email@example.com (2002-03-19)|
|Re: LL(1)/Recursive Descent Parsing Question firstname.lastname@example.org (jacob navia) (2002-03-21)|
|Re: LL(1)/Recursive Descent Parsing Question email@example.com (Peter H. Froehlich) (2002-03-21)|
|Re: LL(1)/Recursive Descent Parsing Question firstname.lastname@example.org (Joachim Durchholz) (2002-03-22)|
|Re: LL(1)/Recursive Descent Parsing Question email@example.com (SLK Parsers) (2002-03-25)|
|From:||"jacob navia" <firstname.lastname@example.org>|
|Date:||21 Mar 2002 21:45:31 -0500|
|Organization:||Wanadoo, l'internet avec France Telecom|
|Posted-Date:||21 Mar 2002 21:45:31 EST|
"Neelakantan Krishnaswami" <email@example.com> 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
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.
Return to the
Search the comp.compilers archives again.