scripting language

M

Michael Andersson

Hi!
I'm writing a small game engine in c# and I'm in great
need of a scripting language. Does anyone know of such a
language?

Would it be possible to use the VSA in some way to do this?

Best regards,
/Michael
 
M

Michael Andersson

Hi Ron,
If it's possible to C# thats OK... all I need is a
scripting language so that I can write particle system
effects etc. without having to use subclassing. Runtime
recomping i just fine.

Do you know of any good documentation on how to use the
System.CodeDom.Compiler?

Best regards,
/Michael
 
D

Dmand

This is something I've recently engaged upon myself, and let me tell you,
it's no small effort. I'm probably about a third of the way there (I'm
currently building a parse tree). Mind you I haven't looked at the
System.CodeDom.Compiler namespace though I now intend to - it's the first
I've heard about it.

Here is a good tutorial on one way to go about it,

http://www.flipcode.com/tutorials/tut_scr01.shtml

That uses the old Lex/Yacc tools, or at least their win32 counterparts and
implements it in C/C++. Those tools still only get you about half way and
learning to use them again requires a bit of effort. Personally I've read up
on compiler theory and design and am coding everything from the start
myself. So far so good I just need to dedicate more hours (days/weeks) to
the job.

BTW, the basic constituents of any scripting engine are the

Lexer -> Abstract Syntax Tree/Parse Tree -> Byte Code Generator -> Virtual
Machine

The Tree can be optional but it avails you a nice structure for analysing
the code (debugging etc) and probably simplifies the process of getting from
token stream to byte code.

As for C# generating compiler tools there is
http://www.scifac.ru.ac.za/coco/. All the tools require you to learn a bit
about compiler theory (grammars and BNF notation etc) so you can specify
your language and also of course there own usage and in the end they only
get part of the job done, hence of chosen to avoid them.

That said if I can get System.CodeDom.Compiler to do it for me I will be
taking a new route.
 
D

Dmand

Thanks Ron, I've briefly looked into the features that the framework has to
assist in this kind of thing and now expect that I will be using them
instead of my own code. I too am building a scripting engine and C# or VB
will be quite sufficient as a language to implement it. Great tip I should
have posted here first!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top