YA YACC/LEX question

ksmith@cinenet.net (Kevin Smith)
9 Mar 2003 17:42:28 -0500

          From comp.compilers

Related articles
YA YACC/LEX question ksmith@cinenet.net (2003-03-09)
| List of all articles for this month |

From: ksmith@cinenet.net (Kevin Smith)
Newsgroups: comp.compilers
Date: 9 Mar 2003 17:42:28 -0500
Organization: http://groups.google.com/
Keywords: lex, question
Posted-Date: 09 Mar 2003 17:42:28 EST

I've been through what seems like the whole internet and can't find an
example of what I need to do.
    I'm writing a plug-in for a 3D graphics package (Maya). I need to
take a command written in a very simple scripting language, parse it
and pass out the result.
    An example input would be


    inputString = "2 * tan(input1 * 2)"


    This seems like the perfect use for lex/yacc. I've found dozens of
calculators on the web. But (there's always a but :/ ) every example
I've seen compiles a standalone executable. What I need is a function
that I can pass a string, and returns a float, from the compute()
function in my plug-in. I can't for the life of me find an example of
how to do this.
    Any pointers to such an example would be hugely appreciated.
--
Kevin Smith
Senior Technical Director
Cinesite Hollywood
[The example in my lex&yacc book evaluates the expression it parses. It's
just integers, but the changes to handle float and more stuff are obvious.
Or you could swipe the expression evaluator from TCL. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.