I am using term expansion to create a Domain Specific Language (DSL).
For example, keyword(X) gets expanded to dsl(keyword(X)).
A failure driven loop then reads each keyword in sequence:
process :- dsl(X), process(X), fail.
Is there a way to determine the line number in the file in which the fact dsl(X) appears on the file?
I’d like to use is to report syntax or semantic errors …
E.g. what I want to write out after reading dsl(keyword(arg)) on line 5 in file trial.pl
Warning': keyword(arg) in line 5 of file: trial.pl - expected arg2 instead.
Can this be done?