|Parsing nested structures with yacc email@example.com (amoe) (2008-08-07)|
|Re: Parsing nested structures with yacc cfc@shell01.TheWorld.com (Chris F Clark) (2008-08-08)|
|Re: Parsing nested structures with yacc firstname.lastname@example.org (Max Hailperin) (2008-08-09)|
|Re: Parsing nested structures with yacc email@example.com (kamal) (2008-08-11)|
|Re: Parsing nested structures with yacc firstname.lastname@example.org (amoe) (2008-08-19)|
|Re: Parsing nested structures with yacc email@example.com (Max Hailperin) (2008-08-20)|
|Date:||Mon, 11 Aug 2008 02:49:01 -0700 (PDT)|
|References:||08-08-014 08-08-016 08-08-018|
|Posted-Date:||11 Aug 2008 10:34:34 EDT|
> As David suggested, this is making good use of yacc's stack. The list
> is being built up starting with an empty list and tacking elements
> onto the front, starting with the last element and continuing forward
> until the first element is tacked on -- the opposite of the order in
> which the elements are read. That reversal of order is coming from
> yacc's stack, and explains why there is no need to be mutating the
> tail end of a list.
> Yacc's stack also addresses David's other concern, the ability to nest
> lists within lists as the constituent elements. That is achieved just
One practical consideration here:-
The yacc geenrated code has a #define YYMAXDEPTH (=150, but
modifiable) which could be a limiting factor for functional languages.
I mean, unlike procedural languages -they have recursive functions
which are evaluated lazily.
[I doubt it'll be a problem. Remember that the yacc stack is used for
parsing the input, not for running the resulting program, and the
stack just tracks the unconsumed tokens and symbols. It'd be a pretty
dense program that needed more than that. -John]
Return to the
Search the comp.compilers archives again.