You say you want to tokenize the input - the best way to do this are definite clause grammars (DCGs). With library(pio)
in SWI you can use the grammar directly to read in a file like so:
?- use_module(library(pio)).
?- phrase_from_file(seq(Xs),f).
seq([]) --> [].
seq([E|Es]) --> [E], seq(Es).
Replace now seq//1
by some more elaborate tokenizer.