Skip to content

Gaspard Courchinoux's programming language

I created this language for fun because I enjoy doing complex things.

I also want to master LLVM IR's C++ API.

Download: Download

How does the Gaspard compiler work?

Very simply:

  • FLEX for lexical analysis.
  • Bison (in C++ mode, extremely painful) to generate the grammar.

An AST is built → the AST is converted to LLVM IR → it is then compiled into an object file.

The object file is then turned into an executable using the linker available on the host system.

What makes GaspardOS LANG distinctive?

First:

  • 100% compiled.
  • Low-level.

It is also:

  • Designed with very little syntactic ambiguity.
  • Verbose.
  • Very strict about types: there are no implicit type conversions (perhaps a little too strict, to be honest...).
  • Easy to learn.
  • Fun, cute, and KAWAII.
  • Encourages high-level developers (Java developers, for example) to move to low-level programming for performance.
  • Only minimally object-oriented (the only objects are struct values. I do not want to fall into the madness of turning everything into an object).
  • Even my friends at law school can learn it very easily (it is the law of obligations, Gaspard LANG edition 🙂).

Object-oriented programming is good, but only in certain specific cases.

Most of the time, it is used by people who do not know much about the machine.

They follow the herd and use object-oriented programming without forming any real opinion of their own.

I AM NOT AGAINST OBJECT-ORIENTED PROGRAMMING; I AM SIMPLY PRAGMATIC.

Introduction to GaspardOS LANG code

The first design decision:

Variables are defined before functions:

global uint32_t MB_OK = 0x00000000;
global uint64_t hwnd;
global wstring titre = L"éééé ください";
global wstring texte = L"WoW GaspardOS ééé Bonjour MIAM MIAM !!!!!";
global string ascii = "string ascii, GaspardOS prend en charge Unicode et ASCII nativement";

In reality, on Windows, wstring corresponds to:

global ptr uint16_t string_unicode_win .....

All GaspardOS LANG types

TYPE Note Example
uint8_t 8-bit unsigned integer global uint8_t d = cast uint8_t 4;
uint16_t 16-bit unsigned integer global uint16_t d = cast uint16_t 16;
uint32_t 32-bit unsigned integer global uint32_t d = cast uint32_t 32;
uint64_t 64-bit unsigned integer global uint64_t d = 32; NOTE: no cast is needed because integers in Gaspard LANG are always encoded on 64 bits
int8_t 8-bit signed integer global int8_t d = cast int8_t -4;
int16_t 16-bit signed integer global int16_t d = cast int16_t -16;
int32_t 32-bit signed integer global int32_t d = cast int32_t -32;
int64_t 64-bit signed integer global int64_t d = -32; NOTE: no cast is needed because integers in Gaspard LANG are always encoded on 64 bits
float Single-precision float (32 bits) global float d = cast float 32.4;
double Double-precision float (64 bits) global double d = cast double 32.4;
string ASCII string global string str = "Hello ASCII";
wstring Unicode string global wstring str = L"Hello Unicode WOW";

As you can see, the types are inspired by C. You will also notice that a cast is required, except for int64_t and uint64_t.

For system security professionals (or “cybersecurity” professionals, in marketing language), my type system is absolutely necessary and prevents silent overflows, particularly on x86, among other architectures.

Where can I download and build the compiler and see examples?

It is open source on GitHub:

https://github.com/gcourchinoux/GaspardOSLang

I will write more articles about specific aspects of GaspardOS LANG.

Gaspard COURCHINOUX

11/06/2026

A little bonus: an example!!!!

Here is some GaspardOS LANG code. Basically, it calls a single function from the GASPARDOS standard library.

It creates a window using CreateWindowExW.

The WndProc EVENT loop can be implemented as WindowHandler1.

The result:

drawing

The code

// compile with: -Lwin32 stdlib/Win32.o

global uint32_t width ;
global uint32_t height ;
global uint64_t ret_un = 0x1;
global uint64_t status2 = 0;
global string message2 = "addr glang func 0x%lx : \n";

global string message1 = "Gaspard CALL HWND :  0x%x \n";


// #define WM_DESTROY                      0x0002

global uint32_t WM_DESTROY = cast uint32_t 0x0002;

global uint32_t ZERO = cast uint32_t 0;

global uint64_t addr_func = 0;


prototype procedure GaspardOSCreateWindow return uint32_t = begin 

argument begin 


argument uint64_t hInst;
argument uint32_t nCmdShow;
argument uint32_t width;
argument uint32_t height;
argument ptr uint64_t HandlerFunc;

end


end


prototype procedure DefWindowProcW return int64_t = begin 


//DefWindowProc
argument begin 


argument uint64_t hwnd;
argument uint32_t msg;
argument uint64_t wParam;
argument int64_t lParam;



end

end

prototype procedure PostQuitMessage = begin

argument begin 


argument int32_t exit_code;


end

 end


procedure WindowHandler1 return int64_t = begin 


//typedef int (*GaspardOSH)(HWND hwnd,unsigned int msg,uint64_t wParam,uint64_t lParam);

argument begin 


argument uint64_t hwnd;
argument uint32_t msg;
argument uint64_t wParam;
argument int64_t lParam;



end


if hwnd == 0 begin 

return 0;

end


if msg == WM_DESTROY begin 


call PostQuitMessage  ZERO;


return 0;
end 


call printf message1 hwnd;

call DefWindowProcW return status2  hwnd msg wParam lParam ;
return status2;
end


procedure WinMain = begin 


argument begin 


argument uint64_t hInst;
argument uint64_t hPrev;
argument ptr uint8_t cmd;
argument uint32_t show;



end

width = cast uint32_t 400;
height = cast uint32_t 800;

addr_func = WindowHandler1;
call printf message2 addr_func;

call printf message1;
call GaspardOSCreateWindow hInst show width height WindowHandler1;


end