Re: Parsing nested structures with yacc

kamal <kamalpr@hp.com>
Mon, 11 Aug 2008 02:49:01 -0700 (PDT)

          From comp.compilers

Related articles
Parsing nested structures with yacc amoebae@gmail.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 max@gustavus.edu (Max Hailperin) (2008-08-09)
Re: Parsing nested structures with yacc kamalpr@hp.com (kamal) (2008-08-11)
Re: Parsing nested structures with yacc amoebae@gmail.com (amoe) (2008-08-19)
Re: Parsing nested structures with yacc max@gustavus.edu (Max Hailperin) (2008-08-20)
| List of all articles for this month |

From: kamal <kamalpr@hp.com>
Newsgroups: comp.compilers
Date: Mon, 11 Aug 2008 02:49:01 -0700 (PDT)
Organization: Compilers Central
References: 08-08-014 08-08-016 08-08-018
Keywords: parse
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.


regards
-kamal
[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]



Post a followup to this message

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