The project can compile simple TypeScript programs to Java bytecode.
In fact, the capabilities of this compiler are extremely limited and this project is not a full-fledged TypeScript compiler and contains many simplifications and limitations.
Lexical analysis is implemented using Flex. Parsing is implemented using Bison. Although the grammar rules are similar to TypeScript, they have their own limitations in this project.
- Automatic semicolon insertion is implemented.
Opportunities:
- Data types: number, string, boolean, null, undefined;
- Type annotations are required and, in addition to data types, you can use any and void;
- Variable declarations var, let, const;
- Arithmetic operations + (unary and binary), \ - (unary and binary), *, /, ++ (post and pref), -- (post and pref);
- Comparison operations==, !=, >, <, >=, <=;
- Assignment operations=, +=, -=, *=, /=;
- Logical operations !, &&, ||;
- IfElse and ternary operations;
- do-while, while, for loops;
- Arrays;
- Functions;
- Special statiс input / output functions from the Console class (not available in TypeScript)
Some examples you can find here.
Attention, there may be bugs ! :)