comparison tests/agcl/examples/good/ct.h @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 #ifndef CT_H
2 #define CT_H
3
4 typedef union {
5 long alignment;
6 char ag_vt_2[sizeof(int)];
7 char ag_vt_4[sizeof(token_id)];
8 } ct_vs_type;
9
10 typedef enum {
11 ct_grammar_token = 1, ct_token_token, ct_eof_token, ct_name_string_token,
12 ct_qualified_real_token, ct_integer_constant_token,
13 ct_string_literal_token, ct_character_constant_token, ct_operator_token,
14 ct_punctuation_token, ct_real_constant_token = 25,
15 ct_floating_qualifier_token, ct_real_token, ct_simple_real_token = 30,
16 ct_exponent_token, ct_confusion_token, ct_decimal_integer_token,
17 ct_octal_integer_token, ct_octal_constant_token = 39,
18 ct_decimal_constant_token, ct_hex_constant_token,
19 ct_integer_qualifier_token, ct_hex_integer_token = 45,
20 ct_hex_digit_token = 47, ct_string_chars_token = 50,
21 ct_string_char_token = 52, ct_simple_chars_token = 56,
22 ct_simple_char_token = 58, ct_letter_token
23 } ct_token_type;
24
25 typedef struct ct_pcb_struct{
26 ct_token_type token_number, reduction_token, error_frame_token;
27 int input_code;
28 int input_value;
29 int line, column;
30 int ssx, sn, error_frame_ssx;
31 int drt, dssx, dsn;
32 int ss[128];
33 ct_vs_type vs[128];
34 int ag_ap;
35 const char *error_message;
36 char read_flag;
37 char exit_flag;
38 int bts[128], btsx;
39 unsigned char * pointer;
40 unsigned char * la_ptr;
41 } ct_pcb_type;
42
43 #ifndef PRULE_CONTEXT
44 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx]))
45 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx])
46 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx])
47 #endif
48
49 #ifndef AG_RUNNING_CODE
50 /* PCB.exit_flag values */
51 #define AG_RUNNING_CODE 0
52 #define AG_SUCCESS_CODE 1
53 #define AG_SYNTAX_ERROR_CODE 2
54 #define AG_REDUCTION_ERROR_CODE 3
55 #define AG_STACK_ERROR_CODE 4
56 #define AG_SEMANTIC_ERROR_CODE 5
57 #endif
58
59 extern ct_pcb_type ct_pcb;
60 void init_ct(void);
61 void ct(void);
62
63 token_id ct_value(void);
64 #endif
65