Skip to content
This repository was archived by the owner on Sep 13, 2022. It is now read-only.
This repository was archived by the owner on Sep 13, 2022. It is now read-only.

Supports grammar for minits  #2

Description

@mohanson

https://github.com/microsoft/TypeScript/blob/master/doc/spec.md

Types

  • Primitive Types
    • number(support signed 64): 0x10, 12
    • boolean: true, false
    • string: "Hello"
    • void
    • null
    • * undefined
    • enum: enum { a = 1, b, c }
  • Object
    • Array
    • Tuple

Expression

  • Assignment: let a: number = 1;, let a: number[] = [1, 2, 3]
  • Parentheses
  • Function Expressions
  • Arrow Functions
  • * Class Expressions
  • Function Calls
  • ++ / --
  • + / - / ~
  • !
  • * typeof
  • +: number + number, string + string, eg.
  • *, /, %, , <<, >>, >>>, &, ^, and | operators
  • <, >, <=, >=, ==, !=, ===, and !== operators
  • * in
  • && and ||
  • The Conditional Operator: test ? expr1 : expr2
  • *=, /=, %=, +=, -=, <<=, >>=, >>>=, &=, ^=, |=
  • Destructuring Assignment: [x, y] = [y, x];

Statements

  • Block
  • Variable Statements
  • Let and Const Declarations
  • If, Do, and While Statements
  • For Statements
  • For-In Statements
  • For-Of Statements
  • Continue Statements
  • Break Statements
  • Return Statements
  • With Statements
  • Switch Statements
  • Throw Statements
  • * Try Statements

Function

  • Function Declarations
  • Function Implementations

Interfaces

Class

  • Class Declarations
  • New class

Build in functions

Extra

在实现 TS 的语法过程中可以先只支持 number 类型, 如果过早考虑其他类型会遇到大量类似 string + number = ? 这类的奇怪特性.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions