Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


Books and URLs for Scripting Languages, or creations thereof


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
17 replies to this topic

#1 DakeDesu   Members   -  Reputation: 100

Like
Likes
Like

Posted 08 April 2003 - 10:42 AM

Well, after the list of articles on this site, I have decided to do some further research Googling ''Compiler Design'' brings back about 9.2e5 results (most of them plugs for books), so suggested URLs are a nice thing (I will be making my way through this, just wish I had some website pointers). So what are some suggestions on books and websites for learning how to make a scripting language? Wizards Rule #2: The action with the greatest intent, can have the most serious consequences "You need to know your friends / you need to know / I''ll be waving my hand / watching you drown / watching you scream / quiet or loud / and maybe you just need / a friend as clumbsy as you''ve been / there is no one laughing" Our Lady Peace :: Clumsy "All warefare is based on deception" Sun Tzu :: Estimates | Calculations | Planning :: Verse 17. "We will not rest until terror is gone" President Bush, saving the world from the Terrorist Boogieman.

Sponsor:

#2 Tylon   Members   -  Reputation: 181

Like
Likes
Like

Posted 08 April 2003 - 11:20 AM

The industry standard is known as the ''Dragon book'' by Aho etc al. Its actual title is ''Compilers: Principles, Techniques, and Tools''
http://www.amazon.com/exec/obidos/ASIN/0201100886/qid=1049840066/sr=2-1/ref=sr_2_1/102-6781748-9940121

It is very expensive, so I recomend getting it from a university library.

It''s over 10 years old, but it is still the best. I''m sure I wont be the last person recommending this book to you.

#3 AlexV   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 April 2003 - 05:11 PM

The Dragon Book is still good, but it''s not what I''d call the "best" anymore. It''s definately showing it''s age. I still recommend picking it up, but a far better book is the recent "Modern Compiler Design":

http://www.amazon.com/exec/obidos/tg/detail/-/0471976970/qid=1049947481/sr=8-1/ref=sr_8_1/102-0890133-6456946?v=glance&s=books&n=507846

Also, I wrote this one book called Game Scripting something or other:

http://www.amazon.com/exec/obidos/ASIN/1931841578/qid%3D1049947504/sr%3D11-1/ref%3Dsr%5F11%5F1/102-0890133-6456946

You might learn a thing or two. But if you don''t, it''s really big so it''s great for incapacitating home intruders or evening out wobbly tables.

#4 DakeDesu   Members   -  Reputation: 100

Like
Likes
Like

Posted 10 April 2003 - 07:03 AM

Thanks, I will see about obtianing those books.

#5 quorn3000   Members   -  Reputation: 819

Like
Likes
Like

Posted 10 April 2003 - 08:49 AM

scripting languages?

python, ruby, lua



Or maybe boost.spirit
quote:
Spirit is an object oriented recursive descent parser generator framework implemented using template meta-programming techniques. Expression templates allow us to approximate the syntax of Extended Backus Normal Form (EBNF) completely in C++. Parser objects are composed through operator overloading and the result is a backtracking LL(inf) parser that is capable of parsing rather ambiguous grammars.

The Spirit framework enables a target grammar to be written exclusively in C++. Inline EBNF grammar specifications can mix freely with other C++ code and, thanks to the generative power of C++ templates, are immediately executable. In retrospect, conventional compiler-compilers or parser-generators have to perform an additional translation step from the source EBNF code to C or C++ code.


[edited by - petewood on April 10, 2003 3:52:23 PM]

#6 JTAnderson   Members   -  Reputation: 196

Like
Likes
Like

Posted 10 April 2003 - 12:05 PM

How about SMALL? I know for a fact a few commercial games have shipped using this scripting language and is pretty solid. The memory management I found better than all the alternatives given above.

http://www.compuphase.com/small.htm

Check it out.

-JT

#7 DakeDesu   Members   -  Reputation: 100

Like
Likes
Like

Posted 10 April 2003 - 01:08 PM

I am not so much doing this to build a game with it--and I can think of a couple of my current projects where using a embeded scripting language in the game, would be complete overkill. I am doing this as more of a learning experience. I could probably design one with the amount of C/C++ knowledge I have--but it just would not be as effective as if I were to have some direction. The goal here is to learn atleast the fundamentals of a language, so that I may, some time in the future, make a meaning contribution to the above mentioned languages.

If anything, this mini project''s only goals are tobecome Turing Complete (or whatever the proper term for that is).

It also has loose connections to a certain inside joke in the... I have already said too much.

Thanks again

Wizards Rule #2: The action with the greatest intent, can have the most serious consequences
"You need to know your friends / you need to know / I''ll be waving my hand / watching you drown / watching you scream / quiet or loud / and maybe you just need / a friend as clumbsy as you''ve been / there is no one laughing" Our Lady Peace :: Clumsy
"All warefare is based on deception" Sun Tzu :: Estimates | Calculations | Planning :: Verse 17.
"We will not rest until terror is gone" President Bush, saving the world from the Terrorist Boogieman.

#8 SabreMan   Members   -  Reputation: 504

Like
Likes
Like

Posted 10 April 2003 - 10:21 PM

quote:
Original post by DakeDesu
If anything, this mini project's only goals are tobecome Turing Complete (or whatever the proper term for that is).

For that, you only need loop (or recursion), branch and memory allocation. Turing completeness is something of a red herring, as it doesn't tell you anything about the usefulness of a language. For example, the C language minus the libraries is merely a Finite State Automata. Another example: Unlambda is Turing complete, but is useless for practical purposes.

If you're just looking to implement some sort of interpreter, you might consider a simplified dialect of Lisp, which is quite straightforward since it has such a simple and consistent syntax. In many other programming languages, the complexity of the interpreter is focused around applying arbitrary grammatical rules to transform conforming syntax into an AST.

For example, given a C++ style infix expression looking like this:

x + y * z;

The parser needs to generate an AST that looks something like:

+
/ x *
/ y z

If you then perform a preorder traversal of this AST, printing each node and using parentheses to delimit functions, then you get this:

(+ x (* y z))

Which is a Lisp expression! So, the parsing process for the infix grammar is simply a transformation from an arbitrary syntax to something that can be directly represented using Lisp s-expressions.

Edit: editing has resulted in my AST being munged. Oh well...


[edited by - SabreMan on April 11, 2003 12:49:24 PM]

#9 rohde   Members   -  Reputation: 432

Like
Likes
Like

Posted 10 April 2003 - 10:38 PM

quote:
Original post by AlexV
Also, I wrote this one book called Game Scripting something or other:

http://www.amazon.com/exec/obidos/ASIN/1931841578/qid%3D1049947504/sr%3D11-1/ref%3Dsr%5F11%5F1/102-0890133-6456946



I have some questions about this book and since the author is in the house this is a magnificent opportunity

1. Your book is called "game" scripting - but can it be used as a general intro to compilers/intepreters as well (i.e. I''m not as interested in the game approach as a more general one).

2. What language do you use in implementation? C++?



-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction.

#10 DakeDesu   Members   -  Reputation: 100

Like
Likes
Like

Posted 11 April 2003 - 04:08 AM

quote:
Original post by DakeDesu
If anything, this mini project''s only goals are tobecome Turing Complete (or whatever the proper term for that is).

quote:
Original post by SabreMan
For that, you only need loop (or recursion), branch and memory allocation. Turing completeness is something of a red herring, as it doesn''t tell you anything about the usefulness of a language.


Hmm, that explains Intercal''s humour even more....

quote:
If you''re just looking to implement some sort of interpreter, you might consider a simplified dialect of Lisp, which is quite straightforward since it has such a simple and consistent syntax.


Now that I think about it, the langauge would probably be better suited as a dialect of Forth.

quote:
In many other programming languages, the complexity of the interpreter is focused around turning arbitrary grammatical rules into an AST.

[really nice explanation of AST]


I am sorry to have you have to write out that really decent explanation out--I am sure that you must not like writting that over and over in the forums, I know it would drive me nuts.

Thank you. I will keep this in mind.

#11 SabreMan   Members   -  Reputation: 504

Like
Likes
Like

Posted 11 April 2003 - 05:13 AM

quote:
Original post by DakeDesu
I am sorry to have you have to write out that really decent explanation out--I am sure that you must not like writting that over and over in the forums

I have no problems whatsoever with committing gratuitous acts of Lisp advocacy.

#12 DakeDesu   Members   -  Reputation: 100

Like
Likes
Like

Posted 11 April 2003 - 05:36 AM

The process you descibed is not only typcial of Lisp. There are several languages, mostly from the period of Lisp, that have their langauge described in a similar fashion.

Forth does it similar:

4 + 5 * 7 would become 5 7 * 4 +, and the only difference is the function or operator is at the end, and there are no brackets. Though Lisp has been defined for use in an interactive Shell (afaik), which Forth was defined to be an effecient language--though I do not really know Forth as much as I should.

(Time to add researching Forth better to my list)

#13 SabreMan   Members   -  Reputation: 504

Like
Likes
Like

Posted 11 April 2003 - 05:45 AM

quote:
Original post by DakeDesu
The process you descibed is not only typcial of Lisp.

What I described is typical of languages that layer arbitrary syntax rules over their internal representation.

#14 DakeDesu   Members   -  Reputation: 100

Like
Likes
Like

Posted 11 April 2003 - 06:10 AM

quote:
Original post by DakeDesu
The process you descibed is not only typcial of Lisp.

quote:
Original post by SabreMan
What I described is typical of languages that layer arbitrary syntax rules over their internal representation.


Exactly--something that I am sure you get people going ''1 r teh l33tzors--cow cn i r make l33t perl halflife in five minues,'' more than enough times than giving the answer warrents. Just note that answering my question will make it worse (has to do with the language---er.. said too much).

Thanks for point out the terms used for this idea--helps me with the language quite a bit more

#15 AlexV   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 April 2003 - 07:43 AM

quote:
Original post by rohde
I have some questions about this book and since the author is in the house this is a magnificent opportunity

1. Your book is called "game" scripting - but can it be used as a general intro to compilers/intepreters as well (i.e. I''m not as interested in the game approach as a more general one).

2. What language do you use in implementation? C++?



1. Absolutely-- the general theme of the book is how this technology applies to game development, but scripting is scripting and compilers are compilers. You can take what you learn here and write a scripting system for a word processor just as easily, and the [large] chapters on developing assemblers, compilers and virtual machines are first and foremost about the general theory itself. I then bring it "back down" to game development later in the book.

2. C for the most part. There are occasional cues to C++ programmers on where to do their own thing, but it''s generally a good idea to stick to C in books, since class heirarchies tend to get a little unweildly for people who just want to learn how something works. Of course any large scale project should be at least somewhat object oriented, but in the case of books it''s usually just easier to see straight functions and structures to get the job done. Anyone proficient in C++ already will have no trouble OOPifying it themselves.

#16 rohde   Members   -  Reputation: 432

Like
Likes
Like

Posted 11 April 2003 - 09:18 AM

quote:
Original post by AlexV
1. Absolutely-- the general theme of the book is how this technology applies to game development, but scripting is scripting and compilers are compilers. You can take what you learn here and write a scripting system for a word processor just as easily, and the [large] chapters on developing assemblers, compilers and virtual machines are first and foremost about the general theory itself. I then bring it "back down" to game development later in the book.



Just what I wanted to hear Think I'll purchase it (heading over to Amazon)...

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction.

[edited by - rohde on April 11, 2003 4:19:55 PM]

#17 NotAnAnonymousPoster   Members   -  Reputation: 286

Like
Likes
Like

Posted 11 April 2003 - 09:56 AM

quote:
Original post by SabreMan
What I described is typical of languages that layer arbitrary syntax rules over their internal representation.

I read some comment on comp.object which said that McCarthy was going to make Lisp's syntax more complex if he had time. I don't know if that meant providing a means to use infix notation. Whatever the case, the group was commenting that the merits of Lisp's simple syntax weren't necessary realised by McCarthy at the time.

[edited by - NotAnAnonymousPoster on April 11, 2003 4:57:53 PM]

#18 SabreMan   Members   -  Reputation: 504

Like
Likes
Like

Posted 14 April 2003 - 12:32 AM

quote:
Original post by NotAnAnonymousPoster
I read some comment on comp.object which said that McCarthy was going to make Lisp''s syntax more complex if he had time.

AFAIK, he was intending to layer m-expressions over s-expressions. If you''re talking about the thread I''m thinking of, certain people were using that as leverage for attacking s-expression syntax, which is a rather silly approach. McCarthy''s intentions 40+ years ago have little to do with the value of s-expressions now.
quote:

I don''t know if that meant providing a means to use infix notation.

Lisp has a means to use infix notation: reader macros.
quote:

Whatever the case, the group was commenting that the merits of Lisp''s simple syntax weren''t necessary realised by McCarthy at the time.

It strikes me as being a typical Lisp syntax argument.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS