[Update 2] Switch Compiler - Milestone 1
Posted: Sun Mar 19, 2006 11:26 pm
[Update]
I've updated the compiler a little bit. Now exponentials (i.e. 2^10) are fully supported! That's right you can use variables as operands (that feature was missing before). Exponential code is fairly fast (faster than PBs Pow() function in my tests) but if 0 or 1 is used as the second operand (b out of a^b) then the code gets reduced to one or two instructions!
More useful updates (IFs, loops and actual commands) will be added as and when I have time - which is a bit scarce at the moment! Note: this is the only link in this post that points to the newsest version!
DOWNLOAD
[Old news]
Ever since I hung up development on my scripting language I've been planning, and working on, a fully fleged compiler. This release is the first fruits of my labour, and I thought I'd share it with you all.
At the moment the compiler can only handle numeric expressions (floats and intergets, as well as variables). Comments (lines starting with ' or as a comment after a line .ie. "1+1 'Comment") are also supported. There's two .exe's in the zip and a text file. Write your 'code' in Code.txt then run Compiler.exe - it's that easy. A file called ASM.txt will be created in that directory containing the outputted ASM.
My overall goal is to create a working modular compiler which is losely based around BASIC rules. I've decided on having quite a long pipeline (each element of which can be swapped with another user creation, so the language is very user modifiable) but I will, eventually, add some switches to the compiler which means you can skip unessacary stages.
For example:
In the .exe you have 'Compiler.exe' and 'Optimizer.exe'. The code produced by 'Compiler.exe' is fuly working but 'Optimizer.exe' speeds it up by a fair amount. So, you could skip the second stage in order to speed up compile time but reduce the eventual .exe's speed (and increase it's size).
I imagine the final pipeline will be something like this (with skippable bits between *s):
*Front end* > *Preprocessor* > Compiler > *Optimizer* > FASM
Anyway, I hope you enjoy! Suggestions, comments and quieres are, as always, welcome! Big thanks to Fred and all the other guys on here who've helped me along the way! Xombie also deserves a special mention for inspiring to speed up most of my code (and making it work properly
)
.
DOWNLOAD (Latest version - see below)
As a closing note: I haven't included the source with this release. Why? Well to be honest there's not much actual content - most of the code revolves around my RPN/PostfixToASM procedures which are already floating about on the forums. If you'd like to see the source I can upload it!
I've updated the compiler a little bit. Now exponentials (i.e. 2^10) are fully supported! That's right you can use variables as operands (that feature was missing before). Exponential code is fairly fast (faster than PBs Pow() function in my tests) but if 0 or 1 is used as the second operand (b out of a^b) then the code gets reduced to one or two instructions!
More useful updates (IFs, loops and actual commands) will be added as and when I have time - which is a bit scarce at the moment! Note: this is the only link in this post that points to the newsest version!
DOWNLOAD
[Old news]
Ever since I hung up development on my scripting language I've been planning, and working on, a fully fleged compiler. This release is the first fruits of my labour, and I thought I'd share it with you all.
At the moment the compiler can only handle numeric expressions (floats and intergets, as well as variables). Comments (lines starting with ' or as a comment after a line .ie. "1+1 'Comment") are also supported. There's two .exe's in the zip and a text file. Write your 'code' in Code.txt then run Compiler.exe - it's that easy. A file called ASM.txt will be created in that directory containing the outputted ASM.
My overall goal is to create a working modular compiler which is losely based around BASIC rules. I've decided on having quite a long pipeline (each element of which can be swapped with another user creation, so the language is very user modifiable) but I will, eventually, add some switches to the compiler which means you can skip unessacary stages.
For example:
In the .exe you have 'Compiler.exe' and 'Optimizer.exe'. The code produced by 'Compiler.exe' is fuly working but 'Optimizer.exe' speeds it up by a fair amount. So, you could skip the second stage in order to speed up compile time but reduce the eventual .exe's speed (and increase it's size).
I imagine the final pipeline will be something like this (with skippable bits between *s):
*Front end* > *Preprocessor* > Compiler > *Optimizer* > FASM
Anyway, I hope you enjoy! Suggestions, comments and quieres are, as always, welcome! Big thanks to Fred and all the other guys on here who've helped me along the way! Xombie also deserves a special mention for inspiring to speed up most of my code (and making it work properly


DOWNLOAD (Latest version - see below)
As a closing note: I haven't included the source with this release. Why? Well to be honest there's not much actual content - most of the code revolves around my RPN/PostfixToASM procedures which are already floating about on the forums. If you'd like to see the source I can upload it!