> All my searches for tutorials on writing an interpreter for
> a scripting language like COG or QuakeC have turned up nil.
> Would anyone have any suggestions where such a tutorial can
> be found?
There's a discussion on the creation of COG on gamasutra:
Specifically, the article can be found at:
http://www.gamasutra.com/features/programming/100397/languages1.htm
Very interesting reading, with links to other resources for what
you're looking to do.
Happy new year
Roger
> All my searches for tutorials on writing an interpreter for a scripting
> language like COG or QuakeC have turned up nil. Would anyone have any
> suggestions where such a tutorial can be found?
Here's a suggestion. Don't write your own interpreter. Use an existing,
free, debugged, embeddable, powerful one such as Python
(http://www.python.org) or tcl.
--
Paul Miller | st...@fxtech.com
Similarly, if you don't want to write the scripting language but would
rather use one that already exists, available in source, is supported and
can be extended at will you might want to check out LUA:
http://www.tecgraf.puc-rio.br/lua/
--
Paul Hsieh
q...@chromatic.com
> All my searches for tutorials on writing an interpreter for a scripting
> language like COG or QuakeC have turned up nil. Would anyone have any
> suggestions where such a tutorial can be found?
> --
> Alexander
> synta...@earthlink.net
> http://home.earthlink.net/~syntaxlogic/
This may not be precisely what you want, but there's an old Turbo-C book
that has code for a BASIC interpreter and explains how it works. It may
help you with what you need to do.
"Turbo-C, The Complete Reference" by Herbert Schildt. Published in 1988
by McGraw-Hill.
Mitch O'Brien.
http://www.cis.ufl.edu/~fryman/c.lex.spec.html
http://www.cis.ufl.edu/~fryman/c.yacc.spec.html
Can anyone send me a copy if they got it?
Roger McFarlane <rog...@earthling.net> wrote in article
<34AAD0B6...@earthling.net>...
> Alexander wrote:
>
> > All my searches for tutorials on writing an interpreter for
> > a scripting language like COG or QuakeC have turned up nil.
> > Would anyone have any suggestions where such a tutorial can
> > be found?
>
> There's a discussion on the creation of COG on gamasutra:
>
> http://www.gamasutra.com
>
> Specifically, the article can be found at:
>
> http://www.gamasutra.com/features/programming/100397/languages1.htm
>
> Very interesting reading, with links to other resources for what
> you're looking to do.
>
> Happy new year
>
> Roger
Roger McFarlane wrote:
> Alexander wrote:
>
> > All my searches for tutorials on writing an interpreter for
> > a scripting language like COG or QuakeC have turned up nil.
> > Would anyone have any suggestions where such a tutorial can
> > be found?
>
> There's a discussion on the creation of COG on gamasutra:
>
> http://www.gamasutra.com
>
> Specifically, the article can be found at:
>
> http://www.gamasutra.com/features/programming/100397/languages1.htm
>
> Very interesting reading, with links to other resources for what
> you're looking to do.
This article was very similar to the paper and speech the same author gave at the CGDC. This is the info I used when I
implemented my own parser/interpreter about three or four months ago. I used Flex and Bison, and I used the "Unix Programming
Tools: lex & yacc" book as my reference for those languages. Be aware that you will have to write your own code for creating
parse trees if you want to use these tools to compile into byte codes.
I'm also finding the Flex-Bison combo to be **VERY** useful for creating "editors" for game data. Rather than having to take
the time and write a graphical editor, I created a parser to take text files that describe some of the game data, and
translate it into the internal binary structures. Now I can develop a parser in a fraction of the time it would take me to
put together a visual editor, and it is very quick and easy to add new functonality. Doesn't work with all data, but it works
with a lot of it.
Later,
Michael Duffy
mdu...@ionet.net
Michael Duffy <mdu...@ionet.net> wrote in article
<34ABBE38...@ionet.net>...
If you want to actually understand what you are doing with your scripting
language, you should probably invest in the Aho, Sethi and Ullman book
_Compilers, Principles, Techniques and Tools_. Good reference but it
may be more than you wanted.
Cheers,
Chris.
--
Mail: crpa...@undergrad.uwaterloo.ca
Homepage: http://www.undergrad.math.uwaterloo.ca/~crpalmer/
[snip]
>Here's a suggestion. Don't write your own interpreter. Use an existing,
>free, debugged, embeddable, powerful one such as Python
>(http://www.python.org) or tcl.
And use SWIG to imbed your own C/C++ functions into the language. Takes
a lot of the nusiance out of customizing the two languages (Python/TCL).
Otherwise learn lex/yacc or flex/bison.
>Paul Miller | st...@fxtech.com
Nigel
>Is there a free working parser for DJGPP (or better yet, utilizing allegro)
>with source code?
What is it that you need exactly? What do you want to accomplish with
this? Are you trying to add scripting abilities to a program you are
writting, or is this some tool for another program? It will be easier
to give you give you good advice if I know what you are trying to do.
I've created my own scripting language, and written a compiler and
interpreter for it which I am planning to use with my CRPG I'm
writting. I've written the code to be pretty flexible and usable by
other programs as well, as long as it has enough power for such
programs. My language is limited to integers and strings, with string
usage being very limited really. It's all I really need for my needs
right now, though, so no big deal. I must say, it was a hell of a lot
of fun doing this, btw. I haven't been that hooked on programming
something in a long time.
-Jason
So has anyone worked out a LEX/YACC grammer for any graphic file formats?
Wilbur
If I *had* to support such ugly thinks as LBM or even TIFF (yuck!), I'd
probably use a library anyway. I don't see a point in reinventing the wheel.
Or am I completely missing your point here?
Confused,
Robert
>Wilbur Streett wrote:
>>So has anyone worked out a LEX/YACC grammer for any graphic file formats?
>I don't think there's a need to do that. Most GFX formats are a simple
>header + the data.
Like 3DS? or RDX? or OBJ.. Sorry, I should have been more specific..
Wilbur
-----------------------------------------
Putting a Human Face On Technology ;-)
-----------------------------------------
Wilbur Streett wrote:
> So has anyone worked out a LEX/YACC grammer for any graphic file formats?
>
> Wilbur
I don't think this would be possible since lex&yacc only work with text, not binary data (IIRC). I would think that it would be
easier to just write a graphics file format parser in straight code.
Later,
Micahel Duffy
mdu...@ionet.net
>
>I don't think this would be possible since lex&yacc only work with text, not binary data (IIRC). I would think that it would be
>easier to just write a graphics file format parser in straight code.
I should have been more clear.. the 3D file formats..
And lex&yacc can handle binary. It's a common question in comp.compilers.
Wilbur Streett wrote:
>Like 3DS? or RDX? or OBJ.. Sorry, I should have been more specific..
My fault. I should have guessed... (Really. No offense intended)
Just in case you don't know it, there's a 3DS parser floating around on
x2ftp I think.
Bye,
Robert
Any particular reason for a scripting language? Why not do as in Quake 2
and use DLL's to extend your application? I'm presently investigating this,
and it's not bad at all. And it's faster. And, if implemented correctly,
you can use any number of compilers to write the extension.
Ashley W Matheson wrote:
> Any particular reason for a scripting language? Why not do as in Quake 2
> and use DLL's to extend your application? I'm presently investigating this,
> and it's not bad at all. And it's faster. And, if implemented correctly,
> you can use any number of compilers to write the extension.
Well, one advantage would be to allow people without full compiler setups to
develop scripts for the game (aka. players). Also, getting DLLs from different
C++ compilers to link can sometimes be a pain, often requiring a lot of
tinkering with compile switches (try writing an Adobe Photoshop plugin with
Watcom... YUCK!)
Also you don't have to wait for a compiler to recompile after you change the
scripts. Well, you have to wait as the scripts are compiled at run time, but
you don't have to switch between three different programs (editor, compiler, and
game.)
Also, sometimes things can be set up simpler in a script language to make it
easier for non-programmers to use.
Also with a script, it runs in a virtual computer, so you can keep bad scripts
(aka user written (^_^) ) from crashing the system if you build error checking
into your script interpreter.
There are advantages and disadvantages to both DLLs and script solutions.
Did I use the word "also" enough in the above post? (^_^)
Later,
Michael Duffy
mdu...@ionet.net
Look at Verb.
http://www.geocities.com/SiliconValley/Lab/2396/verb_v1.zip
Brennan
--
bre...@rt66.com | Most people grossly overestimate their importance in
Riomhchlaraitheoir| the universe. Take yourself, for example.
| <http://brennan.home.ml.org> -O
--
Your Friend,
David H. (TidalWave) Loeser Jr. mailto:b...@iglou.com
BCS Interactive http://www.bcs-i.com
I personally recommend using Java. If you download the jdk and documentation, you
can read about the JNI (Java-Native Interface), and how to set everything up.
------------------------------------------------------------------
Hungry for NEWSGROUPS??? USE feedME.ORG
Read and Post to 30,000 groups through feedME.ORG
FREE FREE FREE http://www.feedME.ORG FREE FREE FREE
------------------------------------------------------------------
There's a book called "Compiler Design in C" that I'd recommend
instead. Equivalent content but much more readable because it leads you
through how to do things with actual programming examples, rather than
just diving straight into the abstract theory.
--
"To summarize the summary of the summary: people are a problem."
Russell Wallace
mano...@iol.ie
For example, if flag[50] is where the boss is killed. Somewhere in one of
the scripts there will be the code:
if (flag[50]) then begin
show_animation("celebrate.scr");
end;
I recieved messages that this could be done with existing interpreters.
However, since I would like to keep the entire set of tools small enough to
fit on a floppy so I can easily show my friends, I figured it might be
better if I could just learn how their made by looking at code or tuts and
prog it myself.
I never realized how much a response this message would trigger. I
expected only one or two in return. Thanx guyz.
Jason Hoffoss (Tclord) <hof...@volition-inc.com> wrote in article
<34ae2821....@192.48.96.24>...
> On 1 Jan 1998 20:00:05 GMT, "Alexander" <synta...@earthlink.net>
> wrote:
>
> >Is there a free working parser for DJGPP (or better yet, utilizing
allegro)
> >with source code?
>
I've read both books and, for a beginner, the "Compiler Design in C" by
Allen
Holub ISBN 0-13-155045-4 is probably better. As Russel indicates, it's
far less
abstract so if you have an understanding of C it's pretty easy. However,
anyone
interested in compilers _should_ read "Compilers Principles, Techniques,
and Tools"
by Aho, Sethi and Ullman ISBN 0-201-10088-6 at some point. It's dryer,
being more
of a Computer Scientist type of book, but some useful info and concepts
nonetheless.
And it's probably a lot more than you need to just make an interpreter.
Heck, just scare up some info on Yacc and Lex if you just want an
translator.
Dave
Humongous Entertainment