help-bison
[Top][All Lists]
Advanced

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

Re: Bison Output


From: Hans Aberg
Subject: Re: Bison Output
Date: Sun, 31 May 2009 10:04:00 +0200

On 31 May 2009, at 05:21, Luis Vital wrote:

I have used Bison sometimes.
Usually, after compiling Bison and Flex files the input come from a file
that we redirect to the executable and the output goes to the screen.
If I want to give the input file as an argument in the command line I can
use 'yyin'.

The Bison generated parser just reads the stream handed down to it from the lexer. The Flex generated lexer can set where it reads, using yyrestart() - see the Flex manual.

And what about the output? How can I send it to a file without having to
redirect it?

And the Bison generated parser just does what is written in the actions of grammar file. So just change this to write to a file or a stream that is defined externally to the parser code.

  Hans






reply via email to

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