Thanks Ian,
I think I understand more or less what is going on there. However, that seems
to imply I can't rely on testing for an optional symbol (such as ExprTail) to
be nil, if I want to know if it was parsed or not?
Is there another way to see e.g. for
'x' xt:ExprTail?
whether just 'x' was parsed or rather e.g. 'x.id(3)'?
What I can come up with is doing this:
Expr =
'x'
| 'x' xt: ExprTail
| 'this'
| 'this' tt:ExprTail
| Number
| Number nt:ExprTail
| String
| String st: ExprTail
But that would make it somewhat verbose...
Thanks again,
Hans
On Tuesday 18 September 2007, you wrote:
> Hans,
>
> > Expr =
> > 'x' xt:ExprTail?
> >
> > | 'this' tt:ExprTail?
> > | Number nt:ExprTail?
> > | String st: ExprTail?
> >
> > ExprTail =
> > '.' i:Identifier '(' arg:Expr ')' t:ExprTail?
>
> The variables are stored on a stack so that re-entrant rules behave
> correctly. They are not initialised until the action(s) associated
> with the rule(s) that succeeded within the entire parse are triggered
> when the start symbol's rule succeeds. The stack is initialised one
> element at a time, as each 'named semantic value' is encountered, in
> the final parse of the input. Earlier actions will leave stuff in
> the stack that later actions might see if they happen to share the
> same stack location during the final evaluation of the actions.
>
> The effect that you want might be easily achievable but I'll have to
> think about it. If something as simple as introducing an implicit
> action at the start of every rule to clear the stack locations
> associated with its variables can be shown to be robust then I think
> it would be worthwhile. Until then assume that every variable
> contains undefined junk unless its rule is known to have succeeded in
> the final parse of the input.
>
> Cheers,
> Ian
--
If we cannot live so as to be happy, let us at least live so as to deserve it
-- Immanuel Hermann Fichte
A liberal is a person whose interests aren't at stake at the moment
-- Willis Player
Ark Linux - Linux for the Masses (http://arklinux.org)
Hans Schippers
Aspirant FWO - Vlaanderen
Formal Techniques in Software Engineering (FoTS)
University of Antwerp
Middelheimlaan 1
2020 Antwerpen - Belgium
Phone: +32 3 265 38 71
Fax: +32 3 265 37 77
_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc