Added tokens to fit specification.
[Jack-Compiler.git] / parse.h
blob934a05ec045097bb755d3851259a17fab0638168
1 #ifndef PARSE_H_
2 #define PARSE_H_
4 #include "token.h"
6 extern char *pS;
7 extern char *pC;
8 extern char pT[];
9 extern token tk;
10 extern ttype ttyp;
13 * Compiles a complete class.
15 void parse_class();
18 * Compiles a static declaration or a field declaration.
20 void parse_class_var_dec();
23 * Compiles a complete method, function or constructor.
25 void parse_subroutine();
28 * Compiles a (possibly empty) parameter list.
29 * Skips over the parentheses.
31 void parse_params();
34 * Compiles a variable declaration.
36 void parse_var_dec();
39 * Compiles a sequence of statements.
40 * Skips over opening and closing braces.
42 void parse_statements();
45 * Compiles do statement.
47 void parse_do();
50 * Compiles let statement.
52 void parse_let();
55 * Compiles while statement.
57 void parse_while();
60 * Compiles return statement.
62 void parse_return();
65 * Compiles an if statement, possibly including an else statement.
67 void parse_if();
70 * Compiles and expression.
72 void parse_expression();
75 * Compiles a term.
76 * Must determine if if current token is an identifier and must
77 * distinguish between a variable, array entry or a subroutine call.
78 * The three tokens "[", "(" and "." determine the option.
79 * Any other token is not part of this term and should not be advanced over.
81 void parse_term();
84 * Compiles a call to a defined subroutine.
86 void parse_subroutine_call();
89 * Compiles a (possibly empty) comma-separated list of expressions.
91 void parse_expr_lst();
93 #endif