swipl -f main.pl < input > output where input is the input file and output is the output file. The input file has to be a valid text of the parsing grammar.
swipl -f main.pl < input > output