comparison anagram/agcore/pgg24.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 5581ef01f993
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 #ifndef PGG24_H_1198348407
2 #define PGG24_H_1198348407
3
4 typedef union {
5 long alignment;
6 char ag_vt_2[sizeof(int)];
7 char ag_vt_4[sizeof(CharSetExpression *)];
8 char ag_vt_5[sizeof(unsigned char *)];
9 } pgg_vs_type;
10
11 typedef enum {
12 pgg_arrow_token = 1, pgg_blank_token = 3, pgg_comma_token = 6,
13 pgg_space_token = 8, pgg_ellipsis_token = 10, pgg_equals_token = 12,
14 pgg_bang_token = 14, pgg_left_brace_token = 16,
15 pgg_left_bracket_token = 18, pgg_left_parenthesis_token = 20,
16 pgg_minus_token = 22, pgg_plus_token = 24, pgg_right_bracket_token = 26,
17 pgg_right_brace_token = 28, pgg_right_parenthesis_token = 30,
18 pgg_right_quote_token = 32, pgg_single_quote_token, pgg_tilde_token,
19 pgg_vertical_bar_token = 36, pgg_syntax_definition_token = 38,
20 pgg_end_of_line_token, pgg_statement_list_token = 41, pgg_statement_token,
21 pgg_eof_token = 45, pgg_production_token, pgg_definition_token,
22 pgg_embedded_c_token, pgg_configuration_section_token,
23 pgg_simple_statement_token, pgg_comment_token,
24 pgg_left_hand_side_token = 53, pgg_right_hand_side_token,
25 pgg_additional_rule_spec_token, pgg_rule_specs_token = 57,
26 pgg_token_name_list_token, pgg_type_definition_token,
27 pgg_token_name_token, pgg_symbol_name_token, pgg_data_type_token = 63,
28 pgg_wrapper_type_token, pgg_wrapper_list_token, pgg_wrappers_token,
29 pgg_list_end_token, pgg_proper_vp_rule_specs_token,
30 pgg_vp_rule_spec_token, pgg_additional_vp_rule_spec_token,
31 pgg_vp_rule_specs_token, pgg_empty_vp_rule_token,
32 pgg_proper_reduction_procedure_token, pgg_vp_rules_token,
33 pgg_grammar_rule_token, pgg_reduction_procedure_token,
34 pgg_rule_spec_token, pgg_init_grammar_rule_token, pgg_rule_element_token,
35 pgg_parameter_name_token, pgg_c_expression_token,
36 pgg_type_name_token = 83, pgg_template_field_token,
37 pgg_abstract_declarator_token = 86, pgg_indirect_data_type_token = 90,
38 pgg_direct_abstract_declarator_token, pgg_template_field_head_token,
39 pgg_star_token = 96, pgg_pointer_token = 98, pgg_name_string_token,
40 pgg_letter_token, pgg_enum_fix_token = 102, pgg_blank_char_token = 104,
41 pgg_c_comment_token, pgg_continuation_token, pgg_next_line_token,
42 pgg_carriage_return_token, pgg_newline_token = 110, pgg_white_token,
43 pgg_vertical_space_token, pgg_character_token = 117,
44 pgg_signed_number_token, pgg_quoted_character_token = 121,
45 pgg_char_const_token, pgg_sign_token, pgg_simple_number_token,
46 pgg_decimal_number_token = 126, pgg_octal_number_token,
47 pgg_hex_number_token = 131, pgg_hex_digit_token = 136,
48 pgg_token_token = 138, pgg_immediate_action_token, pgg_set_union_token,
49 pgg_virtual_production_token, pgg_set_intersection_token,
50 pgg_set_difference_token, pgg_set_complement_token,
51 pgg_character_set_token = 146, pgg_escape_sequence_token = 148,
52 pgg_octal_escape_token, pgg_three_octal_token, pgg_hex_escape_token,
53 pgg_character_range_token, pgg_any_character_token,
54 pgg_proc_def_token = 155, pgg_enum_definition_token,
55 pgg_enum_statement_token, pgg_keyword_string_token,
56 pgg_keyword_string_head_token, pgg_string_token, pgg_double_quote_token,
57 pgg_string_A_token, pgg_string_B_token, pgg_string_C_token,
58 pgg_string_char_token, pgg_simple_string_char_token,
59 pgg_one_octal_token = 178, pgg_backslash_token, pgg_two_octal_token,
60 pgg_any_digit_token = 182, pgg_nonoctal_digit_token,
61 pgg_c_name_token = 185, pgg_simple_name_token,
62 pgg_configuration_parameters_token,
63 pgg_configuration_parameter_list_token,
64 pgg_configuration_parameter_token = 190, pgg_attribute_statement_token,
65 pgg_keyword_kluge_token, pgg_token_list_token = 195,
66 pgg_new_reserve_statement_token = 201, pgg_macro_name_token = 210,
67 pgg_tokens_token = 213, pgg_embedded_c_head_token = 220, pgg_c_code_token,
68 pgg_c_code_first_token = 225, pgg_c_text_token,
69 pgg_c_character_constant_token = 228, pgg_c_string_constant_token,
70 pgg_c_char_token, pgg_simple_c_char_token, pgg_c_expression_head_token,
71 pgg_c_chars_token, pgg_c_expression_char_token,
72 pgg_c_comment_head_token = 237, pgg_c_literal_elem_token = 241,
73 pgg_anything_token
74 } pgg_token_type;
75
76 typedef struct pgg_pcb_struct{
77 pgg_token_type token_number, reduction_token, error_frame_token;
78 int input_code;
79 int input_value;
80 int line, column;
81 int ssx, sn, error_frame_ssx;
82 int drt, dssx, dsn;
83 int ss[128];
84 pgg_vs_type vs[128];
85 int ag_ap;
86 const char *error_message;
87 char read_flag;
88 char exit_flag;
89 cint input_context;
90 cint cs[128];
91 int bts[128], btsx;
92 int (* const *gt_procs)(void);
93 int (* const *r_procs)(void);
94 int (* const *s_procs)(void);
95 unsigned char * pointer;
96 unsigned char * la_ptr;
97 const unsigned char *key_sp;
98 int save_index, key_state;
99 int ag_error_depth, ag_min_depth, ag_tmp_depth;
100 int ag_rss[2*128], ag_lrss;
101 char ag_msg[82];
102 const int *ag_dtl;
103 int ag_dsn;
104 int ag_resynch_active;
105 } pgg_pcb_type;
106
107 #ifndef PRULE_CONTEXT
108 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx]))
109 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx])
110 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx])
111 #endif
112
113 #ifndef AG_RUNNING_CODE
114 /* PCB.exit_flag values */
115 #define AG_RUNNING_CODE 0
116 #define AG_SUCCESS_CODE 1
117 #define AG_SYNTAX_ERROR_CODE 2
118 #define AG_REDUCTION_ERROR_CODE 3
119 #define AG_STACK_ERROR_CODE 4
120 #define AG_SEMANTIC_ERROR_CODE 5
121 #endif
122 void init_pgg(void);
123 void pgg(void);
124 #endif
125