Sign in

username:

password:



Not a member?

Search Comp.Arch.Embedded



Search tips

embedded by Keywords

68HC11 | 68HC12 | 8051 | 8052 | ARM | ARM7 | Asic | AT91 | AT91RM9200 | Atmel | AVR | AVRStudio | Bootloader | CFP | CompactFlash | Cygnal | Cypress | Dataflash | DSP | eCos | EEPROM | Embedded Linux | Emulator | Endian | Ethernet | Firewire | FPGA | Freescale | GCC | GNUARM | GSM | H8 | HDLC | I2C | Infineon | Interrupts | Java | JTAG | LCD | LED | LPC2000 | MCU | Microchip | MMC | MPLAB | MSP430 | PC104 | PCB | PCI | PCMCIA | PowerPC | Rabbit | RS232 | RS485 | RTOS | SBC | SDRAM | Sensor | SPI | STK500 | UART | UML | USART | USB | Verilog | VHDL | VxWorks | Xilinx

Ads

Discussion Groups

Discussion Groups | Comp.Arch.Embedded | Programming languages than can be compiled to C

There are 24 messages in this thread.

You are currently looking at messages 10 to 20.

Re: Programming languages than can be compiled to C - Mark McDougall - 02:20 14-07-08

Mark McDougall wrote:

> talking about a total ROM+ROM of 1KB. Hence my last (as yet unanswered) 

that should be ROM+RAM...

-- 
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>;
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266



Re: Programming languages than can be compiled to C - Philipp Klaus Krause - 04:05 14-07-08

Mark McDougall schrieb:
> Philipp Klaus Krause wrote:
> 
>> - Low memory usage (I have only 1KB of RAM)
> 
> With 1KB of RAM, I can't see how you'd be doing anything at all useful
> in any language other than Z80 assembler. Wanting a pre-compiler to
> produce C then compile and link the C source output in 1KB - not a chance.
> 
> Or are you talking about rommable software with 1KB RAM?
> 
> Regards,
> 

I have 32KB of ROM (and there's an 8KB BIOS, which I don't use except
for it's font).

Philipp

Re: Programming languages than can be compiled to C - Philipp Klaus Krause - 04:06 14-07-08

Jim Granville schrieb:
> Philipp Klaus Krause wrote:
>> I want to look at alternatives to C for Z80 programming.
>> Since there's probably nothing that directly compiles to Z80 asm I want
>> to look at languages that compile to C. There are the fopllowing
>> requirements:
>>
>> - Compiles to C
>> - Free compiler
>> - Low memory usage (I have only 1KB of RAM)
> 
> Which Z80 only has 1K ram ?
> 

ColecoVision.

Philipp

Re: Programming languages than can be compiled to C - Philipp Klaus Krause - 04:25 14-07-08

Many posts asked _why_ I want such a language that compiles to C.

- I've been programming for this system in C + asm for a while and want
to try something new. I don't want Pascal or BASIC (I've seen a bit os
Pascal a long time ago in school and I don't remember any advantages
over C, I never want to go back to BASIC). I'm looking for a language
that offers some new constructs over C. Object-orientation or a
functional language might be interesting. Most languages that can be
compiled directly to Z80 asm are quite old and not that interesting
(Pascal, BASIC).

- I'm the maintainer of the Z80 port of sdcc, a free C compiler; I want
to see how good sdcc is at compiling the output of another compiler. In
the past compiling output from nesC helped find some obscure bugs.

Philipp

Re: Programming languages than can be compiled to C - David Brown - 04:34 14-07-08

Philipp Klaus Krause wrote:
> I want to look at alternatives to C for Z80 programming.
> Since there's probably nothing that directly compiles to Z80 asm I want
> to look at languages that compile to C. There are the fopllowing
> requirements:
> 
> - Compiles to C
> - Free compiler
> - Low memory usage (I have only 1KB of RAM)
> 
> 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 badly documented and a pain to build. It seems
> the authors just see it as a tool for development of Coyotos, their
> embedded OS, not as a generic programming language someone else might
> want to use.
> 
> Philipp

Your question doesn't make sense unless you tell us more about your 
requirements for the programming language.  Are you saying that you have 
a C compiler for the Z80, but don't like C, and you are happy with any 
other language than C?

Some examples are:

cfront (translates C++ to C)
PtoC (translates Pascal to C)
mercury (a logical/functional programming language with a C back-end)

Re: Programming languages than can be compiled to C - Philipp Klaus Krause - 04:37 14-07-08

donald schrieb:
> If you understand C programming, why not modify the C output from bitc
> or any other compiler.
> 
> If don't understand C programming, learn.
> 
> donald

With bitc the problem is not modifying the output to work on my system,
it's more the rest of bitc:

-It's  a functional language, thus different to what I'm used to. This
is not a problem in itself, I've wanted to learn a functional language
for some time, but it's probably difficult to start with bitc: No
tutorials, just a little bit of sample code and an outdated
specification, no other documentation.

-Bitc is a pain to build. I did it twice. I took days, since after each
step I had to ask questions on the mailing list about the next problem
that came up.

Philipp

Re: Programming languages than can be compiled to C - Mark McDougall - 04:38 14-07-08

Philipp Klaus Krause wrote:

> ColecoVision.

Now you've got me interested... ;)

Regards,

-- 
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>;
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266

Re: Programming languages than can be compiled to C - Philipp Klaus Krause - 04:52 14-07-08

David Brown schrieb:
> 
> Your question doesn't make sense unless you tell us more about your
> requirements for the programming language.  Are you saying that you have
> a C compiler for the Z80, but don't like C, and you are happy with any
> other language than C?
> 
> Some examples are:
> 
> cfront (translates C++ to C)
> PtoC (translates Pascal to C)
> mercury (a logical/functional programming language with a C back-end)

I like C, but want to try another language.
- AFAIR remember from school Pascal is C-like and doesn't offer any
advantages over C.
- cfront is acient. Will it compile on modern systems?
- mercury looks nice, I already found it some time ago, but back then it
would need more than 1KB of RAM.

Philipp

Re: Programming languages than can be compiled to C - Philipp Klaus Krause - 05:07 14-07-08

Mark McDougall schrieb:
> Philipp Klaus Krause wrote:
> 
>> ColecoVision.
> 
> Now you've got me interested... ;)
> 
> Regards,
> 

I started programming ColecoVision games as a hobby some years ago. Back
then everyone used either asm or C with HITECH-C 3.09 in a CP/M emulator.
I wrote a library and tools
(http://www.colecovision.eu/ColecoVision/development/) for use with
sdcc, so I could use a more modern C compiler. I started improving sdcc
and became it's Z80 port maintainer.
Sometimes when programming I found that object-orientation would be a
natural way to express concepts, and wished I could use C++. And I want
 to try a language different from C, maybe something functional. And I'd
like so see how sdcc handles C code generated by another compiler (some
more oscure sdcc bugs have been found by compiling the poutput of nesC).

Philipp

Re: Programming languages than can be compiled to C - David Brown - 06:47 14-07-08

Philipp Klaus Krause wrote:
> David Brown schrieb:
>> Your question doesn't make sense unless you tell us more about your
>> requirements for the programming language.  Are you saying that you have
>> a C compiler for the Z80, but don't like C, and you are happy with any
>> other language than C?
>>
>> Some examples are:
>>
>> cfront (translates C++ to C)
>> PtoC (translates Pascal to C)
>> mercury (a logical/functional programming language with a C back-end)
> 
> I like C, but want to try another language.

Fair enough - curiosity and interest are good reasons, at least if you 
don't have deadlines!

> - AFAIR remember from school Pascal is C-like and doesn't offer any
> advantages over C.

Pascal has some advantages, but they are more along the lines of things 
it does *not* support or allow.  You have to use modules properly in 
Pascal, and can't make spaghetti with headers and macro definitions that 
change according to where the header is used.  You can't randomly mix 
integers and enumerated types.  You can't use functions or data without 
declarations.  You can't mix up "=" and "==", or omit "break" statements 
in switches, or many of the other syntactically legal and semantically 
nonsense constructs that are allowed in C.  There are a few other 
features such as nested functions that don't exist in C (although gcc 
allows nested functions as an extension), and simple set types.

However, if you are already competent at C programming (and I'm guessing 
that you are, as the maintainer of an sdcc port!), and already write 
well-structured and modular code, then their is little to gain.

> - cfront is acient. Will it compile on modern systems?

I don't know about cfront (or if C++ appeals at all) - it's just an idea.

> - mercury looks nice, I already found it some time ago, but back then it
> would need more than 1KB of RAM.

I expect mercury would quickly eat up your ram, and also produce code 
otherwise unsuitable for small systems (it probably expects 32-bit ints, 
for example).  It's also a functional programming language, which you 
say you are not looking for at the moment.  Again, it's just a random idea.


Have you looked much at the llvm project?  I believe llvm can generate C 
code at the back end, which you could compile using sdcc.  With a bit of 
glue, that would give you C, C++, Objective C, Ada and Fortran.

previous | 1 | 2 | 3 | next