Piglet Part4 - AST

A language named Piglet to describe the flow chart

Posted on February 1, 2020

AST

In short

  • prog { type: “prog”, consequent: [ …AST ] }
  • node { type: “node”, value: string }
  • if { type: “if”, test: AST, consequent: [ …AST ], alternate: AST }
  • switch { type: “switch”, discriminant: AST, cases: [ …AST ] }
  • case { type: “case”, test: AST, consequent: [ …AST ] }
  • while { type: “while”, test: AST, consequent: [ …AST ] }
  • do … while { type: “do-while”, test: AST, consequent: [ …AST ] }
  • break { type: “break” }
  • continue { type: “continue” }