OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 1:36 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Hobby Programming Language
PostPosted: Tue Dec 11, 2012 7:47 pm 
Offline

Joined: Thu Apr 30, 2009 10:24 am
Posts: 7
Hello everyone!

I got interested in OS development some time ago, primarily tinkering in assembly language. More recently, I've found myself experimenting with compiler design, a topic that may very well have eclipsed my interest in operating systems (heresy around here, I'm sure :wink: ). I thought writing a tiny, low-level language (in some respects, a high-level assembly given that it's not portable) that compiles to x86 assembly code would be a fun project, and I'd like to share the product of my work thus far with you. If anyone has any questions, suggestions, or finds a use for it in a separate project, I'd love to hear about it!

Some features of the language (dubbed "U"):
* Simple syntax - This is largely due to it being a hobby project, but this could make it a good candidate for teaching the basics of how compilers and assembly code work. It also lacks some of C's idiosyncrasies (header files, etc).
* Compiles to 16-bit Intel x86 assembly code - The output can be read by a human (again, potentially good for learners) and doesn't require knowledge of a linker (executables are, of course, created with an assembler like NASM or FASM).
* Inline assembly - the language makes incorporating assembly code into the main program flow quite simple (since I'm not shooting for portability)

You can download the source and documentation, here:
https://github.com/upcrob/u-programming-language

Again, questions/comments are welcome (just post below). I can't promise I'll have time to implement features if they get requested, but I'm open to hearing about them. Keep in mind, I'm not trying to create any sort of "C killer" - if you're writing production code or an OS that needs to exit real mode, this language isn't for you. Nonetheless, I'd love to see it used in a small OS project like MikeOS, but we'll see what happens.

Have fun!


Top
 Profile  
 
 Post subject: Re: Hobby Programming Language
PostPosted: Wed Dec 12, 2012 7:45 am 
Offline
Member
Member
User avatar

Joined: Sat Oct 23, 2004 11:00 pm
Posts: 1223
Location: Sweden
Interesting project, and I wish you good luck! Looking forward to seeing a self-compiling version. ;)

_________________
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub


Top
 Profile  
 
 Post subject: Re: Hobby Programming Language
PostPosted: Thu Dec 13, 2012 5:14 pm 
Offline

Joined: Thu Apr 30, 2009 10:24 am
Posts: 7
Thanks, though I can't say that I'm quite that ambitious. :D


Top
 Profile  
 
 Post subject: Re: Hobby Programming Language
PostPosted: Mon Dec 17, 2012 9:00 am 
Offline

Joined: Thu Dec 13, 2012 2:06 am
Posts: 3
That sounds interesting =D>
How did you come up with this idea? :idea: Very impressive..looking forward for the final one!


Top
 Profile  
 
 Post subject: Re: Hobby Programming Language
PostPosted: Mon Dec 17, 2012 5:42 pm 
Offline

Joined: Thu Apr 30, 2009 10:24 am
Posts: 7
I developed it largely because assembly was too low-level and C was too portable for me - I wanted to know exactly how my high-level code was being translated down to the machine level.

And just to be clear, the current version is functional. I just say that it's a work in progress because in my experience, a project hasn't reached its 'final' or 'complete' version until its dead. :wink: Feel free to download the source and give it a try!


Top
 Profile  
 
 Post subject: Re: Hobby Programming Language
PostPosted: Tue Dec 18, 2012 3:52 am 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2111
Location: Bucharest, Romania
Have you looked into HLA? It is a high-level assembler, with support for structured, procedural, and OO programming. It might even have support for generic programming---I am not certain.

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
 Post subject: Re: Hobby Programming Language
PostPosted: Wed Dec 19, 2012 6:31 pm 
Offline

Joined: Thu Apr 30, 2009 10:24 am
Posts: 7
I looked into HLA once upon a time. By the time I got around to working on the U compiler, I was more interested in the project itself than its potential uses (sounds kind of like any given IBM product when I put it that way in writing). Otherwise I probably would have looked into something like HLA or C--. This hobby aspect has been really been the primary motivator behind it. Any outside use it gets is just a bonus.


Top
 Profile  
 
 Post subject: Re: Hobby Programming Language
PostPosted: Mon Jan 14, 2013 2:02 am 
Offline

Joined: Mon Jan 14, 2013 1:58 am
Posts: 1
rob wrote:
Hello everyone!

I got interested in OS development some time ago, primarily tinkering in assembly language. More recently, I've found myself experimenting with compiler design, a topic that may very well have eclipsed my interest in operating systems (heresy around here, I'm sure :wink: ). I thought writing a tiny, low-level language (in some respects, a high-level assembly given that it's not portable) that compiles to x86 assembly code would be a fun project, and I'd like to share the product of my work thus far with you. If anyone has any questions, suggestions, or finds a use for it in a separate project, I'd love to hear about it!

Some features of the language (dubbed "U"):
* Simple syntax - This is largely due to it being a hobby project, but this could make it a good candidate for teaching the basics of how compilers and assembly code work. It also lacks some of C's idiosyncrasies (header files, etc).
* Compiles to 16-bit Intel x86 assembly code - The output can be read by a human (again, potentially good for learners) and doesn't require knowledge of a linker (executables are, of course, created with an assembler like NASM or FASM).
* Inline assembly - the language makes incorporating assembly code into the main program flow quite simple (since I'm not shooting for portability)

You can download the source and documentation, here:
https://github.com/upcrob/u-programming-language

Again, questions/comments are welcome (just post below). I can't promise I'll have time to implement features if they get requested, but I'm open to hearing about them. Keep in mind, I'm not trying to create any sort of "C killer" - if you're writing production code or an OS that needs to exit real mode, this language isn't for you. Nonetheless, I'd love to see it used in a small OS project like MikeOS, but we'll see what happens.

Have fun!


Wish you all the best , consider c++ too.

jovier.

_________________
http://net-informations.com


Top
 Profile  
 
 Post subject: Re: Hobby Programming Language
PostPosted: Mon Jan 14, 2013 5:37 am 
Offline
Member
Member
User avatar

Joined: Mon Jan 26, 2009 2:48 am
Posts: 792
Nice piece of work indeed. How exactly is dynamically allocated memory handled? If I declare a pointer byte[] p = 10:5, then does p = "Hello, world!" store "Hello world" into address 10:5 or does it assign a new address to p?


Top
 Profile  
 
 Post subject: Re: Hobby Programming Language
PostPosted: Sat Jan 19, 2013 6:30 pm 
Offline

Joined: Thu Apr 30, 2009 10:24 am
Posts: 7
Hobbes wrote:
Nice piece of work indeed. How exactly is dynamically allocated memory handled? If I declare a pointer byte[] p = 10:5, then does p = "Hello, world!" store "Hello world" into address 10:5 or does it assign a new address to p?


If you assigned, "Hello, world!" to p, p would then be pointed to the location of "Hello, world!" in memory (not 10:5 anymore).

The core language doesn't support dynamic language allocation, so you would have to write your own malloc(). Assuming you had this (and some string functions, in this case strcpy()), you could do something like this:
Code:
byte[] p = malloc(20);        // allocate memory and point p to it
strcpy(p, "Hello, world!");   // copy "Hello, world!" to the location pointed to by p


Alternatively, if you knew you were going to put the string at a position like 10:5, you could do something like this:
Code:
strcpy(10:5, "Hello, world!");


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 35 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group