Making A Compiler

From bibbleWiki
Revision as of 07:32, 6 September 2024 by Iwiseman (talk | contribs) (Created page with "=Introduction= This page is how someone went about build a compiler and is here for reference =Steps= *Write example file *Read contents of file *Parse Lines *Parse Tokens in *Decide on Node Types *Decide what AST should look like *Create Nodes =Things I learnt= ==Abstract Syntax Tree== ==Continuation vs Recursion== ==Typical Flow Control=== *Jump goto, while, functions *Conditional (if/then/else) *Early Exit (break, continue, skip) *Exception handling (try/throw/catch)...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

This page is how someone went about build a compiler and is here for reference

Steps

  • Write example file
  • Read contents of file
  • Parse Lines
  • Parse Tokens in
  • Decide on Node Types
  • Decide what AST should look like
  • Create Nodes

Things I learnt

Abstract Syntax Tree

Continuation vs Recursion

Typical Flow Control=

  • Jump goto, while, functions
  • Conditional (if/then/else)
  • Early Exit (break, continue, skip)
  • Exception handling (try/throw/catch)
  • Lazy evaluation (delay/force)
  • Threading (thread create,stop, yield)
  • Generator (yield)