summaryrefslogtreecommitdiff
path: root/comp
diff options
context:
space:
mode:
Diffstat (limited to 'comp')
-rwxr-xr-xcomp/lucas-standen-NEA/code/tokenizer/tokenizerbin28928 -> 42264 bytes
-rw-r--r--comp/lucas-standen-NEA/code/tokenizer/tokenizer.c99
-rw-r--r--comp/lucas-standen-NEA/code/tokenizer/types.h5
-rw-r--r--comp/lucas-standen-NEA/code/tokenizer/util.c38
-rw-r--r--comp/lucas-standen-NEA/code/tokenizer/util.h7
-rw-r--r--comp/lucas-standen-NEA/writeup/coverpage.ms34
-rw-r--r--comp/lucas-standen-NEA/writeup/coverpage.ps266
-rw-r--r--comp/lucas-standen-NEA/writeup/questions-for-amy.ps2
8 files changed, 295 insertions, 156 deletions
diff --git a/comp/lucas-standen-NEA/code/tokenizer/tokenizer b/comp/lucas-standen-NEA/code/tokenizer/tokenizer
index ab76521..2d2f1c0 100755
--- a/comp/lucas-standen-NEA/code/tokenizer/tokenizer
+++ b/comp/lucas-standen-NEA/code/tokenizer/tokenizer
Binary files differ
diff --git a/comp/lucas-standen-NEA/code/tokenizer/tokenizer.c b/comp/lucas-standen-NEA/code/tokenizer/tokenizer.c
index f94b640..080951b 100644
--- a/comp/lucas-standen-NEA/code/tokenizer/tokenizer.c
+++ b/comp/lucas-standen-NEA/code/tokenizer/tokenizer.c
@@ -4,9 +4,11 @@
#include "types.h"
#include "util.h"
-void getBuiltIn(char *func, ast_node *node){
+#define MAXARGS 8
+
+int getBuiltIn(char *func, ast_node *node){
if (strcmp(func, "defun") == 0){
- node->func->builtInFunc = DEFUN;
+ node->func->builtInFunc= DEFUN;
}else if (strcmp(func, "let") == 0){
node->func->builtInFunc = LET;
}else if (strcmp(func, "set") == 0){
@@ -51,57 +53,72 @@ void getBuiltIn(char *func, ast_node *node){
node->func->builtInFunc = EXIT;
}else if (strcmp(func, "return") == 0){
node->func->builtInFunc = RETURN;
+ }else {
+ node->func->builtInFunc = NIL;
+ return -1;
}
- else {
- node->func->builtInFunc = -1;
- }
+ return 0;
}
ll_t *getUserDefinedFunction(char *function);
void expressFunction(char *function, ast_node *node){
- if ((node->func->builtInFunc = getBuiltIn(function)) == -1){
- node->func->func = getUserDefinedFunction(function);
+ node->func = CheckedMalloc(sizeof(functionToken));
+ if ((getBuiltIn(function, node)) == -1){
+ //node->func->func = getUserDefinedFunction(function);
} else {
node->func->func = NULL;
}
}
+void expressArgs(char **args, ast_node *node){
+ for (int i = 0; i < MAXARGS; i++){
+ if (node->args[i] == NULL){
+ memcpy(node->literalArgs[i], args[i], strlen(args[i]) + 1);
+ }
+ }
+
+}
+
ast_node *tokenize(char *input){
- ast_node *node;
+ ast_node *node, *child;
char *exp, *function, **args;
- size_t i, j;
- int depth;
-
- for (int i = 0; i < strlen(input); i++){
- if (input[i] == '('){
- depth = 1;
- j = i;
- exp = CheckedMalloc(strlen(input));
- while (depth != 0){
- if (input[j] == '('){
- depth++;
- } else if (input[j] == ')'){
- depth--;
- }
- exp[j - i] = input[j+1];
- j++;
- if (input[j] == '\0'){
- fprintf(stderr, "error brace not closed");
- exit(1);
- }
+ size_t i = 0, argCount = -1;
+ int depth = 0;
+
+ node = CheckedMalloc(sizeof(ast_node));
+ node->args = CheckedMalloc(sizeof(ast_node) * MAXARGS);
+ node->literalArgs = CheckedMalloc(sizeof(void *) * MAXARGS);
+
+ if (input[i] == '('){
+ depth = 1;
+ i++;
+ exp = CheckedMalloc(strlen(input));
+ while (depth != 0){
+ if (input[i] == ' ') argCount++;
+ if (input[i] == '('){
+ child = tokenize(&input[i]);
+ node->args[argCount] = child;
+ depth++;
+ } else if (input[i] == ')'){
+ depth--;
+ }
+ exp[i - 1] = input[i];
+ if (input[i] == '\0'){
+ fprintf(stderr, "error brace not closed\n");
+ exit(1);
}
- j -= 2;
- exp[j] = '\0';
- printf("%s\n", exp);
- }else if (input[i] == '"'){
i++;
- while (input[i] != '"') i++;
}
+ exp[i-2] = '\0';
+ exp = CheckedRealloc(exp, strlen(exp) + 1);
+ printf("%s\n", exp);
+ }else if (input[i] == '"'){
+ i++;
+ while (input[i] != '"') i++;
}
- node = CheckedMalloc(sizeof(ast_node));
i = 0;
function = CheckedMalloc(strlen(exp));
@@ -116,13 +133,19 @@ ast_node *tokenize(char *input){
expressFunction(function, node);
- free(function);
+ i++;
+ args = Split(&input[i], ' ');
+ // need a length
+ expressArgs(args, node /* length */ );
+
free(exp);
- return NULL;
+ return node;
}
int main(){
- char sample[] = "(+ \"hello(\" 1)";
- tokenize(sample);
+ char sample[] = "(+ (- 2 2) 1)";
+ ast_node *root = tokenize(sample);
+ printf("%d", root->args[0]->func->builtInFunc);
+ free(root);
}
diff --git a/comp/lucas-standen-NEA/code/tokenizer/types.h b/comp/lucas-standen-NEA/code/tokenizer/types.h
index 82eb3df..8c79bd9 100644
--- a/comp/lucas-standen-NEA/code/tokenizer/types.h
+++ b/comp/lucas-standen-NEA/code/tokenizer/types.h
@@ -24,6 +24,7 @@ typedef uint64_t u64;
// built in functions
typedef enum builtInFuncs {
+ // general
DEFUN = 0,
LET = 1,
SET = 2,
@@ -48,10 +49,12 @@ typedef enum builtInFuncs {
GTEQ = 18,
LTEQ = 19,
+ // misc
CAST = 20,
TYPEOF = 21,
EXIT = 22,
RETURN = 23,
+ NIL = -1,
} builtInFuncs;
// function type
@@ -63,8 +66,6 @@ typedef struct functionToken {
builtInFuncs builtInFunc; // a built in functions
} functionToken;
-// built in functions
-
typedef struct ast_node ast_node;
typedef struct ast_node {
diff --git a/comp/lucas-standen-NEA/code/tokenizer/util.c b/comp/lucas-standen-NEA/code/tokenizer/util.c
index de5b6b2..46deba8 100644
--- a/comp/lucas-standen-NEA/code/tokenizer/util.c
+++ b/comp/lucas-standen-NEA/code/tokenizer/util.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <error.h>
@@ -6,6 +7,7 @@
void Die(); // brings down the program
void *CheckedMalloc(long size); // malloc checked
void *CheckedRealloc(void *out, long size); // realloc checked
+char **Split(char *s, char c); // splits a string into an array of strings around c
void Die(){
perror("zpy parser");
@@ -25,3 +27,39 @@ void *CheckedRealloc(void *orig, long size){
Die();
return out;
}
+
+static size_t countSegment(char const *s, char c){
+ size_t counter = 0;
+ int i = 0;
+ while (s[i]){
+ if (s[i] == c){
+ i++;
+ continue;
+ }
+ counter++;
+ while (s[i] && s[i] != c) i++;
+ }
+ return counter;
+}
+
+char **Split(char *s, char c){
+ char **strs;
+ size_t tab_counter;
+ size_t i;
+ size_t j;
+
+ if (s == NULL) return NULL;
+ tab_counter = countSegment(s, c);
+ if ((strs = (char**)CheckedMalloc(sizeof(char*) * (tab_counter + 1))) == NULL) return NULL;
+ tab_counter = 0;
+ j = -1;
+ while (s[++j]) {
+ if (s[j] == c) continue;
+ i = 0;
+ while (s[j + i] && s[j + i] != c) i++;
+ if ((strs[tab_counter++] = strndup(&s[j], i)) == NULL) return NULL;
+ j += i - 1;
+ }
+ strs[tab_counter] = NULL;
+ return strs;
+}
diff --git a/comp/lucas-standen-NEA/code/tokenizer/util.h b/comp/lucas-standen-NEA/code/tokenizer/util.h
index cbcbdfa..c25ebec 100644
--- a/comp/lucas-standen-NEA/code/tokenizer/util.h
+++ b/comp/lucas-standen-NEA/code/tokenizer/util.h
@@ -1,3 +1,10 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <error.h>
+
void Die(); // brings down the program
void *CheckedMalloc(long size); // malloc checked
void *CheckedRealloc(void *out, long size); // realloc checked
+char **Split(char *s, char c); // splits a string into an array of strings around c
diff --git a/comp/lucas-standen-NEA/writeup/coverpage.ms b/comp/lucas-standen-NEA/writeup/coverpage.ms
index 9e5fdc4..f99dd7f 100644
--- a/comp/lucas-standen-NEA/writeup/coverpage.ms
+++ b/comp/lucas-standen-NEA/writeup/coverpage.ms
@@ -788,6 +788,11 @@ set
let
+.NH 2
+Memory management
+.LP
+Memory will be allocated when a variable is initialized, and freed when the program stops.
+Although this isn't the fastest method, it is simple and has less runtime overhead.
.NH 2
Questionnaire 2 for Rayn M
@@ -824,7 +829,7 @@ elif
else
-terminate
+exit
return
@@ -871,7 +876,6 @@ Many build systems are available for C, the main ones being cmake and gnu make.
the goal of putting the compiling process in one command. Cmake is cross platform (sorta windows
doesn't work well but it does work).
-
.NH 3
Libraries
.LP
@@ -950,6 +954,32 @@ bits can be written in bash. It should be a good test to how Zippy can be writte
If time allows it is at this point that I will write a Raylib library and a unix/C sockets library.
+.NH 2
+Flow through the system
+.LP
+The alogrithum to run code is quite complex however it can be boiled down to a few simple steps:
+
+.B "read the text file (strip line breaks and tabs)"
+.B "create an empty linked list"
+.B "get the first expression from the text file (with be encapsulated with "()""
+.B "get the function call and its args into a token"
+.B "if the arguments of the function are there own function call, then convert them into a token"
+.B "set that token as the argument in the first token"
+.B "append the root token to the linked list"
+.B "repeat until the text file string is empty"
+.B "allocate memory for the program and prepare the exection step"
+.B "at the start of the linked list traverse to the bottem of the tree (made of tokens)"
+.B "execute the lowest token"
+.B "repeat until all tokens including the root have been executed"
+.B "move to the next node of the linked list"
+.B "repeat until the linked list is empty"
+
+Within each of these steps is many smaller steps. The hardest part will be making the tokens, as
+this requires alot of string manipultation. The execution will be a recursive alogrithum. All trees
+will be represented via structs (see section on AST's).
+
+PUT SOME FLOW CHARTS HERE
+
.NH 1
Technical Solution
.NH 1
diff --git a/comp/lucas-standen-NEA/writeup/coverpage.ps b/comp/lucas-standen-NEA/writeup/coverpage.ps
index bfa3e02..a5f55b6 100644
--- a/comp/lucas-standen-NEA/writeup/coverpage.ps
+++ b/comp/lucas-standen-NEA/writeup/coverpage.ps
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.23.0
-%%CreationDate: Tue Jun 4 13:46:06 2024
+%%CreationDate: Thu Jun 6 13:22:18 2024
%%DocumentNeededResources: font Times-Bold
%%+ font Times-Italic
%%+ font Times-Roman
@@ -52567,164 +52567,204 @@ F1 2.5(3.1.2.13. r)111 466.8 R(etur)-.18 E(n)-.15 E F0
the function, "a" must be of the functions return type.)111 506.4 Q F1
2.5(3.1.3. List)111 542.4 R(of k)2.5 E(eyw)-.1 E(ords)-.1 E F0(defun)111
558 Q(for)111 582 Q(while)111 606 Q(if)111 630 Q(elif)111 654 Q(else)111
-678 Q(terminate)111 702 Q(return)111 726 Q 0 Cg EP
+678 Q -.15(ex)111 702 S(it).15 E(return)111 726 Q 0 Cg EP
%%Page: 16 16
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF(-16-)297.67 48 Q(symbol)111 84 Q(set)111 108 Q
-(let)111 132 Q/F1 10/Times-Bold@0 SF 2.5(3.2. Questionnair)111 180 R 2.5
-(e2f)-.18 G(or Rayn M)-2.75 E 2.5(3.2.1. Ho)111 204 R 2.5(wd)-.1 G 2.5
-(oy)-2.5 G(ou \214nd this lay)-2.75 E(out of the language?)-.25 E/F2 10
-/Times-Italic@0 SF .745(\(5-6 points\))111.08 219.6 R F0 3.245(-Il)3.305
+(let)111 132 Q/F1 10/Times-Bold@0 SF 2.5(3.2. Memory)111 168 R
+(management)2.5 E F0 .54(Memory will be allocated when a v)111 183.6 R
+.54(ariable is initialized, and freed when the program stops.)-.25 F
+(Al-)5.54 E(though this isn')111 195.6 Q 2.5(tt)-.18 G(he f)-2.5 E
+(astest method, it is simple and has less runtime o)-.1 E -.15(ve)-.15 G
+(rhead.).15 E F1 2.5(3.3. Questionnair)111 231.6 R 2.5(e2f)-.18 G
+(or Rayn M)-2.75 E 2.5(3.3.1. Ho)111 255.6 R 2.5(wd)-.1 G 2.5(oy)-2.5 G
+(ou \214nd this lay)-2.75 E(out of the language?)-.25 E/F2 10
+/Times-Italic@0 SF .745(\(5-6 points\))111.08 271.2 R F0 3.245(-Il)3.305
G(ik)-3.245 E 3.245(et)-.1 G .745
(he immutable nature of the language - I lik)-3.245 F 3.245(et)-.1 G
.745(he simplicity - I lik)-3.245 F 3.245(et)-.1 G .745(he lo)-3.245 F
-(w)-.25 E(le)111 231.6 Q -.15(ve)-.25 G 3.283(lp).15 G .783
-(erformance this will ha)-3.283 F 1.083 -.15(ve - I d)-.2 H(islik).15 E
+(w)-.25 E(le)111 283.2 Q -.15(ve)-.25 G 3.284(lp).15 G .783
+(erformance this will ha)-3.284 F 1.083 -.15(ve - I d)-.2 H(islik).15 E
3.283(et)-.1 G .783(he w)-3.283 F .783(ord terminate - I lik)-.1 F 3.283
-(et)-.1 G .784(he procedural approach,)-3.283 F(with the function rob)
-111 243.6 Q(ustness - I dislik)-.2 E 2.5(et)-.1 G(he brack)-2.5 E(ets!)
--.1 E F1 2.5(3.2.2. Response)111 267.6 R F0 .104
-(Although he does dislik)111 283.2 R 2.603(es)-.1 G .103
+(et)-.1 G .783(he procedural approach,)-3.283 F(with the function rob)
+111 295.2 Q(ustness - I dislik)-.2 E 2.5(et)-.1 G(he brack)-2.5 E(ets!)
+-.1 E F1 2.5(3.3.2. Response)111 319.2 R F0 .103
+(Although he does dislik)111 334.8 R 2.603(es)-.1 G .103
(ome of my features I belie)-2.603 F .403 -.15(ve t)-.25 H .103
-(hem to be core parts of the language so I).15 F .862(will k)111 295.2 R
+(hem to be core parts of the language so I).15 F .863(will k)111 346.8 R
.863(eep them. I will also k)-.1 F .863
(eep his points in mind though, I don')-.1 F 3.363(tw)-.18 G .863
(ant to discourage learning)-3.463 F
-(the language due to its abstract syntax.)111 307.2 Q(Ho)111 331.2 Q(we)
+(the language due to its abstract syntax.)111 358.8 Q(Ho)111 382.8 Q(we)
-.25 E -.15(ve)-.25 G 2.5(ra).15 G 2.5(sp)-2.5 G
(er his request I will change the terminate k)-2.5 E -.15(ey)-.1 G -.1
(wo).15 G(rd to the more normal e).1 E(xit.)-.15 E(An updated k)111
-355.2 Q -.15(ey)-.1 G -.1(wo).15 G(rd list is as \215o).1 E(ws:)-.25 E
-(defun)111 379.2 Q(for)111 403.2 Q(while)111 427.2 Q(if)111 451.2 Q
-(elif)111 475.2 Q(else)111 499.2 Q(terminate)111 523.2 Q(return)111
-547.2 Q(symbol)111 571.2 Q(set)111 595.2 Q(let)111 619.2 Q F1 2.5
-(3.3. What)111 655.2 R(language do y)2.5 E(ou use to mak)-.25 E 2.5(eap)
+406.8 Q -.15(ey)-.1 G -.1(wo).15 G(rd list is as \215o).1 E(ws:)-.25 E
+(defun)111 430.8 Q(for)111 454.8 Q(while)111 478.8 Q(if)111 502.8 Q
+(elif)111 526.8 Q(else)111 550.8 Q -.15(ex)111 574.8 S(it).15 E(return)
+111 598.8 Q(symbol)111 622.8 Q(set)111 646.8 Q(let)111 670.8 Q F1 2.5
+(3.4. What)111 706.8 R(language do y)2.5 E(ou use to mak)-.25 E 2.5(eap)
-.1 G -.18(ro)-2.5 G(gramming language).18 E F0 .34
-(As mentioned before Zipp)111 670.8 R 2.84(yw)-.1 G .34
+(As mentioned before Zipp)111 722.4 R 2.84(yw)-.1 G .34
(ill be written in C, with some parts being written in Zipp)-2.84 F 2.84
-(yi)-.1 G 2.84(tself. I)-2.84 F(will try and k)111 682.8 Q
-(eep most dependencies/libraries to a minimal to mak)-.1 E 2.5(et)-.1 G
-(he project easier to manage.)-2.5 E F1 2.5(3.3.1. What)111 718.8 R
-(is C?)2.5 E 0 Cg EP
+(yi)-.1 G 2.84(tself. I)-2.84 F 0 Cg EP
%%Page: 17 17
%%BeginPageSetup
BP
%%EndPageSetup
-/F0 10/Times-Roman@0 SF(-17-)297.67 48 Q 3.026(Cw)111 84 S .526
-(as made by Dennis Ritchie, in 1972 at A)-3.126 F(T&T')-1.11 E 3.027(sb)
--.55 G .527(ell labs. It w)-3.027 F .527(as designed to mak)-.1 F 3.027
-(ep)-.1 G(rogram-)-3.027 E .068(ming lo)111 96 R 2.568(wl)-.25 G -2.15
--.25(ev e)-2.568 H 2.568(ls).25 G .068(ystems f)-2.568 F .067
-(ar easier than it had been before. It w)-.1 F .067
-(as used to create the unix operating)-.1 F .65(system which w)111 108 R
-.65(ould go on to inspire most modern operating systems in some w)-.1 F
-(ay)-.1 E 3.15(.\()-.65 G .65(macos still)-3.15 F
-(has code from the original release of C+unix\).)111 120 Q .377
+/F0 10/Times-Roman@0 SF(-17-)297.67 48 Q(will try and k)111 84 Q
+(eep most dependencies/libraries to a minimal to mak)-.1 E 2.5(et)-.1 G
+(he project easier to manage.)-2.5 E/F1 10/Times-Bold@0 SF 2.5
+(3.4.1. What)111 120 R(is C?)2.5 E F0 3.027(Cw)111 135.6 S .527
+(as made by Dennis Ritchie, in 1972 at A)-3.127 F(T&T')-1.11 E 3.026(sb)
+-.55 G .526(ell labs. It w)-3.026 F .526(as designed to mak)-.1 F 3.026
+(ep)-.1 G(rogram-)-3.026 E .067(ming lo)111 147.6 R 2.567(wl)-.25 G
+-2.15 -.25(ev e)-2.567 H 2.567(ls).25 G .067(ystems f)-2.567 F .067
+(ar easier than it had been before. It w)-.1 F .068
+(as used to create the unix operating)-.1 F .65(system which w)111 159.6
+R .65(ould go on to inspire most modern operating systems in some w)-.1
+F(ay)-.1 E 3.15(.\()-.65 G .65(macos still)-3.15 F
+(has code from the original release of C+unix\).)111 171.6 Q .377
(The language quickly caught on outside of bell labs after more a)111
-144 R -.25(va)-.2 G .377(ilable releases of unix arri).25 F -.15(ve)-.25
-G(d).15 E .102(such as bsd 4.4, sun os and GNU. It w)111 156 R .102
-(as found to be able to do all the things that you could do in)-.1 F
-(ASM ho)111 168 Q(we)-.25 E -.15(ve)-.25 G 2.5(rw).15 G(ith f)-2.5 E
-(ar less a headache.)-.1 E/F1 10/Times-Bold@0 SF 2.5(3.3.2. Wh)111 204 R
-2.5(yi)-.15 G 2.5(sC)-2.5 G(?)-2.5 E F0 .469(As mentioned C can do an)
-111 219.6 R .469(ything that ASM can do, meaning it is lightning f)-.15
-F .469(ast and can tak)-.1 F 2.968(ea)-.1 G(d-)-2.968 E -.25(va)111
-231.6 S .345(ntage of direct memory access. This allo).25 F .345
-(ws you to mak)-.25 F 2.845(ev)-.1 G .345(ery f)-2.995 F .345
-(ast lightweight e)-.1 F -.15(xe)-.15 G .345(cutables that).15 F .24
-(can ri)111 243.6 R -.25(va)-.25 G 2.74(lt).25 G .239(he performance of\
- handwritten ASM \(often beating it if you enable compiler optimisa-)
--2.74 F .158(tions\). It is this that mak)111 255.6 R .159
-(es C the perfect language for an)-.1 F 2.659(ya)-.15 G .159
-(nd all programming languages, where)-2.659 F(speed is k)111 267.6 Q
+195.6 R -.25(va)-.2 G .378(ilable releases of unix arri).25 F -.15(ve)
+-.25 G(d).15 E .102(such as bsd 4.4, sun os and GNU. It w)111 207.6 R
+.102(as found to be able to do all the things that you could do in)-.1 F
+(ASM ho)111 219.6 Q(we)-.25 E -.15(ve)-.25 G 2.5(rw).15 G(ith f)-2.5 E
+(ar less a headache.)-.1 E F1 2.5(3.4.2. Wh)111 255.6 R 2.5(yi)-.15 G
+2.5(sC)-2.5 G(?)-2.5 E F0 .469(As mentioned C can do an)111 271.2 R .469
+(ything that ASM can do, meaning it is lightning f)-.15 F .469
+(ast and can tak)-.1 F 2.969(ea)-.1 G(d-)-2.969 E -.25(va)111 283.2 S
+.345(ntage of direct memory access. This allo).25 F .345(ws you to mak)
+-.25 F 2.845(ev)-.1 G .345(ery f)-2.995 F .345(ast lightweight e)-.1 F
+-.15(xe)-.15 G .345(cutables that).15 F .239(can ri)111 295.2 R -.25(va)
+-.25 G 2.739(lt).25 G .239(he performance of handwritten ASM \(often be\
+ating it if you enable compiler optimisa-)-2.739 F .159
+(tions\). It is this that mak)111 307.2 R .159
+(es C the perfect language for an)-.1 F 2.659(ya)-.15 G .158
+(nd all programming languages, where)-2.659 F(speed is k)111 319.2 Q
-.15(ey)-.1 G 2.5(,a)-.5 G(nd allfeatures need to be a)-2.5 E -.25(va)
--.2 G(ilable are present.).25 E F1 2.5(3.3.3. Ho)111 303.6 R 2.5(wi)-.1
-G 2.5(sC)-2.5 G(?)-2.5 E F0 3.215(Ci)111 319.2 S 3.215(sc)-3.215 G .715
-(ompiled to ASM, the main compilers a)-3.215 F -.25(va)-.2 G .714
+-.2 G(ilable are present.).25 E F1 2.5(3.4.3. Ho)111 355.2 R 2.5(wi)-.1
+G 2.5(sC)-2.5 G(?)-2.5 E F0 3.214(Ci)111 370.8 S 3.214(sc)-3.214 G .714
+(ompiled to ASM, the main compilers a)-3.214 F -.25(va)-.2 G .715
(ilable are clang, gcc and MSVC, I will be using).25 F
-(gcc as it is generally standard in linux en)111 331.2 Q(vironments.)-.4
-E(Man)111 355.2 Q 2.708(yb)-.15 G .208(uild systems are a)-2.908 F -.25
+(gcc as it is generally standard in linux en)111 382.8 Q(vironments.)-.4
+E(Man)111 406.8 Q 2.709(yb)-.15 G .209(uild systems are a)-2.909 F -.25
(va)-.2 G .209(ilable for C, the main ones being cmak).25 F 2.709(ea)-.1
-G .209(nd gnu mak)-2.709 F .209(e. Both of them)-.1 F(ha)111 367.2 Q
-.852 -.15(ve t)-.2 H .551
+G .209(nd gnu mak)-2.709 F .208(e. Both of them)-.1 F(ha)111 418.8 Q
+.851 -.15(ve t)-.2 H .551
(he goal of putting the compiling process in one command. Cmak).15 F
-3.051(ei)-.1 G 3.051(sc)-3.051 G .551(ross platform \(sorta)-3.051 F
-(windo)111 379.2 Q(ws doesn')-.25 E 2.5(tw)-.18 G(ork well b)-2.6 E
-(ut it does w)-.2 E(ork\).)-.1 E F1 2.5(3.3.4. Libraries)111 427.2 R F0
-(The libraries I will use are the follo)111 442.8 Q(wing:)-.25 E 2.5(Cs)
-111 466.8 S(tdlib)-2.5 E 2.5(Cu)111 490.8 S(nistd)-2.5 E 2.5(Ce)111
-514.8 S(rrno)-2.5 E(Unix de)111 538.8 Q(vice \214les)-.25 E(Zipp)111
-562.8 Q 2.5(ys)-.1 G(trings)-2.5 E(Zipp)111 586.8 Q 2.5(yg)-.1 G(raphs)
--2.5 E(Zipp)111 610.8 Q 2.5(ys)-.1 G(orts)-2.5 E
-(Addition libraries \(may not be implemented\):)111 634.8 Q(Raylib)111
-658.8 Q 2.5(Cs)111 682.8 S(ock)-2.5 E(ets + Zipp)-.1 E 2.5(ys)-.1 G(ock)
--2.5 E(ets)-.1 E F1 2.5(3.3.5. Modularization)111 718.8 R 0 Cg EP
+3.052(ei)-.1 G 3.052(sc)-3.052 G .552(ross platform \(sorta)-3.052 F
+(windo)111 430.8 Q(ws doesn')-.25 E 2.5(tw)-.18 G(ork well b)-2.6 E
+(ut it does w)-.2 E(ork\).)-.1 E F1 2.5(3.4.4. Libraries)111 466.8 R F0
+(The libraries I will use are the follo)111 482.4 Q(wing:)-.25 E 2.5(Cs)
+111 506.4 S(tdlib)-2.5 E 2.5(Cu)111 530.4 S(nistd)-2.5 E 2.5(Ce)111
+554.4 S(rrno)-2.5 E(Unix de)111 578.4 Q(vice \214les)-.25 E(Zipp)111
+602.4 Q 2.5(ys)-.1 G(trings)-2.5 E(Zipp)111 626.4 Q 2.5(yg)-.1 G(raphs)
+-2.5 E(Zipp)111 650.4 Q 2.5(ys)-.1 G(orts)-2.5 E
+(Addition libraries \(may not be implemented\):)111 674.4 Q(Raylib)111
+698.4 Q 2.5(Cs)111 722.4 S(ock)-2.5 E(ets + Zipp)-.1 E 2.5(ys)-.1 G(ock)
+-2.5 E(ets)-.1 E 0 Cg EP
%%Page: 18 18
%%BeginPageSetup
BP
%%EndPageSetup
-/F0 10/Times-Roman@0 SF(-18-)297.67 48 Q 2.061 -.8(To m)111 84 T(ak).8 E
-2.961(et)-.1 G .461(he project more manageable I will split it into man)
--2.961 F 2.962(yC\214)-.15 G .462(les, this is to k)-2.962 F .462
-(eep it from be-)-.1 F(coming impossible to edit code.)111 96 Q
-(The \214le layout looks as follo)111 120 Q(ws:)-.25 E(PLA)111 144 Q
-(CE HERE)-.4 E .713(As you can see this is split up o)111 168 R -.15(ve)
--.15 G 3.213(ra).15 G .712
-(round 40 \214les and 16 folders, each \214le should not go o)-3.213 F
--.15(ve)-.15 G(r).15 E(~500 lines of code. This is to k)111 180 Q(eep e)
--.1 E -.15(ve)-.25 G(rything as easy to manage as possible.).15 E .561
-(This le)111 204 R -.15(ve)-.25 G 3.061(lo).15 G 3.062(fm)-3.061 G .562
-(odularization in needed for the de)-3.062 F -.15(ve)-.25 G .562
+/F0 10/Times-Roman@0 SF(-18-)297.67 48 Q/F1 10/Times-Bold@0 SF 2.5
+(3.4.5. Modularization)111 84 R F0 2.062 -.8(To m)111 99.6 T(ak).8 E
+2.962(et)-.1 G .462(he project more manageable I will split it into man)
+-2.962 F 2.961(yC\214)-.15 G .461(les, this is to k)-2.961 F .461
+(eep it from be-)-.1 F(coming impossible to edit code.)111 111.6 Q
+(The \214le layout looks as follo)111 135.6 Q(ws:)-.25 E(PLA)111 159.6 Q
+(CE HERE)-.4 E .712(As you can see this is split up o)111 183.6 R -.15
+(ve)-.15 G 3.212(ra).15 G .713
+(round 40 \214les and 16 folders, each \214le should not go o)-3.212 F
+-.15(ve)-.15 G(r).15 E(~500 lines of code. This is to k)111 195.6 Q
+(eep e)-.1 E -.15(ve)-.25 G(rything as easy to manage as possible.).15 E
+.562(This le)111 219.6 R -.15(ve)-.25 G 3.062(lo).15 G 3.062(fm)-3.062 G
+.562(odularization in needed for the de)-3.062 F -.15(ve)-.25 G .562
(lopment of Zipp).15 F 3.062(ya)-.1 G 3.062(sw)-3.062 G .562
-(ithout it, \214les will be-)-3.062 F(come a mess that can')111 216 Q
-2.5(tb)-.18 G 2.5(ew)-2.5 G(ork)-2.6 E(ed with.)-.1 E .042(All .c \214l\
+(ithout it, \214les will be-)-3.062 F(come a mess that can')111 231.6 Q
+2.5(tb)-.18 G 2.5(ew)-2.5 G(ork)-2.6 E(ed with.)-.1 E .041(All .c \214l\
es will be compiled into .o \214les, then the .o \214les can be link)111
-240 R .041(ed with the \214nal zp)-.1 F -.65(y.)-.1 G 2.541(ct).65 G
-2.541(og)-2.541 G(en-)-2.541 E(erate the \214nal e)111 252 Q -.15(xe)
--.15 G(cutable.).15 E/F1 10/Times-Bold@0 SF 2.5(3.3.5.1. Build)111 300 R
-(system)2.5 E F0 1.22(The entire project is being b)111 315.6 R 1.221
-(uild with GNU mak)-.2 F 3.721<658c>-.1 G 1.221(les, each folder that b)
--3.721 F 1.221(uilds something will)-.2 F(ha)111 327.6 Q 1.004 -.15
-(ve i)-.2 H .704(ts o).15 F .704(wn mak)-.25 F .703(e\214le. This will \
-mean the entire project can be compiled with a single mak)-.1 F 3.203
-(ei)-.1 G(n)-3.203 E(the root folder of the project.)111 339.6 Q
-(Example of mak)111 363.6 Q(e:)-.1 E(mak)111 387.6 Q 2.5(e-)-.1 G(j2)
--2.5 E(This will b)111 411.6 Q(uild all \214les speci\214ed by 'Mak)-.2
-E(e\214le' with 2 threads.)-.1 E .34(The project should be b)111 435.6 R
-.34(uild with gcc, and ld. It should be b)-.2 F .34(uild with the -O3 b)
--.2 F .34(uild \215ag to ensure)-.2 F(the program runs as f)111 447.6 Q
+255.6 R .042(ed with the \214nal zp)-.1 F -.65(y.)-.1 G 2.542(ct).65 G
+2.542(og)-2.542 G(en-)-2.542 E(erate the \214nal e)111 267.6 Q -.15(xe)
+-.15 G(cutable.).15 E F1 2.5(3.4.5.1. Build)111 315.6 R(system)2.5 E F0
+1.221(The entire project is being b)111 331.2 R 1.221(uild with GNU mak)
+-.2 F 3.721<658c>-.1 G 1.22(les, each folder that b)-3.721 F 1.22
+(uilds something will)-.2 F(ha)111 343.2 Q 1.003 -.15(ve i)-.2 H .703
+(ts o).15 F .703(wn mak)-.25 F .704(e\214le. This will mean the entire \
+project can be compiled with a single mak)-.1 F 3.204(ei)-.1 G(n)-3.204
+E(the root folder of the project.)111 355.2 Q(Example of mak)111 379.2 Q
+(e:)-.1 E(mak)111 403.2 Q 2.5(e-)-.1 G(j2)-2.5 E(This will b)111 427.2 Q
+(uild all \214les speci\214ed by 'Mak)-.2 E(e\214le' with 2 threads.)-.1
+E .34(The project should be b)111 451.2 R .34
+(uild with gcc, and ld. It should be b)-.2 F .34(uild with the -O3 b)-.2
+F .34(uild \215ag to ensure)-.2 F(the program runs as f)111 463.2 Q
(ast as possible. -O3 forces the compiler to b)-.1 E
(uild with optimizations.)-.2 E(When the project is \214nished, I will \
-try compiling with clang and tcc, to compare performance.)111 471.6 Q F1
-2.5(3.4. T)111 507.6 R(ime table)-.18 E F0 .174
-(The \214rst step is to tackle the interpreter)111 523.2 R 2.674(,s)-.4
+try compiling with clang and tcc, to compare performance.)111 487.2 Q F1
+2.5(3.5. T)111 523.2 R(ime table)-.18 E F0 .174
+(The \214rst step is to tackle the interpreter)111 538.8 R 2.674(,s)-.4
G 2.674(ot)-2.674 G .174(he zp)-2.674 F -.65(y.)-.1 G 2.674<638c>.65 G
-.174(le needs to be \214nished. The tok)-2.674 F(enizer)-.1 E 2.673(,e)
--.4 G -.15(xe)-2.823 G(-).15 E .598(cution, and libs folders need to be\
- \214nished, after this point you should be able to e)111 535.2 R -.15
-(xe)-.15 G .598(cute Zipp).15 F(y)-.1 E(code ho)111 547.2 Q(we)-.25 E
+.174(le needs to be \214nished. The tok)-2.674 F(enizer)-.1 E 2.674(,e)
+-.4 G -.15(xe)-2.824 G(-).15 E .598(cution, and libs folders need to be\
+ \214nished, after this point you should be able to e)111 550.8 R -.15
+(xe)-.15 G .597(cute Zipp).15 F(y)-.1 E(code ho)111 562.8 Q(we)-.25 E
-.15(ve)-.25 G 2.5(rn).15 G(ot syntax check it or get error handling.)
--2.5 E .125(The ne)111 571.2 R .125(xt step is zp)-.15 F .125
-(ycheck, the syntax and error handler)-.1 F 2.625(,t)-.4 G .124
-(his should be ran before code is shipped)-2.625 F(to the user)111 583.2
+-2.5 E .124(The ne)111 586.8 R .124(xt step is zp)-.15 F .125
+(ycheck, the syntax and error handler)-.1 F 2.625(,t)-.4 G .125
+(his should be ran before code is shipped)-2.625 F(to the user)111 598.8
Q 2.5(.I)-.55 G 2.5(tc)-2.5 G(an reuse a lot of code from the tok)-2.5 E
(enizer and e)-.1 E -.15(xe)-.15 G(cution steps.).15 E .716
-(Finally I need to mak)111 607.2 R 3.216(ez)-.1 G -.1(py)-3.216 G .716
+(Finally I need to mak)111 622.8 R 3.216(ez)-.1 G -.1(py)-3.216 G .716
(pkg, this should be easy as most of it can be written in Zipp).1 F
-2.016 -.65(y, a)-.1 H .716(nd a).65 F(fe)111 619.2 Q 2.5(wb)-.25 G
+2.016 -.65(y, a)-.1 H .716(nd a).65 F(fe)111 634.8 Q 2.5(wb)-.25 G
(its can be written in bash. It should be a good test to ho)-2.5 E 2.5
(wZ)-.25 G(ipp)-2.5 E 2.5(yc)-.1 G(an be written.)-2.5 E(If time allo)
-111 643.2 Q(ws it is at this point that I will write a Raylib library a\
-nd a unix/C sock)-.25 E(ets library)-.1 E(.)-.65 E F1 2.5(4. T)111 679.2
-R(echnical Solution)-.92 E 2.5(5. T)111 703.2 R(esting)-.92 E 2.5(6. Ev)
-111 727.2 R(aluation)-.1 E 0 Cg EP
+111 658.8 Q(ws it is at this point that I will write a Raylib library a\
+nd a unix/C sock)-.25 E(ets library)-.1 E(.)-.65 E F1 2.5(3.6. Flo)111
+694.8 R 2.5(wt)-.1 G(hr)-2.5 E(ough the system)-.18 E F0 1.403
+(The alogrithum to run code is quite comple)111 710.4 R 3.903(xh)-.15 G
+-.25(ow)-3.903 G -2.15 -.25(ev e).25 H 3.903(ri).25 G 3.903(tc)-3.903 G
+1.403(an be boiled do)-3.903 F 1.403(wn to a fe)-.25 F 3.903(ws)-.25 G
+(imple)-3.903 E(steps:)111 722.4 Q 0 Cg EP
%%Page: 19 19
%%BeginPageSetup
BP
%%EndPageSetup
-/F0 10/Times-Roman@0 SF(-19-)297.67 48 Q 0 Cg EP
+/F0 10/Times-Roman@0 SF(-19-)297.67 48 Q/F1 10/Times-Bold@0 SF -.18(re)
+111 84 S .263(ad the text \214le \(strip line br).18 F .263
+(eaks and tabs\) cr)-.18 F .263(eate an empty link)-.18 F .263
+(ed list get the \214rst expr)-.1 F(es-)-.18 E .026(sion fr)111 96 R
+.026(om the text \214le \(with be encapsulated with)-.18 F F0(\(\)"")
+2.526 E F1 .026(get the function call and its ar)2.526 F .027(gs into a)
+-.1 F(tok)111 108 Q .232(en if the ar)-.1 F .231
+(guments of the function ar)-.1 F 2.731(et)-.18 G(her)-2.731 E 2.731(eo)
+-.18 G .231(wn function call, then con)-2.831 F -.1(ve)-.4 G .231
+(rt them into a).1 F(tok)111 120 Q .585(en set that tok)-.1 F .585
+(en as the ar)-.1 F .585(gument in the \214rst tok)-.1 F .585
+(en append the r)-.1 F .586(oot tok)-.18 F .586(en to the link)-.1 F(ed)
+-.1 E .717(list r)111 132 R .717
+(epeat until the text \214le string is empty allocate memory f)-.18 F
+.716(or the pr)-.25 F .716(ogram and pr)-.18 F(epar)-.18 E(e)-.18 E .17
+(the exection step at the start of the link)111 144 R .17(ed list tra)
+-.1 F -.1(ve)-.25 G .17(rse to the bottem of the tr).1 F .17
+(ee \(made of to-)-.18 F -.1(ke)111 156 S .28(ns\) execute the lo).1 F
+.28(west tok)-.1 F .279(en r)-.1 F .279(epeat until all tok)-.18 F .279
+(ens including the r)-.1 F .279(oot ha)-.18 F .479 -.1(ve b)-.25 H .279
+(een executed).1 F(mo)111 168 Q .2 -.1(ve t)-.1 H 2.5(ot).1 G
+(he next node of the link)-2.5 E(ed list r)-.1 E(epeat until the link)
+-.18 E(ed list is empty)-.1 E F0 -.4(Wi)111 192 S .482
+(thin each of these steps is man).4 F 2.982(ys)-.15 G .483
+(maller steps. The hardest part will be making the tok)-2.982 F .483
+(ens, as)-.1 F .45(this requires alot of string manipultation. The e)111
+204 R -.15(xe)-.15 G .45(cution will be a recursi).15 F .75 -.15(ve a)
+-.25 H .45(logrithum. All trees).15 F
+(will be represented via structs \(see section on AST')111 216 Q(s\).)
+-.55 E(PUT SOME FLO)111 240 Q 2.5(WC)-.35 G(HAR)-2.5 E(TS HERE)-.6 E F1
+2.5(4. T)111 276 R(echnical Solution)-.92 E 2.5(5. T)111 300 R(esting)
+-.92 E 2.5(6. Ev)111 324 R(aluation)-.1 E 0 Cg EP
%%Trailer
end
%%EOF
diff --git a/comp/lucas-standen-NEA/writeup/questions-for-amy.ps b/comp/lucas-standen-NEA/writeup/questions-for-amy.ps
index a026158..9644dca 100644
--- a/comp/lucas-standen-NEA/writeup/questions-for-amy.ps
+++ b/comp/lucas-standen-NEA/writeup/questions-for-amy.ps
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.23.0
-%%CreationDate: Tue Jun 4 13:46:08 2024
+%%CreationDate: Thu Jun 6 13:22:20 2024
%%DocumentNeededResources: font Times-Bold
%%+ font Times-Roman
%%DocumentSuppliedResources: procset grops 1.23 0