muta-minits icon indicating copy to clipboard operation
muta-minits copied to clipboard

Supports grammar for minits

Open mohanson opened this issue 6 years ago • 6 comments

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 }
  • [ ] 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 = ? 这类的奇怪特性.

mohanson avatar Aug 14 '19 07:08 mohanson

@yejiayu

mohanson avatar Aug 14 '19 07:08 mohanson

Throw 和 Try 要做,否则异常怎么抛到外部?难道用返回值吗?

yejiayu avatar Aug 15 '19 02:08 yejiayu

对的. Throw 和 Try 不是必须的.

mohanson avatar Aug 15 '19 02:08 mohanson

这是 c 的做法吧。。。,最少也得支持 throw 才行

yejiayu avatar Aug 15 '19 02:08 yejiayu

这是 c 的做法吧。。。,最少也得支持 throw 才行

嗯, 可以. 已修改.

mohanson avatar Aug 15 '19 02:08 mohanson

我躺好了,坐等当小白鼠

orangemio avatar Aug 29 '19 08:08 orangemio