Scripting library

Started by
11 comments, last by TheDeath 23 years, 10 months ago
Hello all, I''m need to do a parser for my own scripting system to add AI to a RPG creator that I''m doing. Anyone knows of one (or more) libraries to do that (to understand the scripts)? Library for DJGPP and to understand C scripts. Thanks a lot!
Advertisement
I''m afraid that you''re on your own there, I suggest that you use the good old stdio.h , stdlib.h string.h functions for parsing your script. You could like have a function that parses one line of text and puts the strings in their variables etc, like it puts the "function" into the function string, var1 into the variable string etc, then you''d jsut check what function it is and pass the variables to it?

Sounds simple but you need to code it well and it might take a weekend...

Dæmin
(Dominik Grabiec)
sdgrab@eisa.net.au

CyberPunk RPG
http://www.eisa.net.au/~sdgrab/index.html
Daemin(Dominik Grabiec)
Just looking for a parser ?
Run a search for "lex" and "yacc" in any search engine.

Be reading you,
David
Well, actually i was talking about a library like SeeR (more or less). Just a library like it, not to do my own parser. Is it out there in the net?
I do not understand. What is the SeeR library ?
If you are looking for a C interpreter, I am pretty sure there are some. You can start by looking for csh.
However, I am not sure I understand why anybody would like interpreted C.

Be reading you,
David
Interpreted C could be useful in letting designers, or even end users customise your game, without needing a compiler, to to stop the game, etc.
...and that's what I'm trying to do with my creator.

I haven't said it better!

What I'm trying to do is something like a mini-"compiler" for the creator, something like Quake-C, and that's the reason why I'm looking for a library to understand C scripts and let me do whatever I want in my creator without need of "real" C-compiler. I hope this is clear...

Edited by - TheDeath on May 26, 2000 12:00:32 PM
Almost.
Do you want it compiled or interpreted ?
Well, at first just interpreted, but if the library has the option to compile it (like SeeR - look in www.allegro.cc in ai & scripting), better!
As was mentioned before, yacc and lex would be a good start. They''re a free lexxer and parser, which gets half your job done. Then all you need to do is write the code which actually executes the tokens from the script (a virtual machine).
As to the question of compiled vs. interpreted, it''s a fairly moot point. If you save the tokens, and later execute them directly, it''s compiled. If you parse the script, then execute the tokens, it''s interpretted. Big whoop, eh? You don''t have to create native code (in fact, I''d advise against it) in order to have a compiled language.

This topic is closed to new replies.

Advertisement