Skip to main content
gamedev.net
🔒 Locked

creating a basic programming language

Started by namingway 8 replies 1.3k views
Original Post
namingway
namingway
Ok I was looking through some articles and I found some on people making their own programming language. They were basic of course but I found it very interesting so I was wondering where a good place to start would be for me to make my own. All I'd like to do at present is have it display text and variables in the console window. Any hints?
Trap
Trap
You need at least 2 parts:
1) syntax for your language and some code that reads it into an internal representation (easiest way to cheat around that one is: use a lisp and use (read) to do the job)
2) code that somehow executes the stuff you have read in

The sicp lectures explain some parts of 2) in the later lectures.
programwizard
programwizard
I'd recommened this article. Basically, you're going to write your own commands in a text file, and then have your interpreter program parse the file and act on the commands it finds. Building a compiled language is a whole other issue, but there are plenty of books on the subject.


EDIT: Beaten to it...
------------------------------Support the Blue Skies in Games Campaign!A blog... of sorts.As a general rule, if you don't have a general rule in your signature, you aren't as awesome as someone who does. General rules roxor teh big one one ones.
rohde
rohde
This is a link to a great free book on programming language concepts and how to build, design and build a language: Programming Langauge Concepts.

It uses SML and Java and you will learn both how to build a functional language (like SML), an imperative language (like C), and even an object oriented language (like a subset of Jaca/C#).

It's a very good book (I followed the course at university held by the author).

Check it out - and good luck.
"We confess our little faults to persuade people that we have no large ones." -Francois de La Rochefoucauld (1613 - 1680). | My blog
namingway
namingway
thanks for that guys I was expecting to have people shut down the idea but yous didnt thank you :D
NotAYakk
NotAYakk
The Dragon Book. (laugh -- first hit on a google search!)

Aka, Compilers: Principles, Tools and Techniques.
ApochPiQ
ApochPiQ
If you're interested in going a bit further with it, check out the book Programming Language Pragmatics. It covers quite a bit more than just the simple features you've mentioned, but it's a great text on programming language theory and how programming languages are implemented. Well worth it if you're interested in languages beyond simple interpreted scripts.
jsgcdude
jsgcdude
Quote:
thanks for that guys I was expecting to have people shut down the idea but yous didnt thank you :D


Heh, a trip of 10,000 miles starts with a single post. Compilers are one of the REALLY interesting problems in computer science that has been worked out for quiet some time. They're a fascinating subject.
------------------
prowst
prowst
Check out the book "Game Scripting Mastery" by Alex Varanese.

-prowst

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.