Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

interpreter

Status
Not open for further replies.

qiqinuinaifen128

Programmer
Joined
Dec 9, 2007
Messages
20
Location
SG
Hi there,

is anybody using c writing an interpreter before?
i want to interpret a string which key by user, What command should i use?

Singapore Swimming Lessons
 
gets will the the whole line in
scanf has a complicated syntax between the quotes for parsing all sorts of stuff.

If the language you are interpreting has a defined syntax, might be an idea to look at lex and yacc.
 
Google is you friend

lex & yacc gets & scanf - example of usage
The thing is to define you language first. If it has common delimiters, you could use strtok to split up the words but note that this is not thread safe so if you are using it in a multi threaded env, always use it in the same thread.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top