Skip to content

Сompiled, simple and imperative programming language made with LLVM.

Notifications You must be signed in to change notification settings

wandvvs/dust-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dust programming language

Сompiled, simple imperative programming language created for the purpose of education with support for basic variable declarations, assignments, expressions, printing, program termination like exit() in C language and logical operators. The compiler is made using LLVM. When building the compiler, i didn`t implement AST, as many people do. All tests were performed on Ubuntu Linux.

Was done

  • Variables semantic
  • Mut statement
  • Assign statement
  • Exit statement
  • Arithmetic operations with precedence
  • Wrint line statement
  • Const variables
  • String variables
  • Bool variables
  • Float variables
  • Logical operators
  • If statement
  • Loop statement
  • Math functions
  • Etc...

Getting started

Build it yourself

Dependencies: LLVM-DEV, LLVM, C++20, GTest (not necessary)

git clone https://github.com/wandvvs/dust-lang
cd dust-lang/
cd build/
cmake ..
make

Download actual release from dust language releases

Example

use io;

const a = 10 + 2;
mut b = (5 * 2) + 2;

const aEqualB = ? a == b;
writeln(aEqualB);

const PI = 3.14;
const EI = 1.57;

const piLessThanEI = ? PI < EI;
writeln(piLessThanEI);

mut test = ? PI == EI * 2;
writeln(test);

test = "froom boolean to str";
writeln(test);

test = ? 1.57 * 2 == PI;
writeln(test);
./dust-lang <input.dust>
./out

Output:

true
false
true
froom boolean to str
true