PeyloW
Joined: 12 Oct 2005 Posts: 14 Location: Sweden
|
Posted: Sun Oct 16, 2005 7:56 am Post subject: Update 2005-10-16 |
|
|
All changes in CHANGES.
It should naturaly be (fac 5) => 15, not (fac 5) => 5 as noted.
Next vital thing I want to complete is the unified evaluation of arguments. Nearly all functions for evaluating build-in forms have argument checking. This should be handled centrally to minimise code. I am thinking of something in the line of regexp and the argument handling in the ZEND engine (PHP scripting engine).
Cell* evalArguments(char[] fmt, Cell* args);
That returns the evaluated arguments, and raises ArgumentException if the arguments does not comform to the fmt string.
Each argument is a simgle char. Optionally prefixed with ' if it should not be evaluated (Such as symbol and list passed to defun). Optionally postfixed with ? (zero or one), * (zero or more) or + (one or more) to indicate repetition or count. As many forms expects arguments in pairs (such as let) I would also like to be able to group arguments with ( and ).
"(yv)+" Would be one or more pairs of one symbol and any value.
Well, no problem there, but... what if "(yv)?'v"? If the first group fails on the second argument (v) then both should be rewinded and v the value that just evaluated as y be returned as v but not evaluated. Recursively call evalArguments() with subgroups have crossed my mind as the most logical approach. But I have not yet come up with a clean solution for rewinding arguments.
Ideas are welcome. |
|