flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > An educational compiler project written in C#

Author
Thread Post new topic Reply to topic
FlierMate



Joined: 21 Jan 2021
Posts: 219
FlierMate 04 Apr 2021, 15:04
Sambal programming language:
Code:
LET b= 20
b /= 2
MSGBOX b
b +=30
b -=1
MSGBOX b
LET c=40
c*= 22
MSGBOX c    


Using the Sambal compiler(written in C#) will generate a Windows EXE.

This simple Win32 compiler is not using FASM as back-end compiler directly, but I reverse-engineer the PE file generated by FASM to study how to output the binary executable.

As such, the linker version is not the same with that of FASM, but dosHeader and importTable are kept intact as what have been produced by FASMW.

Admin and mods are welcome to move this topic of discussion to elsewhere if my toy programming language is irrelevant. Thanks!

PS: This is an abandoned project.
https://web.archive.org/web/20210603052701/http://sambalcompiler.org/Sambal_24042021.zip


Last edited by FlierMate on 31 Dec 2021, 07:39; edited 17 times in total
Post 04 Apr 2021, 15:04
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1794
Roman 05 Apr 2021, 06:03
And how compile example1.txt ?
Show example.

And what about floats nums ?
For example: a = 1.2*2+2.4
Post 05 Apr 2021, 06:03
View user's profile Send private message Reply with quote
FlierMate



Joined: 21 Jan 2021
Posts: 219
FlierMate 05 Apr 2021, 08:05
Roman wrote:
And how compile example1.txt ?
Show example.

And what about floats nums ?
For example: a = 1.2*2+2.4


Thanks for your interest. Just drag the source text file and drop it on icon of Sambal.exe or use command-line:
Code:
Sambal example1.txt    


Floating numbers is not supported as I am beginner to compiler scene and slow in improving the compiler. In future, iteration construct and conditional statement will be supported.

For my parser, you have to code it in something like this:
Code:
LET a=1
a *= 2
a+=3    


It is far from perfect.
Post 05 Apr 2021, 08:05
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.