flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > Rapid Bull C9

Author
Thread Post new topic Reply to topic
Plue



Joined: 15 Dec 2005
Posts: 151
Plue
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.

Summary:
Basic-like language
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.

Download: http://home.no.net/tsg1zzn/c9.zip
Forums: http://lasic.frac.dk/forum/

Some useless sample code:
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.
Post 31 Oct 2006, 15:39
View user's profile Send private message Reply with quote
Remy Vincent



Joined: 16 Sep 2005
Posts: 155
Location: France
Remy Vincent
Very Happy Very Happy Very Happy

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
Post 01 Nov 2006, 00:15
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.