Learning more about programming scripting languages?

Started by
8 comments, last by Zotoaster 15 years, 5 months ago
Hey all. I've been working my butt off for like 2 years just trying to figure out making scripting languages, and I have made a lot of progress... the problem is that all my learning was done by looking for the odd tutorial here and there, asking some questions around the place, and mostly figuring out things for myself, so as you may have guessed, my own programming language doesn't quite compare to some around. My question is: is there anywhere that I can learn detailed information about making a programming language of my own, in one easy to read source? Perhaps a tutorial or a book or something? (PS, I've already done the Flip Code one). Thanks.
Advertisement
There's always SICP, which we also did a workshop with.
The Dragon book is the classic text on compiler design, and covers virtually everything you'll need to know albeit not always in detail. I'd be surprised if you couldn't find a copy in your local technical library.

Also, I wouldn't go hunting specifically for tutorials on 'scripting languages.' The same techniques apply in either case, a scripting language being little more than a relatively simple type of compiler without much focus on optimization.
The Dragon book can be pretty heavy reading; it goes into all the details of DFA's, NFA's and parsing algorithms. I would check other books first. One thing I found valuable was Jack Crenshaw's 'let's write a compiler' series. You might be beyond that level though.

This is an interesting blog post:

This guy writes a parser and interpreter for a simple language in Python
If SICP is too heavy going for you this is alot easier to digest:


The compiler can be divided conceptually into four parts:

* The reader divides the characters that the user types into meaningful units. For example, it recognizes that let is a single word, but x+1 should be understood as three separate words.
* The parser recognizes the form of each of the ten BASIC commands that this dialect understands. For example, if a command starts with if, the parser expects an expression followed by the word then and another command.
* The code generator constructs the actual translation of each BASIC command into one or more Logo instructions.
* The runtime library contains procedures that are used while the translated program is running, rather than during the compilation process. The nextline procedure discussed earlier is an example.

Real compilers have the same structure, except of course that the code generator produces machine language instructions rather than Logo instructions. Also, a professional compiler will include an optimizer that looks for ways to make the compiled program as efficient as possible.

If you want everything in book form this one is quite useful:
Game Scripting Mastery
[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
There's a book called

Writing Compilers and Interpreters by Ronald Mak, which deals with this exact issue ( ie building scripting languages in c++ ).

Good Luck!

-ddn

[Edited by - ddn3 on October 27, 2008 3:08:50 PM]
I found these articles pretty informative:

Peroxide Tutorials
-----------------------------------Indium Studios, Inc.
I have penned an article about operational semantics, to provide a formal description of a language before implementing it. I find that such descriptions make the subsequent implementation easier, because you know where you're going.

The second part of the article will hopefully be online tommorrow.
There's a book on building your own scripting language for game programming called "Game Scripting Mastery"
(http://www.amazon.com/Scripting-Mastery-Premier-Press-Development/dp/1931841578/ref=sr_1_1?ie=UTF8&s=books&qid=1225134448&sr=8-1).

Not a bad book, really focused on the subject of building a virtual machine and scripting language to run on it.

Cheers,

Bob

[size="3"]Halfway down the trail to Hell...
You guys rule! Thanks for all the awesome links. I will have to choose very carefully what I go with - though I hear Game Scripting Mastery is very highly recommended, heheh.

Three cheers to GD

This topic is closed to new replies.

Advertisement