delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/05/08:06:32

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: bison
Date: 5 Dec 2000 13:04:23 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 23
Message-ID: <90ip4n$ds4$1@nets3.rz.RWTH-Aachen.DE>
References: <90anr9$ji0$1 AT lacerta DOT tiscalinet DOT it>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 976021463 14212 137.226.32.75 (5 Dec 2000 13:04:23 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 5 Dec 2000 13:04:23 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

[This is in no way particular to DJGPP...]

abacuc <f DOT onorati AT tiscalinet DOT it> wrote:
> I read some info for bison and i realize a parser but it's a entire
> program...

No, it isn't. Or only if you request a complete program from Bison.
You normall get a sourcecode from Bison that compiles into a single
user-visible function yyparse().

> i want to know if is it possible to realize a function parser
> (e.g. a function that receive a string like input parameter like 2+3-4*12
> and return a double output) that i can use in a my project.

That's really easy. The trick is to define your own 'yylex' (or
yyinput(), if you're using Flex along with Bison) that reads out of a
string instead of a file.



-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019