Prev: USB drives, caching and sync
Next: Which CPU to choose?
From: Philipp Klaus Krause on 11 Jan 2010 09:21 I asked this question here about one and a half years ago. I'm posting again since I'm curious about the current situation. I want to look at alternatives to C for Z80 programming using languages that compile to C. There are the following requirements: - Compiles to C - Free compiler - Low memory usage (I have only 1KB of RAM, 32KB of ROM) Has anyone come across such a language? The last requirement seems to be a rather hard one. Many languages that compile to C include relatively large overhead or do dynamic allocation of memory, etc. So far bitc (http://bitc-lang.org/) seems to be the closest match, but it's abandoned. Philipp
From: David Brown on 11 Jan 2010 09:30 Philipp Klaus Krause wrote: > I asked this question here about one and a half years ago. I'm posting > again since I'm curious about the current situation. > > I want to look at alternatives to C for Z80 programming using languages > that compile to C. There are the following requirements: > > - Compiles to C > - Free compiler > - Low memory usage (I have only 1KB of RAM, 32KB of ROM) > > Has anyone come across such a language? > > The last requirement seems to be a rather hard one. Many languages that > compile to C include relatively large overhead or do dynamic allocation > of memory, etc. So far bitc (http://bitc-lang.org/) seems to be the > closest match, but it's abandoned. > > Philipp As you say, the last one is going to be the big problem. There are a number of languages that "compile" to C but it is typically done for smaller (in terms of users and developers) languages, which are mostly much higher level. For example, Mercury <http://www.mercury.csse.unimelb.edu.au/> is a functional programming language which generates C code for execution, rather than having its own compiler. But it is not going to generate small C suitable for an 8-bit microcontroller. The same thing applies to, for example, the various Python-subset to C compilers around. Generally speaking, the alternatives to C on devices of this size are C++, assembly, Pascal (there are free Pascal to C compilers available which might suit you), Ada, and Forth. For some microcontrollers there are also Basics of varying quality.
From: don on 11 Jan 2010 11:39 Philipp Klaus Krause wrote: > I asked this question here about one and a half years ago. I'm posting > again since I'm curious about the current situation. > > I want to look at alternatives to C for Z80 programming using languages > that compile to C. There are the following requirements: > > - Compiles to C > - Free compiler > - Low memory usage (I have only 1KB of RAM, 32KB of ROM) > > Has anyone come across such a language? > > The last requirement seems to be a rather hard one. Many languages that > compile to C include relatively large overhead or do dynamic allocation > of memory, etc. So far bitc (http://bitc-lang.org/) seems to be the > closest match, but it's abandoned. > > Philipp Any compiler that compiled to C was created to help people convert to C so they can get a modern supported language. That transition was do in the 1980s. I doubt that anyone would be doing this conversion as an active project, why would they. As you have noticed, not much out there. And, why would you want to write in any dead language, then convert it to C ? Very strange. don
From: Tim Wescott on 11 Jan 2010 11:50 On Mon, 11 Jan 2010 15:21:02 +0100, Philipp Klaus Krause wrote: > I asked this question here about one and a half years ago. I'm posting > again since I'm curious about the current situation. > > I want to look at alternatives to C for Z80 programming using languages > that compile to C. There are the following requirements: > > - Compiles to C > - Free compiler > - Low memory usage (I have only 1KB of RAM, 32KB of ROM) > > Has anyone come across such a language? > > The last requirement seems to be a rather hard one. Many languages that > compile to C include relatively large overhead or do dynamic allocation > of memory, etc. So far bitc (http://bitc-lang.org/) seems to be the > closest match, but it's abandoned. > > Philipp At the risk of starting a flame war -- what's the matter with C? Granted, it and younger brother C++ have numerous drawbacks, but it's like Democracy -- a terrible system, but the best we have none the less. -- www.wescottdesign.com
From: Doug McIntyre on 11 Jan 2010 12:33
don <don> writes: >Any compiler that compiled to C was created to help people convert to C >so they can get a modern supported language. >That transition was do in the 1980s. >I doubt that anyone would be doing this conversion as an active project, >why would they. Thats not true, C makes a good generic low-level portable universal target to compile to, much like ANTLR or LLVM or any of the other independant platform target platforms. There have been many historical comments that C is mainly a higher level version of assembly on the original platforms it was developed on (especially ancient historical versions). You'd probably easily find a few dozen modern languages that compile to C as output. >As you have noticed, not much out there. There are many out there that compile to C. The main issue is none of them are exactly lightweight memory users, suitable for embedded systems programming which is what he is looking for. >And, why would you want to write in any dead language, then convert it >to C ? Most likely because he has a C compiler for his target platform, and the likelyhood of finding a higher level language that compiles to C is much greater than finding a higher level language that he likes that compiles down to Z80 assembly. |