shithub: pprolog

ref: 4fba3e66dce0d167d2031a0d1f1f6f4571cbd981
dir: /TODO/

View raw version
* Stop comparing strings all the time
* Stop copying the entire goal stack into every choicepoint
* Modules (I try to do something like SWI prolog for now, but I know there is also an iso standard)

The following builtins:
'='/2 needs to do something about the occurs check
unify_with_occurs_check/2: not implemented
'\\='/2: handle occurs check

* Handle overflow and uderflow in arithmetic 

* Variables should be compared and printed in a way that makes sense. Right now, their number is changed when a clause is used,
  but their name remains the same, so prints will be bad.

* Write a loader in prolog, that calls builtins to activate the C functions needed. This means we can do some syntax transformations
  and handle directives in prolog code, instead of C. The "bootstrap" modules will have to be written in a way the original C loader
  understands, but everything after that can use the full feature set.
  Steps:
	1) Change the lexer and parser so they carry around their state instead of global variables.
	2) Make it possible to evaluate a query using 'evalquery' even when another query is running. This
	   means no more global variables there either.
	3) Create a "loading context" which is indexed by a prolog term and consists of:
		* Lexer + parser state
		* module loading state
	4) Loading then becomes:
		1) Create loading context
		2) Open file
		3) Repeatedly read terms using read_term
		4) Inspect the term (clause or directive?) and act on it, using builtints and reference to context
		5) Close the file and context