Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tutorials or introductions to writing a simple scripting language?

I know there are a few questions floating around here on the subject, but it was hard to find anything useful to what I'm after...

I also know it will probably end up being quite the task to complete, but I really want to make a simple scripting language for gaming engines... I want to use it in C++ and my Android Java game engines... but I don't know where to start... I've tried looking for tutorials online, but alot require converting things to byte code, virtual machines and such...

I really just want to create a simple scripting language which can be read from the engine, have some simple "if/else" logic... simple functions that can be called from other scripts and so on... Maybe even simpler for early versions... I really don't know where to start, but I do know this is something I need to start studying and understanding.

If anyone could point me in the right direction and point out some links to very simple "making a simple scripting language for games" kind of tutorial or even point out some key concepts that I should look into... I'd be really thankful.

I'd prefer a minimalist C based scripting language, but I guess the specifics will come into it once I've actually learnt more about it.

Thanks for any help anyone can give.

like image 398
Kalisme Avatar asked Jan 15 '12 05:01

Kalisme


People also ask

What is introduction to scripting?

Covers concepts of scripting languages based on languages such as Python, Perl , JavaScript , VBScript and PowerShell. Students learn how to use scripting languages for rapid prototyping, web programming, data processing and application extension.

What is scripting language in simple words?

A scripting language is a programming language that employs a high-level construct to interpret and execute one command at a time. In general, scripting languages are easier to learn and faster to code in than more structured and compiled languages such as C and C++.

What is an example of a scripting language?

You have probably already heard of PHP, Python, JavaScript and jQuery. These are just a few examples of scripting languages that power the web and plenty of applications you and millions of other Internet users execute every day.


1 Answers

I've tried looking for tutorials online, but alot require converting things to byte code, virtual machines and such

Yes. This is really the approach, even for a dead simple language. Executing the source code directly will be way more complicated, the way this is done is first you parse the source code and digest it into byte code, then have a virtual machine interpret the byte code.

You may want to look at existing languages to learn about their design.

This tutorial from flipcode builds a simple language and includes all the code, so it might be useful.

You can also take a look at the Lua source code.

like image 163
Miguel Avatar answered Oct 25 '22 02:10

Miguel