Skip to content

Commit

Permalink
Fix long-standing typo: mkuastunary
Browse files Browse the repository at this point in the history
Should be mkastunary.
  • Loading branch information
Warren Toomey committed Jan 12, 2020
1 parent 9c39a28 commit 669bccf
Show file tree
Hide file tree
Showing 269 changed files with 723 additions and 723 deletions.
2 changes: 1 addition & 1 deletion 02_Parser/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}
// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, intvalue));
```

Expand Down
2 changes: 1 addition & 1 deletion 02_Parser/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ int scan(struct token *t);
struct ASTnode *mkastnode(int op, struct ASTnode *left,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int intvalue);
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *binexpr(void);
int interpretAST(struct ASTnode *n);
2 changes: 1 addition & 1 deletion 02_Parser/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, intvalue));
}
2 changes: 1 addition & 1 deletion 03_Precedence/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ int scan(struct token *t);
struct ASTnode *mkastnode(int op, struct ASTnode *left,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int intvalue);
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *binexpr(int rbp);
int interpretAST(struct ASTnode *n);
2 changes: 1 addition & 1 deletion 03_Precedence/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, intvalue));
}
2 changes: 1 addition & 1 deletion 04_Assembly/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ int scan(struct token *t);
struct ASTnode *mkastnode(int op, struct ASTnode *left,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int intvalue);
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *binexpr(int rbp);

int interpretAST(struct ASTnode *n);
Expand Down
2 changes: 1 addition & 1 deletion 04_Assembly/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, intvalue));
}
2 changes: 1 addition & 1 deletion 05_Statements/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int scan(struct token *t);
struct ASTnode *mkastnode(int op, struct ASTnode *left,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int intvalue);
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue);

// gen.c
int genAST(struct ASTnode *n);
Expand Down
2 changes: 1 addition & 1 deletion 05_Statements/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, intvalue));
}
2 changes: 1 addition & 1 deletion 06_Variables/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int scan(struct token *t);
struct ASTnode *mkastnode(int op, struct ASTnode *left,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int intvalue);
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue);

// gen.c
int genAST(struct ASTnode *n, int reg);
Expand Down
2 changes: 1 addition & 1 deletion 06_Variables/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, intvalue));
}
2 changes: 1 addition & 1 deletion 07_Comparisons/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int scan(struct token *t);
struct ASTnode *mkastnode(int op, struct ASTnode *left,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int intvalue);
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue);

// gen.c
int genAST(struct ASTnode *n, int reg);
Expand Down
2 changes: 1 addition & 1 deletion 07_Comparisons/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, intvalue));
}
2 changes: 1 addition & 1 deletion 08_If_Statements/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct ASTnode *mkastnode(int op, struct ASTnode *left,
struct ASTnode *mid,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int intvalue);
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue);

// gen.c
int genAST(struct ASTnode *n, int reg, int parentASTop);
Expand Down
2 changes: 1 addition & 1 deletion 08_If_Statements/stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static struct ASTnode *print_statement(void) {
tree = binexpr(0);

// Make an print AST tree
tree = mkuastunary(A_PRINT, tree, 0);
tree = mkastunary(A_PRINT, tree, 0);

// Match the following semicolon
// and return the AST
Expand Down
2 changes: 1 addition & 1 deletion 08_If_Statements/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, NULL, intvalue));
}
2 changes: 1 addition & 1 deletion 09_While_Loops/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct ASTnode *mkastnode(int op, struct ASTnode *left,
struct ASTnode *mid,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int intvalue);
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue);

// gen.c
int genAST(struct ASTnode *n, int reg, int parentASTop);
Expand Down
2 changes: 1 addition & 1 deletion 09_While_Loops/stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static struct ASTnode *print_statement(void) {
tree = binexpr(0);

// Make an print AST tree
tree = mkuastunary(A_PRINT, tree, 0);
tree = mkastunary(A_PRINT, tree, 0);

// Match the following semicolon
// and return the AST
Expand Down
2 changes: 1 addition & 1 deletion 09_While_Loops/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, NULL, intvalue));
}
2 changes: 1 addition & 1 deletion 10_For_Loops/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct ASTnode *mkastnode(int op, struct ASTnode *left,
struct ASTnode *mid,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int intvalue);
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue);

// gen.c
int genAST(struct ASTnode *n, int reg, int parentASTop);
Expand Down
2 changes: 1 addition & 1 deletion 10_For_Loops/stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static struct ASTnode *print_statement(void) {
tree = binexpr(0);

// Make an print AST tree
tree = mkuastunary(A_PRINT, tree, 0);
tree = mkastunary(A_PRINT, tree, 0);

// Return the AST
return (tree);
Expand Down
2 changes: 1 addition & 1 deletion 10_For_Loops/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, NULL, intvalue));
}
4 changes: 2 additions & 2 deletions 11_Functions_pt1/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct ASTnode *function_declaration(void) {
// Return an A_FUNCTION node which has the function's nameslot
// and the compound statement sub-tree
return(mkuastunary(A_FUNCTION, tree, nameslot));
return(mkastunary(A_FUNCTION, tree, nameslot));
}
```

Expand Down Expand Up @@ -99,7 +99,7 @@ this is a *unary* AST node with a single child:
```
// Return an A_FUNCTION node which has the function's nameslot
// and the compound statement sub-tree
return(mkuastunary(A_FUNCTION, tree, nameslot));
return(mkastunary(A_FUNCTION, tree, nameslot));
```

The child has the sub-tree which holds the compound statement that
Expand Down
2 changes: 1 addition & 1 deletion 11_Functions_pt1/decl.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ struct ASTnode *function_declaration(void) {

// Return an A_FUNCTION node which has the function's nameslot
// and the compound statement sub-tree
return(mkuastunary(A_FUNCTION, tree, nameslot));
return(mkastunary(A_FUNCTION, tree, nameslot));
}
2 changes: 1 addition & 1 deletion 11_Functions_pt1/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct ASTnode *mkastnode(int op, struct ASTnode *left,
struct ASTnode *mid,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int intvalue);
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue);
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue);

// gen.c
int genAST(struct ASTnode *n, int reg, int parentASTop);
Expand Down
2 changes: 1 addition & 1 deletion 11_Functions_pt1/stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static struct ASTnode *print_statement(void) {
tree = binexpr(0);

// Make an print AST tree
tree = mkuastunary(A_PRINT, tree, 0);
tree = mkastunary(A_PRINT, tree, 0);

// Return the AST
return (tree);
Expand Down
2 changes: 1 addition & 1 deletion 11_Functions_pt1/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ struct ASTnode *mkastleaf(int op, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, struct ASTnode *left, int intvalue) {
struct ASTnode *mkastunary(int op, struct ASTnode *left, int intvalue) {
return (mkastnode(op, left, NULL, NULL, intvalue));
}
8 changes: 4 additions & 4 deletions 12_Types_pt1/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ I've modified the code in `binexpr()` in `expr.c` to do this:
// Widen either side if required. type vars are A_WIDEN now
if (lefttype)
left = mkuastunary(lefttype, right->type, left, 0);
left = mkastunary(lefttype, right->type, left, 0);
if (righttype)
right = mkuastunary(righttype, left->type, right, 0);
right = mkastunary(righttype, left->type, right, 0);
// Join that sub-tree with ours. Convert the token
// into an AST operation at the same time.
Expand Down Expand Up @@ -320,7 +320,7 @@ static struct ASTnode *print_statement(void) {
fatal("Incompatible types");
// Widen the tree if required.
if (righttype) tree = mkuastunary(righttype, P_INT, tree, 0);
if (righttype) tree = mkastunary(righttype, P_INT, tree, 0);
```

## Using `type_compatible()` to Assign to a Variable
Expand Down Expand Up @@ -352,7 +352,7 @@ static struct ASTnode *assignment_statement(void) {
// Widen the left if required.
if (lefttype)
left = mkuastunary(lefttype, right->type, left, 0);
left = mkastunary(lefttype, right->type, left, 0);
```

Note the 1 at the the end to this call to `type_compatible()`.
Expand Down
2 changes: 1 addition & 1 deletion 12_Types_pt1/decl.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ struct ASTnode *function_declaration(void) {

// Return an A_FUNCTION node which has the function's nameslot
// and the compound statement sub-tree
return (mkuastunary(A_FUNCTION, P_VOID, tree, nameslot));
return (mkastunary(A_FUNCTION, P_VOID, tree, nameslot));
}
2 changes: 1 addition & 1 deletion 12_Types_pt1/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct ASTnode *mkastnode(int op, int type,
struct ASTnode *mid,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int type, int intvalue);
struct ASTnode *mkuastunary(int op, int type,
struct ASTnode *mkastunary(int op, int type,
struct ASTnode *left, int intvalue);

// gen.c
Expand Down
4 changes: 2 additions & 2 deletions 12_Types_pt1/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ struct ASTnode *binexpr(int ptp) {

// Widen either side if required. type vars are A_WIDEN now
if (lefttype)
left = mkuastunary(lefttype, right->type, left, 0);
left = mkastunary(lefttype, right->type, left, 0);
if (righttype)
right = mkuastunary(righttype, left->type, right, 0);
right = mkastunary(righttype, left->type, right, 0);

// Join that sub-tree with ours. Convert the token
// into an AST operation at the same time.
Expand Down
6 changes: 3 additions & 3 deletions 12_Types_pt1/stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ static struct ASTnode *print_statement(void) {

// Widen the tree if required.
if (righttype)
tree = mkuastunary(righttype, P_INT, tree, 0);
tree = mkastunary(righttype, P_INT, tree, 0);

// Make an print AST tree
tree = mkuastunary(A_PRINT, P_NONE, tree, 0);
tree = mkastunary(A_PRINT, P_NONE, tree, 0);

// Return the AST
return (tree);
Expand Down Expand Up @@ -80,7 +80,7 @@ static struct ASTnode *assignment_statement(void) {

// Widen the left if required.
if (lefttype)
left = mkuastunary(lefttype, right->type, left, 0);
left = mkastunary(lefttype, right->type, left, 0);

// Make an assignment AST tree
tree = mkastnode(A_ASSIGN, P_INT, left, NULL, right, 0);
Expand Down
2 changes: 1 addition & 1 deletion 12_Types_pt1/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct ASTnode *mkastleaf(int op, int type, int intvalue) {
}

// Make a unary AST node: only one child
struct ASTnode *mkuastunary(int op, int type, struct ASTnode *left,
struct ASTnode *mkastunary(int op, int type, struct ASTnode *left,
int intvalue) {
return (mkastnode(op, type, left, NULL, NULL, intvalue));
}
6 changes: 3 additions & 3 deletions 13_Functions_pt2/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct ASTnode *funccall(void) {
// Build the function call AST node. Store the
// function's return type as this node's type.
// Also record the function's symbol-id
tree = mkuastunary(A_FUNCCALL, Gsym[id].type, tree, id);
tree = mkastunary(A_FUNCCALL, Gsym[id].type, tree, id);
// Get the ')'
rparen();
Expand Down Expand Up @@ -253,10 +253,10 @@ static struct ASTnode *return_statement(void) {
// Widen the left if required.
if (returntype)
tree = mkuastunary(returntype, functype, tree, 0);
tree = mkastunary(returntype, functype, tree, 0);
// Add on the A_RETURN node
tree = mkuastunary(A_RETURN, P_NONE, tree, 0);
tree = mkastunary(A_RETURN, P_NONE, tree, 0);
// Get the ')'
rparen();
Expand Down
2 changes: 1 addition & 1 deletion 13_Functions_pt2/decl.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ struct ASTnode *function_declaration(void) {
}
// Return an A_FUNCTION node which has the function's nameslot
// and the compound statement sub-tree
return (mkuastunary(A_FUNCTION, type, tree, nameslot));
return (mkastunary(A_FUNCTION, type, tree, nameslot));
}
2 changes: 1 addition & 1 deletion 13_Functions_pt2/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct ASTnode *mkastnode(int op, int type,
struct ASTnode *mid,
struct ASTnode *right, int intvalue);
struct ASTnode *mkastleaf(int op, int type, int intvalue);
struct ASTnode *mkuastunary(int op, int type,
struct ASTnode *mkastunary(int op, int type,
struct ASTnode *left, int intvalue);

// gen.c
Expand Down
6 changes: 3 additions & 3 deletions 13_Functions_pt2/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct ASTnode *funccall(void) {
// Build the function call AST node. Store the
// function's return type as this node's type.
// Also record the function's symbol-id
tree = mkuastunary(A_FUNCCALL, Gsym[id].type, tree, id);
tree = mkastunary(A_FUNCCALL, Gsym[id].type, tree, id);

// Get the ')'
rparen();
Expand Down Expand Up @@ -139,9 +139,9 @@ struct ASTnode *binexpr(int ptp) {

// Widen either side if required. type vars are A_WIDEN now
if (lefttype)
left = mkuastunary(lefttype, right->type, left, 0);
left = mkastunary(lefttype, right->type, left, 0);
if (righttype)
right = mkuastunary(righttype, left->type, right, 0);
right = mkastunary(righttype, left->type, right, 0);

// Join that sub-tree with ours. Convert the token
// into an AST operation at the same time.
Expand Down
Loading

0 comments on commit 669bccf

Please sign in to comment.