Skip to content

aryan-011/hydrogen-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hydrogen Lang (CPP Compiler)

Hydrogen is a Hobby programming language. It is called Hydrogen because it is simple, lightweight, and will catch on fire if handled improperly🔥

This compiler is written in C++.

Building

Requires nasm and ld on a Linux operating system.

git clone https://github.com/aryan-011/hydrogen-compiler.git
cd hydrogen-compiler
mkdir build
cmake -S . -B build
cmake --build build
The grammar supported is:

[Prog] → [Stmt]*

[Stmt] → {
    return[Expr];
    let ident = [Expr];
    {[Stmt]*}
    if(Cond){[Stmt]*}
    if(Cond){[Stmt]*}else{[Stmt]*}
}

[Cond] → {
    [Term] < [Term]
    [Term] > [Term]
    [Term] <= [Term]
    [Term] >= [Term]
    [Term]! = [Term]
    [Term] == [Term]
}

[Expr] → {
    [Term]
    [BinExpr]
}

[BinExpr] → {
    [Expr] * [Expr]    prec = 2
    [Expr]/[Expr]      prec = 2
    [Expr] + [Expr]    prec = 1
    [Expr] - [Expr]    prec = 1
}

[Term] → {
    int_lit
    ident
    ([Expr])
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages