Making A Compiler

From bibbleWiki
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)