Fun with BASIC :)
Moderator: MaxCoderz Staff
-
- MCF Legend
- Posts: 1601
- Joined: Mon 20 Dec, 2004 8:45 am
- Location: Budapest, Absurdistan
- Contact:
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.
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.
-
- MCF Legend
- Posts: 1601
- Joined: Mon 20 Dec, 2004 8:45 am
- Location: Budapest, Absurdistan
- Contact:
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.
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.