Re: Flex/Bison/ANTLR question... alternative tools for translation?

Laurence Finston <lfinsto1@gwdg.de>
18 Mar 2005 00:45:18 -0500

          From comp.compilers

Related articles
Flex/Bison/ANTLR question... alternative tools for translation? elikon@cox.net (rgaupsas) (2005-03-15)
Re: Flex/Bison/ANTLR question... alternative tools for translation? lfinsto1@gwdg.de (Laurence Finston) (2005-03-18)
Re: Flex/Bison/ANTLR question... alternative tools for translation? Brian.Inglis@SystematicSW.ab.ca (Brian Inglis) (2005-03-20)
Re: Flex/Bison/ANTLR question... alternative tools for translation? sk@z.pl (Sebastian) (2005-03-20)
Re: Flex/Bison/ANTLR question... alternative tools for translation? elikon@cox.net (rgaupsas) (2005-03-24)
Re: Flex/Bison/ANTLR question... alternative tools for translation? Brian.Inglis@SystematicSW.ab.ca (2005-03-25)
Re: Flex/Bison/ANTLR question... alternative tools for translation? elikon@cox.net (rgaupsas) (2005-03-31)
Re: Flex/Bison/ANTLR question... alternative tools for translation? Brian.Inglis@SystematicSW.ab.ca (Brian Inglis) (2005-04-02)
| List of all articles for this month |

From: Laurence Finston <lfinsto1@gwdg.de>
Newsgroups: comp.compilers
Date: 18 Mar 2005 00:45:18 -0500
Organization: GWDG, Goettingen
References: 05-03-055
Keywords: parse

On Tue, 15 Mar 2005, rgaupsas wrote:


> I'm working on a translator whereby the input grammar is poorly
> defined; a lot is contextually dependent.


Is there a reason why you can't change it?


> I've gotten pretty far with
> Flex/Bison, [...]
>
> WK COLOR COLOR ... COLOR NAME PARAM = NUMBER
>
> The problem is that syntactically NAME and PARAM are indistinguishable
> from COLOR (both are alpha numeric of the same form), so the following
> form will not work (note Bflag sets the start_state in Flex).


I don't understand this. Since you're using uppercase, I would expect
that `COLOR', `NAME', and `PARAMETER' would be terminal symbols in the
rules of your GNU Bison grammar, so that they could not be said to be
alphanumeric. The same would apply if they were non-terminal symbols.
If "COLOR", "NAME", and "PARAMETER" are keywords in your grammar, I
would expect your scanning function (`yylex()') to look them up in a
table and return the appropriate token to `yyparse()'.


> Any way to better handle this with Flex/Bison?


I suggest you post (or "cc") any further questions to the
Flex and/or GNU Bison mailing lists:
help-flex@gnu.org
help-bison@gnu.org


> Any other recommended tools or methods for building a translator for
> a poorly structured language.


I can't think of any reason why anyone would want to write such a
tool.


Laurence Finston
http://www.gnu.org/software/3dldf/LDF.html


Post a followup to this message

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