Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Scripting....


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 browny   Members   -  Reputation: 139

Like
Likes
Like

Posted 24 November 2001 - 10:54 AM

How do i add scripting support to my VC++ program. Although I just need to evaluate mathematical expressions at run-time, nothing more than that. Any help would be highly appreciated....

Sponsor:

#2 NickB   Members   -  Reputation: 146

Like
Likes
Like

Posted 24 November 2001 - 01:41 PM

Ouch - it can be a little hard; unless you're talking _VERY_ simple expressions, you'll have to write a lexer & parser, create a tree for the expression, then walk it to evalutate the expression.

ANTLR is a tool for creating lexers & parsers...this also has a simple calculator as one of it's examples...I extended it as a learning exercise to handle fairly complex expressions without too much difficulty, I suggest you have a play with the examples to help figuring Antlr out
www.antlr.org - Antlr's home page

Have a look on www.flipcode.com, they did a series on writing a simple script engine sometimes last year - its in their tutorial sections

The best known tools for compiler construction are 'lex' and 'yacc' ('flex' & 'bison' respectivly for non-unix systems) - they're all over the place & (I suppose) freeware - I've never used these myself...but they're always mentioned...but fairly old

Edited by - NickB on November 24, 2001 8:43:57 PM




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS