flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > B0

Goto page 1, 2, 3, 4  Next
Author
Thread Post new topic Reply to topic
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 06 Jun 2005, 05:52
The B0 language and compiler came about during an effort to create my own Operating System. The main problem faced, was the C was too high level, and coding in assembler was a pain (even though 80% of my code is pure asm, and the other 20% is PHP for work).

Being soley an assembler programmer for many years gave me a pure unrestricted environment to play in, rather than being locked down to a particular environment. Which always left a bad taste in my mouth, whenever I worked with many of the HLLs out there, (ever tried a rotate in C?). I wanted the freedom that assembler gave me, but have a HLL programming style.

I looked Randall Hyde's HLA, and while the syntax is more HLL programmer friendly, it still didn't gel with me. Plus I was limited to a particular OS (Windows or Linux), becuase of the standard library it used. (Which by the way is a great library, just doesn't suit my needs as it stands).

At first B0, may look like C, but once you get down and dirty, you quickly realise that it's not a bastardised C clone, but something else. The best way to think of B0 is a language between assembler, Terse, and C.

A quick word on licensing: The B0 language and this implementation are released under a BSD license.

B0 is still in alpaha/beta form, with features being added on a weekly basis... but still should be enough for people to play with.

More info: http://chewy509.atspace.com/index.html , and follow the b0 links.

PS. The B0 compiler generates FASM output, targeted at 64bit code generation.


Last edited by Chewy509 on 06 Jun 2005, 06:32; edited 1 time in total
Post 06 Jun 2005, 05:52
View user's profile Send private message Visit poster's website Reply with quote
Kain



Joined: 26 Oct 2003
Posts: 108
Kain 06 Jun 2005, 06:18
broken link.

_________________
:sevag.k
Post 06 Jun 2005, 06:18
View user's profile Send private message Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 06 Jun 2005, 06:32
The link has been fixed. (comma added on to the end somehow?)
Post 06 Jun 2005, 06:32
View user's profile Send private message Visit poster's website Reply with quote
pierre



Joined: 07 Nov 2004
Posts: 10
pierre 06 Jun 2005, 10:19
Post 06 Jun 2005, 10:19
View user's profile Send private message Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 06 Jun 2005, 23:59
When will you rewrite it in B0 or pure assembly? Smile
Post 06 Jun 2005, 23:59
View user's profile Send private message Visit poster's website Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 07 Jun 2005, 00:14
pierre wrote:
Have you tried C-- ?

http://c--sphinx.narod.ru/indexe.htm

I have in a limited way, many moons ago...
Post 07 Jun 2005, 00:14
View user's profile Send private message Visit poster's website Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 07 Jun 2005, 00:31
crc wrote:
When will you rewrite it in B0 or pure assembly? Smile

At this stage, once I have the preparser completed, added support for structures, and am confident that it is bug-free as possible.

I started it in C, to literally brush up on my C skills, and since quite a bit of the published material on compiler theory uses C, it made learning how to write the actual compiler a little easier. (If you have a look at the actual C code, you'll find it's rather simple, so porting it to B0 or asm shouldn't be that hard).

To keep it somewhat cross-platform friendly, it'll be rewritten in B0... Since B0 outputs to assembly (in particular for FASM), I guess the conversion to assembly will be a breeze...

I'll just let everyone know, that I have only been working on B0 for just over a month, so it's still a very immature langauge and compiler. It's also my first attempt at designing my own language and writing a compiler to go with it. (The compiler is in fact my first ever compiler for any language). So don't expect anything the quality that FASM is.
Post 07 Jun 2005, 00:31
View user's profile Send private message Visit poster's website Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 09 Jun 2005, 04:37
Hi Everyone,

v0.0.9 has been released: http://chewy509.atspace.com/b0.html

Changes include:
* Added basic preparser for allow for basic definitions and conditional compilation.
* Added ability to nest #ifdef and #ifndef blocks.
* Fixed bug, which allowed sourcecode to be processed when not part of a function, under some circumstances.

The next item on the TODO list is structures.
Post 09 Jun 2005, 04:37
View user's profile Send private message Visit poster's website Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius 09 Jun 2005, 18:15
Interesting...
Post 09 Jun 2005, 18:15
View user's profile Send private message AIM Address Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 09 Jun 2005, 23:58
THEWizardGenius wrote:
Interesting...

Any suggestions on what you would like to make it better?

(Besides Structures, Macros, and a complete standard library for your choice of OS).
Post 09 Jun 2005, 23:58
View user's profile Send private message Visit poster's website Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius 17 Jun 2005, 17:28
Well for one thing, it would be nice if it had Structures, Macros, and a complete standard library for your choice of OS. Very Happy
Seriously though, I think it's great- very much like C except more low-level (maybe similar to C--? I've never used C-- before, but I hear it's good). However, you should probably allow inline ASM. This might seem strange, since it is basically ASM with some structure (like C) but it's nice to program directly in ASM too. Add inline ASM (and also add Structures, Macros, and a complete standard library for your choice of OS - lol) and it'll be great. Probably when my OS is completed (talk to me in a year or so) I'll think about writing an interpreter or compiler of B0, because it's a very good language and I can't do everything in assembly. Thanks!
Post 17 Jun 2005, 17:28
View user's profile Send private message AIM Address Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 20 Jun 2005, 00:00
Confused Inline asm is already included??? (the asm keyword?)

The inline asm, is a direct pass through without modification, so you could implement macros and basic struc's (in FASM syntax) within the asm block.

As for the standard library, I am working on it. But the standard library will take some time, (and will be cross-platform as possible).

Quote:
and I can't do everything in assembly.

That's one of the reasons I'm developing the langauge. (Some over at news:alt.lang.asm where the language was first previewed, some even consider it be an assembler like language - thread called: fruits of my labour).
Post 20 Jun 2005, 00:00
View user's profile Send private message Visit poster's website Reply with quote
adefeo



Joined: 12 Jan 2004
Posts: 46
Location: Bellmore, Long Island, New York
adefeo 21 Jun 2005, 00:01
Any chance of a native IA-32 port?
Post 21 Jun 2005, 00:01
View user's profile Send private message Visit poster's website AIM Address Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 21 Jun 2005, 03:28
adefeo wrote:
Any chance of a native IA-32 port?

Simple answer: From me, no.

However, if someone wants to make a IA-32 native port, then I have absolutely no objections.

PS. How's the 512byte OS coming along?
Post 21 Jun 2005, 03:28
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 21 Jun 2005, 04:31
Chewy509 wrote:
PS. How's the 512byte OS coming along?

It'll start in September... Very Happy
Post 21 Jun 2005, 04:31
View user's profile Send private message Visit poster's website Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius 23 Jun 2005, 00:42
If I were to use B0 in my OS I would have to create an IA-32 version- I don't have a 64-bit processor, and I don't think I'll get one in the near future. But I'll first have to learn how how compilers work. I don't even know what the common terms such as parsing, tokenizing, and others mean! I should ask Privalov where he learned about such things.
Post 23 Jun 2005, 00:42
View user's profile Send private message AIM Address Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 23 Jun 2005, 03:01
THEWizardGenius wrote:
If I were to use B0 in my OS I would have to create an IA-32 version- I don't have a 64-bit processor, and I don't think I'll get one in the near future. But I'll first have to learn how how compilers work. I don't even know what the common terms such as parsing, tokenizing, and others mean! I should ask Privalov where he learned about such things.

I just downloaded a few tutorials from the net (google), and did some recommended reading as outlined in many of the posts and FAQ at news://comp.compilers ( http://groups-beta.google.com/group/comp.compilers?hl=en ).

The thing is, writing an assembler is a little different from something like gcc, you can skip some of the more complex issues that are found in a compiler. Feel free to look through the B0 source, its just over 4100 lines of C. All that's really needed to know is the way compilers work in general. (The B0 site also contains a compiler internals document, which should give you a good start on understanding the source code).

For an assembler, the general case is:
-> take line of input and create tokens based on input
-> parse through tokens, and for things like equates, etc substitute tokens as required.
-> pass tokens to code generator, which then generates the binary code.
-> repeat until no source left.
Post 23 Jun 2005, 03:01
View user's profile Send private message Visit poster's website Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius 26 Jun 2005, 18:10
Where did you learn about these things? I'm very interested in this topic, as I will eventually have to write a compiler, interpreter, or something once I have completed the commandline interface. People will need to be able to develop for my OS, or nobody will use it! Of course, I haven't even gotten started yet, so that will be a ways off... Can you give me some links, or something? The newsgroups haven't been very useful, as almost everything is either an advertisement ("hiring people to write a compiler"), or something beyond my level of expertise ("writing a lexoparsical graph compiler" Laughing ). Are there any tutorials, examples, anything?
Post 26 Jun 2005, 18:10
View user's profile Send private message AIM Address Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 27 Jun 2005, 00:07
THEWizardGenius wrote:
Where did you learn about these things? I'm very interested in this topic, as I will eventually have to write a compiler, interpreter, or something once I have completed the commandline interface. People will need to be able to develop for my OS, or nobody will use it! Of course, I haven't even gotten started yet, so that will be a ways off... Can you give me some links, or something? The newsgroups haven't been very useful, as almost everything is either an advertisement ("hiring people to write a compiler"), or something beyond my level of expertise ("writing a lexoparsical graph compiler" Laughing ). Are there any tutorials, examples, anything?

http://compilers.iecc.com/crenshaw/ <- Good start
http://www.compilers.net/Dir/Free/Books/index.htm
http://www.cs.ucr.edu/~phf/mir/wirth-compiler-1996.pdf <- Assumes that you have most of the basic concepts.
http://www.bloodshed.net/compilers/
http://www.scifac.ru.ac.za/compilers/conts.htm

A lot of the tutorials assume the use of bison/yacc/flex. While these are very good tools, I was better off without these tools, (from a learning perspective).
Post 27 Jun 2005, 00:07
View user's profile Send private message Visit poster's website Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius 27 Jun 2005, 00:20
I have already begun studying the tutorial by Jack Crenshaw, but I wondered if there were any other things. I guess I'll finish the one by Crenshaw before I read any other ones...

I guess we OS developers have to study a wide range of topics, even topics that are not related to OS development... but it's all fun. Smile

_________________
FASM Rules!
OS Dev is fun!
Pepsi tastes nasty!
Some ants toot!
It's over!
Post 27 Jun 2005, 00:20
View user's profile Send private message AIM Address Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3, 4  Next

< 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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.