To expand on gasche's answer, you need to change your parser definition as follows:
%type <Path.term list> main
%%
main:
| expr EOL main {$1::$3}
| expr EOF {[$1]}
| EOF {[]} /* if you want to allow a redundant EOL at the end */
;
With your original definition, a single line is considered a complete parse for main
, that's why your parser stops after that.