|Technical arguments for using compiler tools? email@example.com (1993-06-09)|
|Re: Technical arguments for using compiler tools? firstname.lastname@example.org (1993-06-11)|
|Re: Technical arguments for using compiler tools? email@example.com (1993-06-12)|
|Organization:||Computing Services Division, University of Wisconsin - Milwaukee|
|Date:||Fri, 11 Jun 1993 18:04:12 GMT|
>I work on a NASA project where we have defined a Test Control Language
>(TCL) to control testing of flight software in a test environment. The
>language parser was implemented in the form of a hand-written,
>recursive-descent style parser.
>How can I (or should I) convince management that we should be using
>compiler tools. The code is written in Ada. We have access to Aracdia's
>AYACC and ALEX and AFLEX.
Do you have a BNF grammar on line of the language being parsed? I'm
curious as to what it looks like.
I've written parsers for languages with C-like syntax that are more
compact (and as easy to alter), more efficient than a YACC source, and far
easier to add good error-checking into.
>From my experience, I'd say that either (1) you're better off writing it
by hand because there are less constraints on development -- grammars have
to be greatly expanded and flexibility squeezed just to fit them into the
restrictive format required by YACC (which is why my hand written parsers
tend to be smaller), or (2) finding a better tool that can work directly
with EBNF grammars, and produce intuitive code in your target language.
As an illustration, try expressing something like this (which is what I
work directly off of) efficiently in YACC without a lot of tweaking and
expansion (it's a segment of a Pascal syntax in an EBNF-like notation) and
still get intuitive code for it.
Block: "begin" Sequence "end";
Sequence: ([Statement] ":")* [Statement];
Statement: LABEL ":" Statement
| Var ":=" Exp
| NAME ["(" (Param ",")* Param ")"]
| "goto" LABEL
| "if" Exp "then" Statement ["else" Statement]
| "case" Exp "of" ([Case] ";")* [Case] "end"
| "while" Exp "do" Statement
| "repeat" Sequence "until" Exp
| "for" NAME ":=" Exp ("to" | "downto") Exp "do" Statement
| "with" (Var ",")* Var "do" Statement
Case: (Constant ",")* Constant ":" Statement;
| Exp ":" Exp [":" Exp] /* only in i/o */
[A better tool would be nice, but yacc's grammar error detection is still
Return to the
Search the comp.compilers archives again.