Cyclic references were never deallocated by reference conuting.
Symbols cannot create cyclic structures and are less frequent (one
allocation per symbol), keep reference counting for them.
This slightly improves performances even though many previous
optimizations are removed (environment stack, reuse of memory).
Step caching hash of symbols. This does not seem to improve
performances. Hashing them instead of ordering them does.
Define Repl in the step file instead of globally. Move the eval
built-in function from core into the step file.
When possible, pass Ada records instead of explicit pointers.
In the reader, construct more objects directly as described in the MAL
process, reserve the buffer for sequences and maps
In eval, iterate on vectors without delegation. The increased
complexity was not improving performances. Keep demonstrating Ada
type-safe genericity for maps, where iterating outside Types.Maps
would be less easy and/or efficient.
In quasiquote_list, concatenate in one buffer instead of allocating a
list for each element. The buffer may be reallocated behind the
curtain, but not once per element anymore.
In environments, illustrate tail call optimization when recursion is
more readable than a loop.
- Add GitHub/GitHut pull requests and pushes.
- Add StackOverflow tag counts (this also involves some hard-coded
rollup of certain tags).
- Add README with update instructions.
- Move graph specific data mangling from collect code to graph
rendering code.
Two changes require approval.
* The 'do' special becomes a built-in function similar to first. This
small change reduces the complexity of eval. The last evaluation
cannot benefit from TCO, but the performance change seems invisible.
* read/eval/print acts on each item found in the input string, as if
they were enclosed with (do ..). The guide does not specify what
should happen to text following the first AST, and this change actually
simplifies some things (like dealing with zero AST).
The read-string built-in function only returns the first AST,
as changing this would be much more intrusive.
Other changes seem straightforward.
Global:
* Ada 2020 target assignments (like +=, but more general).
* Use Constant_Indexing aspect for sequences, so that they can be
indexed in source code like native arrays.
* consistency renamings.
'fn' does not include built-in functions, 'function' does.
'list' does not include vectors, 'sequence' does.
Move error handling to a separate package.
* This simplifies code everywhere else.
* Uncaught expressions now report a stack trace.
Types:
* Count allocations and deallocations, check that counts match.
* Share more code between functions and macros.
Core:
* Replace the Core.Ns function returning an array with a procedure
(The intermediate object was preventing the reference counting code
from deallocating some unused objects).
* Implement Prn with Pr_Str.
Printer:
* Change the profile so that the caller spares some allocations.
Reader:
* Share a single buffer of mal values between all recursions.
This significantly reduces the stack footprint.
Steps:
* Fix implementation name (ada.2) in the startup script.
* Let environment variables trigger debugging information.
Use character sets and other language tools to delimit tokens.
When possible, only test each input character once.
Give verbose descriptions to subprograms.
Simplify with one global variable instead of two.
Improve reporting of ignored trailing items in input.
Conformity:
Move readline to readline.ads and drop the Interactive_Loop subprogram.
Let the main Read and Print functions do input/output.
Rename environments.ads to envs.ads (the name of the eval parameter
seems more important).
Move association of formal and actual parameters to the env "constructor".
Use the documentation names whenever possible (especially, make calls
to Eval where they are expected and explicit the parameters).
Iterate on a NS structure provided by Core, as per the process.
Use similar method names for Envs.Ptr and Envs.Closure_Ptr,
as the difference is an implementation detail.
Performance:
Move Map into list methods, swap into atom methods.
Pass formal parameters as an array of symbols on the stack,
instead of a MAL list.
Readability:
Replace some one-letter names.
Use renamings when the lines become too long.
Split Pr_Str in small subprograms.
Declare the access to built-in functions in Types.Mal.
Consistent names.
Move redundant comments into README.
In Printer, Reader and Quasiquote: move subsubprogram into the
subprogram calling it: this improves the readability and spares some
adjust/finalizations.
Force elaboration of Environments and Symbols before Core.
Move some use clauses to the minimal scope requiring them.
Remove some name clashes.
Format more consistently.
Add comments to distant 'begin' keywords.
Give explicit list of remaining choices in crucial case statements.
Remove unneeded parenthesis.
Avoid unneeded exceptions.
Explicit some initial values.