Mercurial > ~dholland > hg > ag > index.cgi
diff tests/agcl/contrib/good/yabasic.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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/agcl/contrib/good/yabasic.h Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,89 @@ +#ifndef YABASIC_H +#define YABASIC_H + +typedef union { + double alignment; + char ag_vt_2[sizeof(int)]; + char ag_vt_4[sizeof(double)]; + char ag_vt_5[sizeof(char *)]; +} parseBasic_vs_type; + +typedef enum { + parseBasic_white_space_token = 1, parseBasic_SEP_token = 7, + parseBasic_simple_real_token = 14, parseBasic_exponent_token = 18, + parseBasic_integer_part_token = 20, parseBasic_fraction_part_token = 22, + parseBasic_letter_token = 25, parseBasic_SYMBOL_token = 27, + parseBasic_DIGITS_token = 29, parseBasic_string_text_token = 31, + parseBasic_program_token = 34, parseBasic_statement_list_token, + parseBasic_eof_token, parseBasic_statement_token, parseBasic_label_token, + parseBasic_string_assignment_token = 40, parseBasic_assignment_token, + parseBasic_for_loop_token, parseBasic_if_clause_token, + parseBasic_symbol_or_lineno_token = 45, parseBasic_expression_token = 51, + parseBasic_goto_list_token = 53, parseBasic_gosub_list_token = 55, + parseBasic_hashed_number_token = 57, + parseBasic_string_expression_token = 59, parseBasic_printintro_token = 62, + parseBasic_printlist_token, parseBasic_semicolon_token = 65, + parseBasic_inputintro_token = 67, parseBasic_inputlist_token, + parseBasic_readlist_token = 70, parseBasic_datalist_token = 72, + parseBasic_dimlist_token = 76, parseBasic_mapping_token = 79, + parseBasic_indexlist_token = 107, + parseBasic_primary_string_expression_token = 114, + parseBasic_string_function_token, + parseBasic_primary_expression_token = 129, parseBasic_function_token, + parseBasic_exponential_expression_token = 132, + parseBasic_multiplicative_expression_token = 134, + parseBasic_const_token = 159, parseBasic_intnum_token, + parseBasic_step_part_token = 167, parseBasic_next_or_eofile_token = 170, + parseBasic_next_symbol_token, parseBasic_condition_token = 175, + parseBasic_else_part_token = 179, parseBasic_endif_or_eof_token = 181, + parseBasic_and_condition_token = 183, + parseBasic_primary_condition_token = 185, + parseBasic_comparison_token = 187, parseBasic_input_token = 195, + parseBasic_readitem_token = 198, parseBasic_stream_token = 201, + parseBasic_position_token, parseBasic_prompt_token = 204, + parseBasic_name_token = 216, parseBasic_digit_string_token, + parseBasic_STRSYM_token = 257, parseBasic_STRING_token = 262, + parseBasic_number_token = 274, parseBasic_digit_token = 324 +} parseBasic_token_type; + +typedef struct parseBasic_pcb_struct{ + parseBasic_token_type token_number, reduction_token, error_frame_token; + int input_code; + int input_value; + int line, column; + int ssx, sn, error_frame_ssx; + int drt, dssx, dsn; + int ss[128]; + parseBasic_vs_type vs[128]; + int ag_ap; + const char *error_message; + char read_flag; + char exit_flag; + int bts[128], btsx; + int lab[10], rx, fx; + const unsigned char *key_sp; + int save_index, key_state; + char ag_msg[82]; +} parseBasic_pcb_type; + +#ifndef PRULE_CONTEXT +#define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) +#define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) +#define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) +#endif + +#ifndef AG_RUNNING_CODE +/* PCB.exit_flag values */ +#define AG_RUNNING_CODE 0 +#define AG_SUCCESS_CODE 1 +#define AG_SYNTAX_ERROR_CODE 2 +#define AG_REDUCTION_ERROR_CODE 3 +#define AG_STACK_ERROR_CODE 4 +#define AG_SEMANTIC_ERROR_CODE 5 +#endif + +extern parseBasic_pcb_type parseBasic_pcb; +void init_parseBasic(void); +void parseBasic(void); +#endif +