Skip to content

Latest commit

 

History

History

implementation

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Thusly Design

Table of Contents

Architectural Overview

Thusly is a dynamic and general-purpose programming language implemented using four main and custom-built components:

  • Tokenizer
  • Parser
  • Compiler
  • Virtual machine

Thusly architectural overview

Tokenizer

  • The tokenizer generates tokens on demand which is controlled by the parser, by advancing through the source code character-by-character.
  • It performs lexical analysis to ensure use of valid characters and sequence of characters, and hence also flags any lexical errors encountered.
  • Details: tokenizer.md

Parser & Compiler

  • The parser and the compiler work in tandem to parse the tokens generated by the tokenizer and write the corresponding bytecode instructions in the correct order based on the precedence of the operators used.
  • The parser performs syntactic analysis to ensure coherence with the specified grammar as well as static semantic analysis and variable resolution.
  • All steps are performed in a single pass.
  • Details: parser-compiler.md

Virtual Machine (VM)

  • The VM evaluates expressions and executes statements by decoding and executing the instructions in the compiled program in a sequential order.
  • It specifies the instruction format of the bytecode which the compiler must adhere to when writing the instructions.
  • Details: vm.md

Data Flow and Walk-Throughs

To get an understanding of the process and data flow from the first step of analyzing characters in the source code up until interpreting the statements, the recommended reading order is:

  1. tokenizer.md
  2. bytecode.md
  3. parser-compiler.md
  4. vm.md

The main components contain walk-throughs of their respective steps using example source code.