Hello Charles,
The following code crashes vigorously for me. Why should it?
type key_words
keyword as string
sym as long
end type
const as long MAX_KEYWORDS = 13
dim key_words_tab(MAX_KEYWORDS) as key_words
const as long sym_unknown = 0, sym_eoi = 1, sym_string_const = 2, sym_lparen = 3, sym_rparen = 4
const as long sym_multiply = 5, sym_plus = 6, sym_comma = 7, sym_minus = 8, sym_divide = 9
const as long sym_integer_const = 10, sym_ident = 11, sym_print = 12, sym_while = 13
const as long sym_do = 14, sym_end = 15, sym_halt = 16, sym_if = 17, sym_then = 18
const as long sym_else = 19, sym_integer_var = 20, sym_equal = 21, sym_mod = 22, sym_or = 23
const as long sym_and = 24, sym_neq = 25, sym_lss = 26, sym_leq = 27, sym_gtr = 28
const as long sym_geq = 29, sym_neg = 30, sym_not = 31, sym_whtspc = 32
dim as string codebuf = "bla bla bla"
sub init_lex()
key_words_tab( 1).sym = sym_and
key_words_tab( 2).sym = sym_do
key_words_tab( 3).sym = sym_else
key_words_tab( 4).sym = sym_end
key_words_tab( 5).sym = sym_halt
key_words_tab( 6).sym = sym_if
key_words_tab( 7).sym = sym_integer_var
key_words_tab( 8).sym = sym_mod
key_words_tab( 9).sym = sym_not
key_words_tab(10).sym = sym_or
key_words_tab(11).sym = sym_print
key_words_tab(12).sym = sym_then
key_words_tab(13).sym = sym_while
key_words_tab( 1).keyword = "and"
key_words_tab( 2).keyword = "do"
key_words_tab( 3).keyword = "else"
key_words_tab( 4).keyword = "end"
key_words_tab( 5).keyword = "halt"
key_words_tab( 6).keyword = "if"
key_words_tab( 7).keyword = "integer"
key_words_tab( 8).keyword = "mod"
key_words_tab( 9).keyword = "not"
key_words_tab(10).keyword = "or"
key_words_tab(11).keyword = "print"
key_words_tab(12).keyword = "then"
key_words_tab(13).keyword = "while"
end sub
init_lex
print codebuf