Expression tokens print correctly.
[Jack-Compiler.git] / parse.h
blobba3178ca64855f347f56a9a5a2b7159055617a61
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;
11 extern int space_count;
14 * Compiles a complete class.
16 void parse_class();
19 * Compiles a static declaration or a field declaration.
21 void parse_class_var_dec();
24 * Compiles a complete method, function or constructor.
26 void parse_subroutine();
29 * Compiles a (possibly empty) parameter list.
30 * Skips over the parentheses.
32 void parse_params();
35 * Compiles a variable declaration.
37 void parse_var_dec();
40 * Compiles a sequence of statements.
41 * Skips over opening and closing braces.
43 void parse_statements();
46 * Compiles do statement.
48 void parse_do();
51 * Compiles let statement.
53 void parse_let();
56 * Compiles while statement.
58 void parse_while();
61 * Compiles return statement.
63 void parse_return();
66 * Compiles an if statement, possibly including an else statement.
68 void parse_if();
71 * Compiles and expression.
73 void parse_expression(int count);
76 * Compiles a term.
77 * Must determine if if current token is an identifier and must
78 * distinguish between a variable, array entry or a subroutine call.
79 * The three tokens "[", "(" and "." determine the option.
80 * Any other token is not part of this term and should not be advanced over.
82 void parse_term();
85 * Compiles a call to a defined subroutine.
87 void parse_subroutine_call();
90 * Compiles a (possibly empty) comma-separated list of expressions.
92 void parse_expr_lst();
94 #endif