Skip to content

gg-master/TSCompiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TSCompiler

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:

  1. Data types: number, string, boolean, null, undefined;
  2. Type annotations are required and, in addition to data types, you can use any and void;
  3. Variable declarations var, let, const;
  4. Arithmetic operations + (unary and binary), \ - (unary and binary), *, /, ++ (post and pref), -- (post and pref);
  5. Comparison operations==, !=, >, <, >=, <=;
  6. Assignment operations=, +=, -=, *=, /=;
  7. Logical operations !, &&, ||;
  8. IfElse and ternary operations;
  9. do-while, while, for loops;
  10. Arrays;
  11. Functions;
  12. Special statiс input / output functions from the Console class (not available in TypeScript)

Some examples you can find here.

Attention, there may be bugs ! :)

About

Simplified TS compiler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •