Message board for the users of flat assembler.
> High Level Languages > Rapid Bull C9
I am making a compiler for a basic-like language (programmed in PureBasic, outputs fasm-syntax assembly).
It's lacking a lot (most) functionality yet, mainly because I've focused exclusively on the code quality until now to get a solid base.
Three variable types: Int, Float and Byte (all signed)
Five operators: = + - * /
Precedence levels: (* and /), then (+ and -) then (=)
Use parenthesis to force operator precedence. So in a+b*c, b*c is done first, but in (a+b)*c, a+b is done first
Do an assignment by typing variable = expression
Declare a variable by typing DIM variablename AS TYPE
The compiler is case-INsensitive and must be run from the command line. It processes the contents of input.rq
IF .. ENDIF and WHILE .. WEND and REPEAT .. UNTIL
The generated code for the conditionals isn't very good yet, but this will be fixed. At the moment I have also added IF .. ELSE .. ENDIF and two more operators (< and >), but the compiler is in the middle of a turmoil to implement units, automatic assembling and linking and strings, so I can't show it as it is.
Please try it and tell me what you think of the generated code (except for if, while and repeat) and report any bugs you find.
Some useless sample code:
Dim a As int dim b as int dim c as int dim d as int dim e as int dim pineapple as int dim r as byte dim g as byte Dim float As FLOAT dim goat as float a = b*(float*(c/(d*(e)))) a = 0 repeat a = a + 1 b = a until a = 50000000 while b b = b + 1 wend
Roses are red
Violets are blue
Some poems rhyme
And some don't.
|31 Oct 2006, 15:39||
FIRST I was thinking that the output was done by some PRINT PRINT PRINT...
Then, I added the line "A = 11" and guess what?? well you know your program the output was ok... But why are you stopping your programming ??? may be you should start a simple REGULAR EXPRESSION COMPILER; instead of a total compiler...
Groups lower your IQ
|01 Nov 2006, 00:15||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.