~pmikkelsen/pprolog

pprolog/stdlib.pl -rw-r--r-- 5.3 KiB
The export list works now I think :)
More work on modules. Now it is built in to the wam instructions which module to run code from. the : operator allows for changing the module that is used by the wam but only for 1 instruction
More work on modules:

Add a use_module directive which will add the module to the current module's import list. When loading code all the modules specified in use_module is loaded as well if they aren't already.

It is still not possible to export predicates or use predicates directly, so : must be used.
First very WIP work on a module system.
The idea is that all code is still stored in m->code, but the labels
have a module name attached to them which can be checked.

As of now the export list of :- module(ModuleName, ExportList) is only
parsed if it is empty, and everything is exported by default.

It is impossible to import other modules, but the new (:)/2 operator
can be used to call a predicate from another module. The operator
leaves one redundant choicepoint behind which is not so nice.
Add some error functions
Add catch/3 and throw/1
Remove a red cut from length.
Enable raw input mode when reading ; or . in the repl. This makes the "find more solutions" step of interacting easier.
Impement ground/1 to check if a term contains no variables
Add atom/1, integer/1, float/1, var/1 and compound/1 as builtins, and add prolog implementations of atomic/1, number/1, nonvar/1 and callable/1
Add maplist/2-5, foldl/4, exclude/3 and partiton/4
Implement findall/3
Add versions of nth1/3 and nth0/3 which only works when the index is not a variable.
Add numlist/3 and include/3 and some fixes that make them work
Implement > as a builtin, and implement <, =<, and >= based on that.
Add =:= and =\=
More work on parsing/printing the different operator types
Parse comments and add more operator directives from swi-prolog
fix length from stdlib.
Next