Page 2 of 3
Re: What programing language are you using? and why?
Posted: Thu Aug 18, 2011 12:47 pm
by jnc100
rootnode wrote:I use C# for OS development with an own compiler (also written in C#) to produce an AOT'd kernel and later it's going to be used as a JIT compiler.
As do I although obviously mine is better
On a more serious note though good work on getting generics and delegates working, I remember what a faff it was. I often wish Microsoft had been less braindead when they designed CIL although that's possibly hoping for too much.
Regards,
John.
Re: What programing language are you using? and why?
Posted: Thu Aug 18, 2011 5:38 pm
by melgmry0101b
turdus wrote:I use CL (this is my own programming language, that allows you to write and mix object oriented assembly and C) and fasm. I wrote the compiler in ANSI C, and I use gcc to compile it.
I did this because I really wanted to start from ground up (including the compiler, the ABI and the object/executable format). I choose fasm because it's fast, small, supports amd64 and incredibly easy to port. Nevertheless it has rich macro capabilities.
I'm pretty sure many of you wondering what's the source look like, here's an example:
Code: Select all
//tell the compiler that code blocks use fasm syntax
#codeblock "fasm"
import lib.stdio;
class app.helloworld{
int counter=0; //initialized class variable
//entry point and arguments, similar to C's
int main(string[] args)
{
.var string hello="Hello World!" //initialized variable in local stack frame
//some meaningless code in native assembly
xor rax, rax
//same as counter++
clbaseof rbx, app_helloworld.counter //rbx=&counter;
inc qword [rbx]
//say hello
clcall0 lib_stdio.printf, hello
//return a value
clret 0
}
}
- or -
import lib.stdio;
class app.helloworld {
int counter=0;
int main(){
string hello="Hello World!";
app.helloworld.counter++; //will not call object.int.inc(counter) because it's an inline method
lib.stdio.printf(hello);
return(0);
}
}
The compiler generates an intermediate assembly source file, that can be assembled with a macro assembler and the corresponding CL header file (that contains macros for machine independent mnemonics, like clbaseof or clret). Currently I have headers for fasm, nasm and gas.
CL has basic support for aspect paradigm, and supports operator overloading, dynamic linking, monitors (aka critical sections), randezvous points, class level polymorphism and multiple dispatch. It does not support (and never will) inheritance and virtual methods (you have virtual classes, you can't change one method in a class, only all methods at once if the old and new interface conforming).
Really it is a good programing language , even it can be used in developing an OS , i think it can be very useful in the future
.
Re: What programing language are you using? and why?
Posted: Thu Aug 18, 2011 6:14 pm
by Caleb1994
ATM I use C (gcc) and assembly (NASM). As many people have said, you can't do without assembly, and I use C because it's very easy to look at and know exactly what's happening. It's easy to imagine what's actually happening in assembly (or byte code I guess, but assembly is easier to imagine
) when looking at the code. When you have things like C++, or BASIC, you have to account for things that are done automagically for you, that could have errors. I think it makes it easier to debug. Speaking of debugging, I use GDB/DDD also Bochs debugger when i'm working with assembly errors or very low-level stuff. No IDE. Kwrite+Bash for me
That said, I do plan (MUCH later) to support languages like C++, possibly BASIC (because it's not too complicated), and PERL. They are very useful, and widely used.
Come to think of it, the biggest thing that influenced my decision for using C was that I had read that you had to code all the setup for things like resource management, like constructors/destructors (for C++ atleast), so I just chose C since it is literally converted to assembly, compiled, and only does what you see in the source.
Re: What programing language are you using? and why?
Posted: Thu Aug 18, 2011 10:12 pm
by rootnode
jnc100 wrote:rootnode wrote:I use C# for OS development with an own compiler (also written in C#) to produce an AOT'd kernel and later it's going to be used as a JIT compiler.
As do I although obviously mine is better
On a more serious note though good work on getting generics and delegates working, I remember what a faff it was. I often wish Microsoft had been less braindead when they designed CIL although that's possibly hoping for too much.
Regards,
John.
Nice to see some other C# projects going on. I often think that they weren't THAT braindead when they designed it. But I might contact you to exchange informations/experiences sometime.
Re: What programing language are you using? and why?
Posted: Fri Aug 19, 2011 4:46 pm
by neon
Currently C and assembly language. Reasons include C being easier to port then its C++ counterpart and easier to bind with other programming languages. Build environment uses MSVC with NASM, but we will drop this soon for a custom toolchain.
Re: What programing language are you using? and why?
Posted: Sat Aug 20, 2011 8:08 am
by Skirox
C, ASM and Fortran, because they are easy to use and learn.
Re: What programing language are you using? and why?
Posted: Sat Aug 20, 2011 4:30 pm
by Bietje
My github project graphs say that my OS project is written for 51% in C and 48% assembly (the 1% you are missing are shell scripts). Currently am I reducing the amount of assembly to improve portability.
Re: What programing language are you using? and why?
Posted: Sun Aug 21, 2011 9:33 am
by iocoder
XenOS wrote:C++ and ASM, GCC and GAS, no IDE.
I prefer object oriented programming techniques which are easy to implement, mixed with a bit of ASM whenever this is necessary. GCC and GAS target all architectures I'm working with (x86 (32 / 64), ARM, M68K).
XenOS, You are just like me
Re: What programing language are you using? and why?
Posted: Wed Aug 24, 2011 8:18 am
by melgmry0101b
rootnode wrote:I use C# for OS development with an own compiler (also written in C#) to produce an AOT'd kernel and later it's going to be used as a JIT compiler.
are you using COSMOS?
Re: What programing language are you using? and why?
Posted: Wed Aug 24, 2011 9:49 am
by rootnode
Mozo40 wrote:rootnode wrote:I use C# for OS development with an own compiler (also written in C#) to produce an AOT'd kernel and later it's going to be used as a JIT compiler.
are you using COSMOS?
Nope. Writing my own compiler and OS. See
https://github.com/kintaro/mosa-project and
http://www.mosa-project.org/projects/mosa.
Cosmos is only able to AOT, whereas we'll be able to JIT also. Furthermore Cosmos doesn't support generics if I remember correctly.
Re: What programing language are you using? and why?
Posted: Wed Aug 24, 2011 10:59 am
by Solar
I don't have an OS project of my own, but I
have to post this line, or I'll burst.
What programing language are you using? and why?
C++. Because I can.
Re: What programing language are you using? and why?
Posted: Wed Aug 24, 2011 9:08 pm
by melgmry0101b
Solar wrote:I don't have an OS project of my own, but I
have to post this line, or I'll burst.
What programing language are you using? and why?
C++. Because I can.
Re: What programing language are you using? and why?
Posted: Thu Aug 25, 2011 12:37 am
by gravaera
C++ mixed with ASM and C. C++ is given preference where possible, and I prefer to use a text editor like Gedit as opposed to an IDE.
Re: What programing language are you using? and why?
Posted: Fri Aug 26, 2011 6:18 am
by mduft
the only true tools: gcc, gas, vim
"build-system" is a rather sophisticated GNU makefile.
Re: What programing language are you using? and why?
Posted: Fri Aug 26, 2011 7:59 am
by turdus
Mozo40 wrote:Really it is a good programing language , even it can be used in developing an OS , i think it can be very useful in the future
.
Thanks! As a matter of fact, it's quite useful right now, not just can be in the future. I can do things that would be impossible with ELF (for example singed, 100% virus-free executables, no stack overflow attacks (independent call and local variable stack), common license management etc.), and thanks to the rich features of the language I can avoid typical errors in the code (critical sections, run-time interface check on dlopen, etc.)