1(* The shallow abstract syntax *) 2 3datatype location = 4 Location of int * int 5; 6 7datatype regular_expression = 8 Epsilon 9 | Characters of char list 10 | Sequence of regular_expression * regular_expression 11 | Alternative of regular_expression * regular_expression 12 | Repetition of regular_expression 13 | Name of string 14; 15 16datatype lexer_definition = 17 Lexdef of location * 18 (string * regular_expression) list * 19 (string * (regular_expression * location) list) list 20; 21 22(* Representation of automata *) 23 24datatype automata = 25 Perform of int 26 | Shift of automata_trans * automata_move Array.array 27and automata_trans = 28 No_remember 29 | Remember of int 30and automata_move = 31 Backtrack 32 | Goto of int 33; 34