From 6c16ce83f7ab0eaa97ad9f518cffd6247f88d1f2 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Mon, 16 Jan 2023 20:08:00 -0800 Subject: add explanation for NoExcess --- build/website/projects/no_excess.html | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'build/website/projects/no_excess.html') diff --git a/build/website/projects/no_excess.html b/build/website/projects/no_excess.html index b80a02a..21910b1 100644 --- a/build/website/projects/no_excess.html +++ b/build/website/projects/no_excess.html @@ -43,6 +43,40 @@ NoExcess browse my git frontend for the software names.

+ +

Explanation

+ +

+ This language was made by separating the interpretation into three phases: the tokenization, the parsing, and the visiting. + The tokenizer takes the input file and groups characters into structures called tokens. This groups characters together in + order to treat things as single objects. For example, the number 1582.3 should be read as a single number rather than + a string of characters. +

+ +

+ The parser was done via recursive descent. Basically, the parser takes the tokens and converts them into abstract syntax tree + nodes. The abstract syntax tree is a hierarchy of data which determines the order of the later execution of the program. + It recursively goes through the tokens, trying to find certain patterns in the tokens and identifying them to be certain + program objects. +

+ +

+ During the parsing phase, variables are stored in a hash table and they are set equal to an abstract syntax tree. Later, + this table of global variables will be sent to the visitor to be evaluated. +

+ +

+ After the parsing phase is finished, the visitor phase evaluates the abstract syntax tree. It traverses the tree until it + gets to the bottom of it, in which case it returns another abstract syntax tree that corrolates to the value that each node + evaluates to. There are several self evaluating types in this language which return themselves when evaluated, and there + are others that have different rules for what they evaluate to. This is defined in the visitor. +

+

+ When a function is evaluated, each function argument is evaluated as well which is then put on a stack of hash tables. In + this way, I have programmed a simulated stack frame like ones found in C, and recursion is then possible. Symbols in this + language get evaluated to what they are bound to (you can bind symbols to expressions via the `bind` keyword, and local variables + also get evaluated in the same way via the stack frame). +

-- cgit