flat assembler
Message board for the users of flat assembler.

Index > Main > Compiler construction

Author
Thread Post new topic Reply to topic
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach 12 Feb 2005, 13:57
I am wondering if anybody have any experience in compiler construction?
I am thinking of writing some sort of simple compiler engine in fasm that could be used to create SimpleC or SimplePascal. Wink
Any comments/suggestions?

PS: I would use it in my own OS.

_________________
BOS homepage: http://bos.asmhackers.net/
Post 12 Feb 2005, 13:57
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 12 Feb 2005, 18:10
maybe privalov could have some experiences with somthing like that, but i am not sure. Wink
Post 12 Feb 2005, 18:10
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach 12 Feb 2005, 18:17
He may have.. Wink
But on the other hand, it for HLL languages which may be very diffrent to write a compiler for.

I don't really know if my future compiler should produce an .asm file or if i somehow should include fasm in my compiler? Or if I should try and make a "macro-compiler" instead..
Post 12 Feb 2005, 18:17
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8354
Location: Kraków, Poland
Tomasz Grysztar 12 Feb 2005, 18:59
One of my intentions when designing fasm was to make it a good back-end for the HLL compilers. I had made my first assembler when trying to write my own HLL compiler in 1998, but that project was never finished. However later, when I concentrated on fasm development, some other programmers started to use fasm for this purpose. The first such compiler was the B-Flat by Ken Martwick (he also helped me with writing the very first documentation for fasm), since it's open-source I'm attaching it here - maybe you will find it useful, but this project never grown up.


Description: B-Flat compiler, version 0.50
Download
Filename: bflat050.zip
Filesize: 302.78 KB
Downloaded: 559 Time(s)

Post 12 Feb 2005, 18:59
View user's profile Send private message Visit poster's website Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 12 Feb 2005, 19:09
A Forth compiler is easy to implement Wink

_________________
Charles Childers, Programmer
Post 12 Feb 2005, 19:09
View user's profile Send private message Visit poster's website Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach 12 Feb 2005, 20:22
Thanks Privalov, but is seems like it's written in C (quick look). Can't see any connection to fasm.. I'll take a closer look.
Maybe I should download RetroForth and see if I can learn something.. Wink
Post 12 Feb 2005, 20:22
View user's profile Send private message Reply with quote
beppe85



Joined: 23 Oct 2004
Posts: 181
beppe85 12 Feb 2005, 22:28
I think it would be better to generate assembly and pass it to a dll built from fasm. So we could use the last fasm version without having to rebuild the compiler.

If you can, read "Modern Compiler Implementation in C" by Andrew Appel. I prefer the Java version, but C resembles more asm than does Java.

I have some knownledgement about the matter, but never wrote a compiler in a traditional imperative fashion, but maybe I could help you.

First define simple. It should be simple to build, make simple optimizations, fast or what? You want to use compiler-compiler tools(i'm not aware it they exist for asm), or wnat to hand-code all?

_________________
"I assemble, therefore I am"

If you got some spare time, visit my blog: http://www.beppe.theblog.com.br/ and sign my guestmap
Post 12 Feb 2005, 22:28
View user's profile Send private message Reply with quote
iklin



Joined: 20 Mar 2004
Posts: 120
Location: Russia, Siberia
iklin 13 Feb 2005, 09:10
There is Flat C written in Fasm. It's russian site. And implementation is not so good. It's only changed fasm sources.
http://www.compilers.narod.ru/proj.html

So... Time to time I'm working on such things and now have a great collection of docs. If you are so interesting I'll make a list of all of docs, links and stuffs and post it here. Some times later...
Post 13 Feb 2005, 09:10
View user's profile Send private message ICQ Number Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach 13 Feb 2005, 14:12
Thanks.. I would glady take any links you may have..
I found some compiler compilers on the net, but i prefer building it myself.
Building it to asm sources firt may be the best idea, that way we could see excatly what the compiler produces.. Wink
I am thinking of how I could make it possible to change syntax for diffrent languages, like between C and Pascal.
Post 13 Feb 2005, 14:12
View user's profile Send private message Reply with quote
beppe85



Joined: 23 Oct 2004
Posts: 181
beppe85 13 Feb 2005, 15:23
bubach wrote:
I am thinking of how I could make it possible to change syntax for diffrent languages, like between C and Pascal.

You mean a compiler like GCC? In this case, you have well-delineated front- and back-end's. You'll need a intermediate representation of source, it should not be nor source language nor target machine dependent, or all source languages or all target machines have some in common. FASM uses a flat representation(still text), but other representations include AST(abstract syntax tree), and triples and quadruples(arrays of record with 3/4 fields)

_________________
"I assemble, therefore I am"

If you got some spare time, visit my blog: http://www.beppe.theblog.com.br/ and sign my guestmap
Post 13 Feb 2005, 15:23
View user's profile Send private message Reply with quote
iklin



Joined: 20 Mar 2004
Posts: 120
Location: Russia, Siberia
iklin 14 Feb 2005, 18:17
Quote:
I am thinking of how I could make it possible to change syntax for diffrent languages, like between C and Pascal.


Look at this - http://home.perm.ru/~strannik/ - a strange C-Pascal-Modula compiler. Confused
And this - http://yallie.narod.ru/ - is another good place with many links.
And this - http://webster.cs.ucr.edu/ - if you don't know! There is a tutorial for writing assembler. Smile
And this - http://compilers.iecc.com/crenshaw/ - it's a classic tutorial! Smile
And this - http://www.compilerconnection.com/books/books.htm - is interesting.

Sorry, now I'm too busy and just now I'm hurry... Sad
Post 14 Feb 2005, 18:17
View user's profile Send private message ICQ Number 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.