help-bison
[Top][All Lists]
Advanced

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

Re: Input to Parser.


From: David Durham
Subject: Re: Input to Parser.
Date: Tue, 30 Oct 2001 09:13:32 -0600

Well this is a flex/lex issue, not a bison issue...

As you may know, bison just calls 'yylex' expecting to get an int back
which is the token value.... There is also a global variable, 'yylval'
to communicate the semantic value of the token back to bison... (as well
as yylloc if you define the macro to return positional information about
the token)...

So, you can either write your own lexer (i.e. define your own yylex
function) and read from whereever the heck you want. 

Or...

for flex: 
   call yy_scan_string(char *) and implement yywrap to return 1

There are several other yy_scan_xxx functions you may want to consider.

Now all of this is in the flex manual... And I know this isn't the flex
mailing list, but I thought I'd give you a place to start...  And the
question does pertain to bison in that it's a common misunderstanding
that bison itself actually reads anything...
 
-- Davy


On Tue, 2001-10-30 at 05:42, Shahida_Aslam wrote:
> Hi,
>    This is Shahida working on Lex and Yacc parser. The normal method of
> writing into a file and then passing the file pointer to yyin works fine. I
> am having problem when i want to take the input from a buffer. Say for
> example i want to call the parser functonality in Linux like  -
> System(./lexyacc, buffer) where buffer is char buffer[80] or so containing
> the stream. Is this possible and if so could you pls let me know the
> procedure to do so. I want to remove the file depency in yacc. Is there any
> way doing without file manipulation. 
>       It would be nice of you if you could reply me at the earliest.
> Thanks in advance. 
> 
> Regards,
> Shahida.
> 
> _______________________________________________
> Help-bison mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-bison





reply via email to

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