[antlr-interest] Reading directly from a file and not from stdin

Ric Klaren klaren at cs.utwente.nl
Fri Jan 24 07:14:56 PST 2003


Hi,

On Fri, Jan 24, 2003 at 11:22:54AM -0000, ttsoris <ttsoris at yahoo.com> wrote:
> I have the following problem with ANTLR-2.7.0. I dont know an easy
> way to read directly from a file and not std:cin. Redirection (e.g. 
> Myparser <Myfile.in) does not solve my problem, because I want to 
> debug Myparser. I am producing cpp code and I am trying to create a 
> command like: "Myparser Myfile.in". Any suggestions?

You can use fstreams for that (check out your favourite C++ reference for
them). For a complete example you might want to download antlr-2.7.2 and
check out the calc example from examples/cpp. That one has three different
ways of getting input to your parser.

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
  Wo das Chaos auf die Ordnung trifft, gewinnt meist das Chaos, weil es
  besser organisiert ist. --- Friedrich Nietzsche


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list