Fun with BASIC :)

Got a brilliant program idea? Let us know!

Moderator: MaxCoderz Staff

CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

I already mentioned this in another context, but I think it can be a good bet for you too: Forth.
ssartell
Regular Member
Posts: 76
Joined: Fri 02 Dec, 2005 5:39 pm

Post by ssartell »

what attributes make it suitable for developing a compiler?
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

Sorry, I misunderstood your post, as if you had been looking for a language to write a compiler for.

So, I'd recommend a functional language, precisely because of the ease of creating data structures even despite strict typing. Haskell is a nice language, but if monads are intimidating, you could also use an 'impure' language like ML. And Prolog is an interesting alternative too. It provides you with efficient backtracking (a must for an optimising compiler!) and absolutely versatile data structures; it's untyped too. Most implementations also support DCG, which makes it easy to write a parser.
ssartell
Regular Member
Posts: 76
Joined: Fri 02 Dec, 2005 5:39 pm

Post by ssartell »

I'll look into those; thanks for the suggestions. You don't think Lisp as a good choice?
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

Might be; I have no experience in it apart from writing a few toy programs. It's definitely a flexible language, and a lot depends on whether you pick a dialect of Scheme or CL. Actually, compiler writing is covered by SICP (which uses Scheme for coding), and it's worth checking out even if you go for a different language.
ssartell
Regular Member
Posts: 76
Joined: Fri 02 Dec, 2005 5:39 pm

Post by ssartell »

Hmm well I do have some experience in Scheme so maybe I'll try that out.
ssartell
Regular Member
Posts: 76
Joined: Fri 02 Dec, 2005 5:39 pm

Post by ssartell »

Well I'm almost done with the parser that builds the abstract syntax tree. Scheme actually has proven to be a very good choice. Building a stand-along command line with parameters is proving to be very easy and the stucture versatility was exactly what I needed. I should almost be read to start translating into z80 asm soon which means I get to build in functionality and what not. Should be interesting.
Post Reply