Related articles |
---|
How to write a programming language insaned@mail.bg (2003-03-14) |
Re: How to write a programming language newsfeed2@boog.co.uk (Peter Cooper) (2003-03-17) |
From: | "Peter Cooper" <newsfeed2@boog.co.uk> |
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" <insaned@mail.bg> 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
> but...how?
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.
http://www.flipcode.com/tutorials/tut_scr01.shtml
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.
Cheers,
Peter Cooper
Return to the
comp.compilers page.
Search the
comp.compilers archives again.