Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 810 Bytes

README.md

File metadata and controls

38 lines (26 loc) · 810 Bytes

JSON Parsing toolchain

Fun Project in the creation aims for generating JSON AST for formatting and infer TS interface out of AST

Inspired by TS Service

Usage

Example of usage:

const source =
  '{"name": "John Doe", "age": 16, "isStudent": true , "gradDate": null}'
const scanner = new Scanner(source)
scanner.scan()
const parser = new Parser(scanner.tokens)
parser.parse()

const type = new TSVisitor().execute(parser.tree)

// type = 'interface {name: string, age: number, isStudent: boolean, gradDate: null}'

TODO

Typescript Visitor

  • Create a scanner
  • Create a parser
  • Create a visitor
  • Accept inner objects
  • Scan arrays
  • Parse arrays
  • Accept Arrays

JSON Formatter

  • Visitor Setup