From: Steve Judd (sjudd_at_ffd2.com)
Date: 2004-10-21 19:40:04
Howdy all,
I have written a C64 language and compiler, Slang. Robin and MV have been
helping me for the past year; it's now mature enough that it could use a
few more testers.
You'll need a SuperCPU + SuperRAM to run it. My focus is on meeting needs
for actual C64 programs (and what I'd like to avoid is discussions about
exotic abstract features). Therefore, what I need is some actual C64
programs to be written with it. If you're interested, just send me an
email! And just to be clear -- it is beta, and it is a very large
program, so there are bound to be bugs, problems, etc.
Thanks! Some tidbits are below.
-Steve
Slang is designed for writing Commodore 64 programs, which means that it
has features useful for accomplishing C64 tasks, and also that it writes
code like a C64 programmer would. Some features the cbm-hackers might
find interesting include:
- Subroutine variables are passed directly instead of on the stack,
arrays are implemented using tables, etc. Like a C64
coder would write.
- Outputs regular 6502 code (although it can also write 65816)
- Assembly is a part of the language -- it's built on top of
the Sirius assembler -- and can be mixed and matched at will.
It is also easy to interface naturally with existing assembly
routines. The Sirius linker is also integrated into the
language, for more sophisticated code development.
- The addresses of variables may be specified, e.g.
ubyte border@$d020
border = 1 ;assembles to lda #1 sta $d020
- Slang is actually much more than a language: it is a tool for
creating languages. It is possible to modify the existing
language or create entirely new languages. Most people will
never use this feature (well, heck, most people won't use
any part of Slang at all), but it's interesting.
The bulk of Slang is a collection of core routines needed by a
compiler -- expression evaluation, parsing, etc. Individual
commands and keywords in a language call these commands
to parse and output code. By keeping these language functions
and keywords separate from the core compiler, it is possible to
add new or different commands. To be specific, the core Slang
code occupies $1000-$8A00, the language portion is stored at $A000.
In slang, you can actually program a language: an input file is
written which contains, for example, a keyword, and what code to
execute when that keyword is encountered. Slang can then compile
this code into a language compiler at $a000, that tells Slang how
to compile programs written in that language.
What makes it more wild is that you can use these new commands
in the definition of a new language to replace the existing
language at $a000, which you can then use in a new language to
replace the new language at $a000, and quickly bootstrap yourself
into oblivion.
And if you think this explanation is confusing, image how hard
it was to write the code. (Write some code that takes a language
input file and uses the assembler core to write code that will take
an input file and use the assembler core to write code!)
Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.