What programing language are you using? and why?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: What programing language are you using? and why?

Post 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 :wink:
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.
melgmry0101b
Member
Member
Posts: 109
Joined: Wed Nov 10, 2010 10:49 am

Re: What programing language are you using? and why?

Post 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 :D .
Caleb1994
Member
Member
Posts: 83
Joined: Sun Feb 13, 2011 4:55 pm

Re: What programing language are you using? and why?

Post 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 :P) 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. :P
User avatar
rootnode
Member
Member
Posts: 42
Joined: Fri Feb 29, 2008 11:21 am
Location: Aachen, Germany
Contact:

Re: What programing language are you using? and why?

Post 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 :wink:
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.
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: What programing language are you using? and why?

Post 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.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Skirox
Posts: 11
Joined: Sat Aug 20, 2011 4:05 am

Re: What programing language are you using? and why?

Post by Skirox »

C, ASM and Fortran, because they are easy to use and learn.
Bietje
Member
Member
Posts: 100
Joined: Wed Apr 20, 2011 6:57 am

Re: What programing language are you using? and why?

Post 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.
User avatar
iocoder
Member
Member
Posts: 208
Joined: Sun Oct 18, 2009 5:47 pm
Libera.chat IRC: iocoder
Location: Alexandria, Egypt | Ottawa, Canada
Contact:

Re: What programing language are you using? and why?

Post 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 :D :D
melgmry0101b
Member
Member
Posts: 109
Joined: Wed Nov 10, 2010 10:49 am

Re: What programing language are you using? and why?

Post 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? :?:
User avatar
rootnode
Member
Member
Posts: 42
Joined: Fri Feb 29, 2008 11:21 am
Location: Aachen, Germany
Contact:

Re: What programing language are you using? and why?

Post 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.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: What programing language are you using? and why?

Post 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. :twisted:
Every good solution is obvious once you've found it.
melgmry0101b
Member
Member
Posts: 109
Joined: Wed Nov 10, 2010 10:49 am

Re: What programing language are you using? and why?

Post 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. :twisted:
:D
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: What programing language are you using? and why?

Post 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.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
User avatar
mduft
Member
Member
Posts: 46
Joined: Thu Jun 05, 2008 9:23 am
Location: Austria

Re: What programing language are you using? and why?

Post by mduft »

the only true tools: gcc, gas, vim :) "build-system" is a rather sophisticated GNU makefile.
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

Re: What programing language are you using? and why?

Post 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 :D .
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.)
Post Reply