Re: "STL from the Ground Up"



On Feb 20, 7:45 am, Walter Bright <wal...@xxxxxxxxxxxxxxxxxxxxxxx>
wrote:
user923005 wrote:
Anyway, I would have thought OCAML would now be written in itself, if it's
that much better than C or C++. Or am I thinking too simplistically?
It depends on the sophistication of the language.  If you have a
formal grammer that is debugged, it won't be hard if you use a parser
generator.  I like the "Gold Parser" but to each his tastes.

The lexer/parser is the easiest part of writing a compiler, by an order
of magnitude or more.

Its an odd transform when programming languages are specified
primarily as text.

The text ,a linear sequence of tokens, is then transformed to some set
of internal structures representing the program.

The internal structures can be seen as a kind of space, which has its
own rules, its own objects and its own dynamic.

Its interesting to try to look at things the other way...

Start with the internal space and then look at a particular source
code representation as one 'view' of the internal representation. You
could then presumably have various views to taste,
but the important part is the internal representation, the internal
space, not the program source text.

It seems to me that the important thing is to get this internal space
nailed as precisely as possible

Looking at things that way leads directly to a desire for reflection,
IOW treating the representation as a collection of permanent objects
which can be queried. Does x exist, Is x a pointer, is x constant, etc

For example a html document is basically AFAICS a tree with each level
representing a contextual scope.

An alternative internal structure is I believe a stack, which
presumably works well for procedural languages.

Dunno if that makes much sense, I've been reading too many books
recently I guess...

regards
Andy Little
.