1 /* $Id: parser.h,v 1.4 1994/06/24 11:14:33 ceriel Exp $ */
5 /* type of arguments expected by each instruction */
14 #define IDF_TYPE struct id_info
16 struct idf *nextidf; /* chain all opcodes together */
17 int used; /* is this op used? */
18 int startpatt; /* does it start a pattern? */
19 int opcode; /* opcode of operator */
20 int argfmt; /* how to access pattern argument */
21 #define id_nextidf id_user.nextidf
22 #define id_used id_user.used
23 #define id_startpatt id_user.startpatt
24 #define id_opcode id_user.opcode
25 #define id_argfmt id_user.argfmt
27 #include <idf_pkg.spec>
33 struct exp_node *left;
34 struct exp_node *right;
38 #define exp_left node_args.interior.left
39 #define exp_right node_args.interior.right
40 #define leaf_val node_args.val
45 struct exp_node *arg; /* optional arg expression if replacement */
49 struct mnem_list *next; /* cdr of list */
50 struct mnem_elem *elem; /* car of list */
54 int m_len; /* number of mnem's in pattern */
55 struct mnem_elem **m_elems; /* array of mnem's */
59 struct action *next; /* chain all actions for same state together */
60 int linenum; /* line number in patterns */
61 struct exp_node *test; /* test expression (if any) */
62 struct mnems replacement; /* replacement pattern */
66 struct state *next; /* chain to next entry for this state */
67 struct idf *op; /* transition on op to.. */
68 int goto_state; /* state 'goto_state' */
71 #define MAXSTATES 2000
75 extern struct state *states[MAXSTATES];
76 extern struct action *actions[MAXSTATES];
77 extern struct mnems patterns[MAXSTATES];
78 extern int numpatterns; /* Number of patterns */
79 extern int higheststate; /* Highest state yet allocated */
80 extern struct idf *ops; /* Chained list of all ops */
81 extern int maxpattern;
82 extern int maxreplacement;
86 /* Lexical analyser globals */
87 extern struct idf *opval; /* opcode of returned OPCODE*/
88 extern int lastintval; /* value of last integer seen */
89 extern int linenum; /*line number of input file*/
91 /* Functions not returning int */
93 struct exp_node *mknode();
94 struct exp_node *mkleaf();
95 struct exp_node *combinetests();
96 struct mnem_list *addelem();
97 struct mnem_elem **constructlist();