Antonin Hérault
Antonin Hérault

Antonin Hérault

I'm writing a compiler... for a special language

I love making programming languages and 3D stuff... why not doing something in a row ?

Antonin Hérault's photo
Antonin Hérault
·May 12, 2022·

3 min read

Featured on Hashnode

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Junon is my project. A general-purpose programming language, with a modern view and thought to be easily learned and a 3D engine to make 3D softwares, video games and all stuffs possible with 3D. Multi-platform, for sure.

The language is really not finished. Please be careful with the code you write in Junon, the syntax checker is poor for the moment. But I'm working hard to make this project truly awesome !

Remember, you are looking at the first steps of Junon project, pretty right ?

The "3D part" is not implemented yet, follow Junon on Github or this blog to be notified of the next updates :)

Take a tour on the (current) Junon language

Let's make an hello world !

fun main {
    print 'hello world!\n'
    ret 0
}

Take note that print is a keyword for the native system call, not a function. The standard library has not been made yet.

The language is constructed a simple principle

<instruction> <direct value>
or
<instruction> {
    <?instructions...>
    <expression end's value>
}

{ ... } is an expression

See that with a code example :

let x: int = 5 // first way
let y: int = { // second way
    print 'I love Junon !\n'
    let x: int = 3 // another scope, this `x` is different than the first one
    { 5 + x }
}
let z: int = { 2 + 2 }

Similar to Rust.

Current available instructions :

  • fun : for a function declaration (why not "func" ? it's less fun !)
  • ret : to return (? with a value) the function
  • print and exit : native syscalls
  • let and static : (?static) variable creation
  • @ : macro to directly write Assembly code

Write direct assembly code :

fun main {
    @ mov rax, 5
    ret
}

This doesn't exist for the moment, but I know how to implement that even if it's a compiled language :

let a: int = 3
if a == 3 {
    print 'hello world!\n'
}

fun main {
    ret 0
}

Right, it looks like an interpreted language, but trust me, it's a compiled language.

It already permits to create a (os-native) library or a executable binary. Read the help page by doing a simple : juc --help

What makes the Junon language better for 3D ? It's a simple but compiled language, then you have only to be concentrated on the "3D part", forget the language problems, this is simple. The linked 3D engine will be created from this principle of simplicity

Then, this is the repositories of the related projects around the Junon compiler (juc) :

  • jup : The Junon source code parser and syntax checker, to be easily used in all community projects, also used by juc
  • x64asm : Generate Assembly code more properly in Rust, thought to be used with nasm.
  • rslog : Generate beautiful logs for you program (originally designed for compilers/interpreters)

I'm thinking about adding VR for Android later. Is that interesting to add ?

Thanks for reading me. See you soon for new adventures !

Gift : The Junon project logo : Junon logo