Re: How to write a programming language

"Peter Cooper" <>
17 Mar 2003 00:01:09 -0500

          From comp.compilers

Related articles
How to write a programming language (2003-03-14)
Re: How to write a programming language (Peter Cooper) (2003-03-17)
| List of all articles for this month |

From: "Peter Cooper" <>
Newsgroups: comp.compilers
Date: 17 Mar 2003 00:01:09 -0500
Organization: ntlworld News Service
References: 03-03-060
Keywords: design, interpreter
Posted-Date: 17 Mar 2003 00:01:09 EST

"insaned" <> wrote:
> My programming language is going to be like PHP, vars will be
> dynamicly created and should be any, string, object...

You may be more familiar with PHP, but Perl is the grand-daddy of
these concepts, so you might want to do a little study into it. These
'multi type' variables are generally known as scalars.

> i can't figure where to store variables and their names, in arrays

Depending on how your language is going to work (is it to be compiled
to bytecode? scripted? etc..), there are numerous methods. If it's a
basic interpreted language, you could use a basic real-time hash
structure. Anything beyond that, however, and you really need to
implement a proper symbol table.

I get the feeling, however, that you're only just starting out, and so
you might find the following tutorial on creating your own scripting
language to be very useful. It covers lexers, parsers, syntax trees,
and numerous other concepts you need to grasp.

And if you can afford it, buy 'Virtual Machine Design and Implementation in
C/C++' by Bill Blunden. It's about $50, but for that you get 700 pages of
gold, covering tons of concepts in an easy-to-read manner (with examples)
which will get you up to speed.

Peter Cooper

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.