Re: prefix for yacc/bison
From: Peter T. Breuer (ptb_at_oboe.it.uc3m.es)
Date: 07/12/05
- Next message: Christian Christmann: "Re: prefix for yacc/bison"
- Previous message: dyrmak: "Re: Linux? I'm tired of being the oddball in the group. It's not worth it. Hello OSX."
- In reply to: Erik de Castro Lopo: "Re: prefix for yacc/bison"
- Next in thread: Christian Christmann: "Re: prefix for yacc/bison"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 12 Jul 2005 08:26:39 +0200
Erik de Castro Lopo <nospam@mega-nerd.com> wrote:
> "Peter T. Breuer" wrote:
> >
> > That's because it's (a) silly,
>
> Its not silly. Its the most obvious and best way to include
> two grammars in one program.
It's a hack. Encapsulating parsers is an old trick (nowadays), best
done by bundling all the globals up into a single struct and passing the
address of that struct into all the parser internals as an extra arg,
and having them access the struct fields instead of globals.
Mind you, I suppose the namespace trick is one of the simpler strides
in that direction to take. It's really almost just like playing with
the linker renaming facilities.
> >(b) meaningless. Yacc and bison are
> > work-alikes.
>
> Actually no. The grammars that yacc accepts are a subset
> of what bison accepts.
Both can do "any grammar" since the attached actions can go play with
the parser mechanisms to their hearts content. But I grant you there
probably is some minor difference if you stick to productions alone.
> > Write code that both can parse. Don't write code that only
> > one or the other can grok.
>
> Nice idea in theory, not in practice. For instance Bison
> now has a GLR parser as well as an LALR(1) parser. Yacc
> only has the latter.
Things like that are generally words for "whatever I can do". GLR as
an acronym would indicate to me unbounded lookahead, which means
unbounded stack usage internally (I am in favour of this), but I don't
know if they mean it is top down or bottom up. The semantics would be
pretty different from classical yacc bottom-up parsing if it were
top-down. And I haven't seen any indication in the yacc code I have
looked at that it is other than a state machine plus a stack, which
means a bounded lookahead bottom-up machine.
> To the original poster, the best advice you are going to get
> is to just dump yacc and only support bison.
Well, he can fix the code generated to do as I suggested using an extra
stack pointer as an argument. And/Or he can simply add a use of "sed"
to his build stage.
Use of sed would probably be it for him.
Peter
- Next message: Christian Christmann: "Re: prefix for yacc/bison"
- Previous message: dyrmak: "Re: Linux? I'm tired of being the oddball in the group. It's not worth it. Hello OSX."
- In reply to: Erik de Castro Lopo: "Re: prefix for yacc/bison"
- Next in thread: Christian Christmann: "Re: prefix for yacc/bison"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|