lex_by_file( FileName ) :- get_input_from_file( FileName, TokenList ), lex( TokenList, OutputList ), %write_output( OutputList ), !. maplist(writeln,OutputList),!. %% atom_number(atom, number) lex([],[]). lex(['int' | T], ['TYPE: int' | R]) :- lex(T, R). lex(['bool' | T], ['TYPE: bool'] | R) :- lex(T, R). lex([',' | T], ['COMMA: ,'] | R) :- lex(T, R). lex([X | T], [X | R]) :- lex(T, R).