Hobby Programming Language
Hobby Programming Language
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 ). 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!
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 ). 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!
Re: Hobby Programming Language
Interesting project, and I wish you good luck! Looking forward to seeing a self-compiling version.
Re: Hobby Programming Language
Thanks, though I can't say that I'm quite that ambitious.
Re: Hobby Programming Language
That sounds interesting
How did you come up with this idea? Very impressive..looking forward for the final one!
How did you come up with this idea? Very impressive..looking forward for the final one!
Re: Hobby Programming Language
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. Feel free to download the source and give it a try!
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. Feel free to download the source and give it a try!
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Hobby Programming Language
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 ]
[ Project UDI ]
Re: Hobby Programming Language
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.
-
- Posts: 1
- Joined: Mon Jan 14, 2013 1:58 am
Re: Hobby Programming Language
Wish you all the best , consider c++ too.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 ). 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!
jovier.
Re: Hobby Programming Language
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?
Re: Hobby Programming Language
If you assigned, "Hello, world!" to p, p would then be pointed to the location of "Hello, world!" in memory (not 10:5 anymore).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?
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: Select all
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
Code: Select all
strcpy(10:5, "Hello, world!");
-
- Posts: 1
- Joined: Mon Dec 04, 2023 4:02 am
Re: Hobby Programming Language
Looking forward for the final one!