Skip to content

matteolutz/umber-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Umber

Spoken: [ˈʌmbəʳ]

A compiled language by Matteo Lutz implemented in Rust


Table of contents

What is Umber

Umber is a compiled (soon multiparadigm) programming language, with it's current compiler implemented in Rust. It's currently WIP so please use it at your own risk.
Future commits WILL for sure contain BREAKING CHANGES.

How to use it

I'm currently working on the full, scientific documentation of the language. For now, you can check out the examples folder to see how the language works.

Build

First you have to clone the repository and cd into it.

git clone https://github.com/matteolutz/umber-lang.git
cd umber-lang

Now you can run the binary crate with cargo run.
To just build the crate, use cargo build.

Compile a file

To compile a file it is important to have the NASM-Assembler installed. Otherwise the compiler won't be able to build a binary from the generated NASM-Assembly.
Then just run:

cargo run com <FILENAME>.ub

.
The Umber compiler now created a directory called build in the current directory containing the generated assembly, object file and binary.
To specify include paths, you can use the --include (or -i) flag.

cargo run com <FILENAME>.ub -i <PATH>

or, if you want to use more than one include path:

cargo run com <FILENAME>.ub -i <PATH1>;<PATH2>;<PATH3>;...

.
To pass additional command line arguments for the linker you can use the --linker (or -l) flag. Here an example:

cargo run com <FILENAME>.ub -l"-dynamic-linker /lib64/ld-linux-x86-64.so.2 -lc"

.
In this example, the Umber object files will be linked against the C standard library (libc). In the near future there will be a code example located in the examples folder on how to use the functions declared in there.

For additional command line arguments that are passed to the NASM-Assembler the syntax is the same as for the linker. Just use the --asm (or -a) instead of the --linker (or -l) flag.

By saying

cargo run help

the Umber compiler will print a help message to the standard output. If you ever get stuck, just run cargo run help to get a visually nice looking helper text.

To install the compiler globally to your system first build the crate in "Release" mode (this tells the Rust compiler to use all possible optimization) with cargo build -r and then just copy the Rust binaries living in target/release into your system's bin directory.
For example:

cargo build -r
cp target/release/umber /usr/local/bin/umber

.
Now you can

umber com
umber help
...

.
You can use all the options shown above by just replacing the cargo run with umber.

Releases

No releases published

Packages

No packages published

Languages