muta-minits
muta-minits copied to clipboard
Supports grammar for minits
https://github.com/microsoft/TypeScript/blob/master/doc/spec.md
Types
- [ ] Primitive Types
- [x] number(support signed 64):
0x10,12 - [x] boolean:
true,false - [x] string:
"Hello" - [x] void
- [ ] null
- [ ]
* undefined - [x] enum:
enum { a = 1, b, c }
- [x] number(support signed 64):
- [ ] Object
- [x] Array
- [ ] Tuple
Expression
- [x] Assignment:
let a: number = 1;,let a: number[] = [1, 2, 3] - [x] Parentheses
- [x] Function Expressions
- [ ] Arrow Functions
- [ ] * Class Expressions
- [x] Function Calls
- [x]
++/-- - [x]
+/-/~ - [x]
! - [ ] *
typeof - [x] +: number + number, string + string, eg.
- [x]
*,/,%,–,<<,>>,>>>,&,^, and|operators - [x]
<,>,<=,>=,==,!=,===, and!==operators - [ ] *
in - [x]
&&and|| - [x] The Conditional Operator:
test ? expr1 : expr2 - [x]
*=,/=,%=,+=,-=,<<=,>>=,>>>=,&=,^=,|= - [ ]
Destructuring Assignment:[x, y] = [y, x];
Statements
- [x] Block
- [x] Variable Statements
- [x] Let and Const Declarations
- [x] If, Do, and While Statements
- [x] For Statements
- [ ]
For-In Statements - [x] For-Of Statements
- [x] Continue Statements
- [x] Break Statements
- [x] Return Statements
- [ ]
With Statements - [x] Switch Statements
- [ ] Throw Statements
- [ ] * Try Statements
Function
- [x] Function Declarations
- [x] Function Implementations
Interfaces
Class
- [ ] Class Declarations
- [ ] New class
Build in functions
- [ ] See: https://www.tutorialspoint.com/javascript/javascript_builtin_functions.htm
Extra
在实现 TS 的语法过程中可以先只支持 number 类型, 如果过早考虑其他类型会遇到大量类似 string + number = ? 这类的奇怪特性.
@yejiayu
Throw 和 Try 要做,否则异常怎么抛到外部?难道用返回值吗?
对的. Throw 和 Try 不是必须的.
这是 c 的做法吧。。。,最少也得支持 throw 才行
这是 c 的做法吧。。。,最少也得支持 throw 才行
嗯, 可以. 已修改.
我躺好了,坐等当小白鼠