-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser.h
61 lines (34 loc) · 1.22 KB
/
parser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef PARSER_H
#define PARSER_H
#include "common.h"
#include "hash-table/hash_table.h"
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
tokens_t parse_token(char token);
void p_print_token(tokens_t token);
void p_print_astNode_type(AstNode *n);
void print_ast(AstNode *node);
bool is_variable(char token);
char peek(FILE *in);
void peek_print(FILE *in, int n);
void consume(tokens_t t, FILE *in, char *expected);
AstNode *create_variable(char *name, char *type);
AstNode *create_application(AstNode *function, AstNode *argument);
AstNode *create_lambda(char *variable, AstNode *body, char *type);
char *alpha_convert(char *old);
bool is_used(HashTable *table, char *variable);
void parse_space_chars(FILE *in);
AstNode *parse_lambda(HashTable *table, FILE *in);
AstNode *parse_expression(HashTable *table, FILE *in);
void parse_import(HashTable *table, FILE *in);
void parse_definition(HashTable *table, FILE *in);
bool is_uppercase(char c);
void parse_type_definition(HashTable *types_table, FILE *in);
char *parse_type(HashTable *types_table, FILE *in);
char *parse_variable(FILE *in);
void expect(char *expected, char received);
void free_ast(AstNode *node);
#endif