From 1c840d5c5ab6326492542886297d5bafa2877c4d Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Mon, 19 Jul 2021 14:40:19 +0000 Subject: Update TODO --- TODO | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 6cb0872..a1d34f4 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,5 @@ * Stop comparing strings all the time * Stop copying the entire goal stack into every choicepoint -* Stop creating choicepoints when it is not needed -* How to implement builtins nicely? -* Right now we copy and allocate a lot, but almost never free stuff. -* Many builtins should really throw an error, but they just fail for now. -* Exceptions (throw, catch) * Modules (I try to do something like SWI prolog for now, but I know there is also an iso standard) The following builtins: @@ -12,4 +7,24 @@ The following builtins: unify_with_occurs_check/2: not implemented '\\='/2: handle occurs check -* Handle overflow and uderflow in arithmetic \ No newline at end of file +* 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 -- cgit v1.2.3