Created
August 21, 2017 16:54
-
-
Save rogual/c93e213398023b5f45be4d518d5b63b4 to your computer and use it in GitHub Desktop.
Creating simple CLI programs with GNU Prolog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Creating simple CLI programs with GNU Prolog | |
This template shows how to compile a knowledge base to machine code and execute arbitrary Prolog queries against it by passing them as CLI arguments to a binary. | |
Output comes out on stdout with no banners or other rubbish. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: run | |
simple: simple.pl | |
gplc --no-top-level $< | |
run: simple | |
./simple 'forall(ok(X), (write(X), nl)).' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- initialization(main). | |
ok(a). | |
ok(b). | |
main :- | |
argument_value(1, X), | |
read_from_atom(X, T), | |
call(T). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment