Skip to content

lupuchard/eb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eb

My programming language. Compiles to llvm and stuff.

// structures!
struct Cat {
	age: Int,
	hp: I32,
	calico: Bool
}
fn new_cat(hp: I32): Cat {
	Cat(age=0, hp=hp, calico=false)
}

// functions with optional parameters!
fn do_thing(a: Int, b: Int, [c: Int = 0]): Int {
	a + b * c
}

// function overloading!
fn do_thing(a: Int, b: Bool): Int {
	// implicit returns and expression ifs!
	if b { a * 2 } else { a / 2 }
}

fn main(): I32 {
	// type inference!
	x := do_thing(1, 2) + do_thing(3, 4, c=5) + do_thing(6, true)
	cat := new_cat(x)

	// control flow!
	while cat.hp > 0 {
		cat.hp -= 1
		x += 2
	}

	return x - 108
}

Releases

No releases published

Packages

No packages published

Languages