* roottypes.cs: Rename from tree.cs.
[mono.git] / mono / monoburg / monoburg.h
1 #ifndef __MONO_MONOBURG_H__
2 #define __MONO_MONOBURG_H__
3
4 #include <glib.h>
5
6 void yyerror (char *fmt, ...);
7 int  yylex   (void);
8
9 extern FILE *inputfd;
10 extern FILE *outputfd;
11 extern GHashTable *definedvars;
12
13 typedef struct _Rule Rule;
14
15 typedef struct _Term Term;
16 struct _Term{
17         char *name;
18         int number;
19         int arity;
20         GList *rules; /* rules that start with this terminal */
21 };
22
23 typedef struct _NonTerm NonTerm;
24
25 struct _NonTerm {
26         char *name;
27         int number;
28         GList *rules; /* rules with this nonterm on the left side */
29         GList *chain;
30         gboolean reached;
31 };
32
33 typedef struct _Tree Tree;
34
35 struct _Tree {
36         Term *op;
37         Tree *left;
38         Tree *right;
39         NonTerm *nonterm; /* used by chain rules */
40 };
41
42 struct _Rule {
43         NonTerm *lhs;
44         Tree *tree;
45         char *code;
46         char *cost;
47         char *cfunc;
48 };
49
50
51 Tree    *create_tree    (char *id, Tree *left, Tree *right);
52
53 Term    *create_term    (char *id, int num);
54
55 void     create_term_prefix (char *id);
56
57 NonTerm *nonterm        (char *id);
58
59 void     start_nonterm  (char *id);
60
61 Rule    *make_rule      (char *id, Tree *tree);
62
63 void     rule_add       (Rule *rule, char *code, char *cost, char *cfunc);
64
65 void     create_rule    (char *id, Tree *tree, char *code, char *cost, 
66                          char *cfunc);
67
68 void     yyparsetail    (void);
69
70 void     reset_parser (void);
71
72 #endif