|How to write a programming language firstname.lastname@example.org (2003-03-14)|
|Re: How to write a programming language email@example.com (Peter Cooper) (2003-03-17)|
|From:||"Peter Cooper" <firstname.lastname@example.org>|
|Date:||17 Mar 2003 00:01:09 -0500|
|Organization:||ntlworld News Service|
|Posted-Date:||17 Mar 2003 00:01:09 EST|
"insaned" <email@example.com> wrote:
> My programming language is going to be like PHP, vars will be
> dynamicly created and should be any type...int, 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.
Return to the
Search the comp.compilers archives again.