/tutorial/backtracking/tiny_prolog/prolog_parser.e
Specman e | 22 lines | 22 code | 0 blank | 0 comment | 0 complexity | 5ebfc96e1259bfa1695288ca6fb4b8a8 MD5 | raw file
1class PROLOG_PARSER creation make feature 2 make(b: BASE) is do 3 base := b 4 state := 0 5 create stack_of_states.with_capacity(10) 6 end 7 put_string(s: STRING) is local i:INTEGER do 8 from i:=s.lower until i>s.upper loop 9 put_character(s.item(i)) 10 i := i+1 11 end 12 end 13 put_character(c: CHARACTER) is do 14 inspect state 15 when 0 then 16 else 17 end 18 end 19 base: BASE 20 state: INTEGER 21 stack_of_states: FAST_ARRAY[like state] 22end