Adding Modularity to Triangle Compiler

G

glory.faded

Hi,
I need to add classes to the triangle programming language, i.e. need
an object orieneted version of Triangle compiler. Its pretty
complicated for me, I am actually trying to work on type systems for
object oriented languages, and chose Triangle for it, as I was familiar
with it. But, unfortunately it didn't have notion of classes in it. Can
anybody give me a good reference or a jumpstart.
 
C

Chris Uppal

I need to add classes to the triangle programming language, i.e. need
an object orieneted version of Triangle compiler. Its pretty
complicated for me, I am actually trying to work on type systems for
object oriented languages, and chose Triangle for it, as I was familiar
with it. But, unfortunately it didn't have notion of classes in it. Can
anybody give me a good reference or a jumpstart.

What are you looking for:

1) How to design an OO language ?

2) How to design an OO extension to an existing language ?

3) Implementation techniques for OO languages ?

4) How to design a type system for an OO language ?

5) An OO language that might be better suited for your purposes than Triangle ?

6) Etc ??

The impression I'm getting is that you are not interested in Triangle per se,
and that adding OO to it is just a chore that you have to get out of the way
before you can settle down to the real work. If so then starting with Triangle
seems odd -- if you wanted to learn about jet engine design, you wouldn't start
by bolting wings on your car ;-)

Some suggested answers:

1) Learn an existing language. Smalltalk (best), Ruby (ok), Python (it may
suit your personal taste better than Ruby), CLOS/Lisp (powerful and much you
can learn from), Java (poor), C++ (bad).

2) Look at how OO has been grafted onto existing languages. C converted to C++
(Read Stoustrup's book). Pascal converted to Delphi. Python (early, non-OO)
converted to Python (current, with OO). Lua, non-OO but specifically designed
to allow OO to be layered over it. CLOS added to Lisp (read the "Art of the
Metaobject Protocol" book).

3) See (4).

4) This is a biggie. How you design your type system will determine the
expressiveness of the language, which in turn will constrain the
implementation. See (1) for some examples. There is also a moderately large
and (to me) totally incomprehensible literature on theories of type systems for
OO. The name Cardelli drops up often, and is to be treated with wary respect
(as you might an unexploded tiger).

5) See (1).

-- chris
 
R

Roedy Green

I need to add classes to the triangle programming language, i.e. need
an object orieneted version of Triangle compiler. Its pretty
complicated for me, I am actually trying to work on type systems for
object oriented languages, and chose Triangle for it, as I was familiar
with it. But, unfortunately it didn't have notion of classes in it. Can
anybody give me a good reference or a jumpstart.

See Stroustrup's book the annotated C++ reference which talks about
how he used vtbls to implement classes.
 
G

glory.faded

Thanks, Chris.
I was actually looking for number 2, and you are right about the
impression you got. Since, I already started with the project, now I
will have to stick to Triangle. I am trying to design a statically type
safe OO language based on Triangle. I will have to implement it anyway.
And I will be using translation semantics based on lambda calculus.
Thanks for the info on the books. And ye its large for me too, actually
too large, the theory of type systems. I will probably do studying on
other languages to get a good feeling.

Cheers!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top