help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using the "output" from yacc


From: Hans Aberg
Subject: Re: Using the "output" from yacc
Date: Tue, 27 Jan 2009 16:58:17 +0100

On 27 Jan 2009, at 16:25, Alex Ryu wrote:

Thank you for your reply. I would prefer to keep everything in the project straight C for various reasons. Your idea is interesting, however, I would prefer things to be the other way around - my main function to only call
yyparse to parse the instruction string when it encounters one of the
integer "header" arrays mentioned above. The vast majority of execution time will be spent on processing the numeric data, and the code for that task is very long and complex. So I think it makes more sense to do it that way - however, I understand that might not be possible, seeing as it is not the purpose yacc is designed for. I suppose the best alternative is to just
hand-write a parser in C, maybe using flex for the lexer?

If you somehow have dynamic strings you want to parse from a file or a command line input, then a Bison/Flex is just fine.

You might star with the calculator example in the Bison manual. The code section of you .y file should have a #include. Then if you already have defined arrays, just write code in the actions to call them.

Thanks for your time
Alex
PS Is top posting or bottom posting the custom here?

The style I use, inserting comments, is normal on all technical lists of some age that I know - easier to follow technical details. Top posting is a younger style.

  Hans






reply via email to

[Prev in Thread] Current Thread [Next in Thread]