alternative to lex and yacc?

Max Copperman <>
Fri, 2 Dec 1994 23:58:12 GMT

          From comp.compilers

Related articles
alternative to lex and yacc? (Max Copperman) (1994-12-02)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Max Copperman <>
Keywords: lex, yacc, tools, question
Organization: Compilers Central
Date: Fri, 2 Dec 1994 23:58:12 GMT

I am responsible for a scanner/parser that is a piece of a software
project expected to have a lifetime measured in years. I used lex
and yacc, but am wondering whether I (and the project) would be
better off building the scanner/parser with different tools.
I've looked in the free-compilers list, but I can't tell from the
information there whether it would be worthwhile to switch to
another package.

The project has to do with natural language, not compilers, so
packages that have better support for, say, code generation
may be better compiler construction tools but not be better for
our project.

I'd appreciate any comments on lex/yacc (actually flex/bison)
versus other tools, as well as answers to the questions below:

1) What is your favorite scanner/parser-building package?
      If it costs money, how much? Is there a migration path
      from lex/yacc to this package?

2) One problem I have is that the language I'm parsing has
      ambiguity that would most elegantly be resolved by using
      parsing information to determine where the token boundaries
      are. Is there a package that allows that?

3) Another is that I need to support language variants. In particular,
      a class of symbols appears in one position in one variant and in
      another position in another variant. Is there a package that
      allows me to express this naturally? Using yacc, I need two
      distinct grammars which are quite similar, and I need to link both
      sets of tables in, giving the user a choice between them (in
      engineering terms, choosing between them depends on the value
      of a flag). I can imagine a parser construction tool that allows
      me to condition the productions based on the value of a flag,
      but I don't know of any tool that does. Is there one? Is there
      some other natural way to solve this problem?

4) Do any packages allow regular expressions in the parser productions
      (i.e., "a -> b c+ d", where "->" is "goes to")?

5) Do any packages allow actions to be stated once and executed for
      each right-hand-side of a production? Maybe something like:
      "a {common prefix code for b and c}
            -> b {b specific code}
            -> c {c specific code}
                      {common suffix code for b and c}"


Max Copperman

Post a followup to this message

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