Skip to content

tsarchghs/MT

Repository files navigation

MT

The compiler skips the AST phase and produces the output based on only the tokens given. Currently it's in alpha stage.

Usage: ./compiler <file>
For the compiler to work you must have C's GCC compiler.
Examples: Print 1 to 10

var b = 1;
while b < 11:
        print(b);
        b += 1;
end

output:

1
2
3
4
5
6
7
8
9
10
var child1 = "John";
var child2 = "Johnson"; // creative.. I know :)
var child1_age = 16;
var child2_age = 16;

if child1_age > child2_age:
	print(child1_age);
end
elif child1_age == child2_age:
	print("They are the same age");
end
else:
	print(child2_age);
end

Output: They are the same age
Dynamic typing:

var b = "DSASDA";
print(b);
b = 31.321;
print(b);
b = 52;
print(b);

Output:

DSASDA
31.321
52

Functions: (alpha/buggy)

function squareOfTwo():
	print(4);
end
squareOfTwo();
    Why is gcc required for the compiler to work?
  • Because MT's compiler (ab)uses GCC's C extension that allows function definitions inside of main function .

About

MT is a high level programming language.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published