summaryrefslogtreecommitdiff
path: root/src/scheme
Commit message (Collapse)AuthorAge
* altos/scheme: Move ao-scheme to a separate repositoryKeith Packard2018-01-10
| | | | | | This way it can be incorporated into multiple operating systems more easily. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Allow unicode in lexerKeith Packard2018-01-08
| | | | | | | This just passes any bytes with the high bit set through the system so programs can include UTF-8 in strings and symbols. What the heck. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: remove debug code from vector writeKeith Packard2018-01-07
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Allow individual lisp keywords to be feature-conditionalKeith Packard2018-01-07
| | | | | | | This lets us build a smaller lisp that is just missing some aliases for existing functionality to save rom space. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Split tests out from build sourcesKeith Packard2018-01-07
| | | | | | Run tests on both tiny and full scheme test programs. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lambdakey-v1.0: Switch back to command buffered inputKeith Packard2018-01-06
| | | | | | Instead of just reading from stdin with no echo or editing. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Add ports. Split scheme code up.Keith Packard2018-01-06
| | | | | | And lots of other changes, including freeing unreferenced atoms. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: add 'install' target to install both test and tiny testKeith Packard2018-01-06
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Add vector and string funcs. Test everybody.Keith Packard2018-01-04
| | | | | | | Add a bunch of string and vector functions from r7rs. I think most everything is here now. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Accept more escaped character constantsKeith Packard2018-01-04
| | | | | | Allow all those specified in r7rs Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Allow make-vector value param to be optionalKeith Packard2018-01-04
| | | | | | It can default to #f Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Add builtin list-tailKeith Packard2018-01-04
| | | | | | This is used enough to warrant a builtin, rather than lisp implementation Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Fix macro-detection debuggingKeith Packard2018-01-04
| | | | | | Just update to use ao_scheme_printf Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: add make-string builtinKeith Packard2018-01-04
| | | | | | Allocate a blank string. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Make constant built pool as large as possibleKeith Packard2018-01-04
| | | | | | This allows building with as much constant data as will fit. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Make for-each tail recursiveKeith Packard2018-01-03
| | | | | | | Provides a native version of for-each that is tail recursive, rather than having it just use map and discard the return value. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Add start/end args to vector->listKeith Packard2018-01-03
| | | | | | | This is an r7rs extension which allows you to extract a subset of the vector. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: fix parsing of vector followed by listKeith Packard2018-01-03
| | | | | | | The 'parsing a vector' state value wasn't getting cleared at the end of the vector, so that (#(1 2) (3 4) returned (#(1 2) #(3 4) Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: support %x format for scheme printfKeith Packard2018-01-03
| | | | | | read debugging uses this format. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Add support for hex, octal and binary constantsKeith Packard2018-01-03
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Pull out per-frame vals while printing list of framesKeith Packard2017-12-24
| | | | | | Was using the same vals for all frames, which just doesn't work well. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Add separate floor-quotient builtinKeith Packard2017-12-24
| | | | | | | Does what 'quotient' did before, now quotient rounds towards zero while floor-quotient rounds down. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Replace per-type indexed stash with poly stash heapKeith Packard2017-12-19
| | | | | | | Instead of having a random set of stash arrays with explicit indices used by callers, just have a general heap. Less error prone, and less code. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Replace memory pool macros with inlinesKeith Packard2017-12-19
| | | | | | | | | | AO_SCHEME_IS_CONST -> ao_scheme_is_const_addr AO_SCHEME_IS_POOL -> ao_scheme_is_pool_addr Provides better typechecking and avoids confusion with ao_scheme_is_const inline (which takes an ao_poly instead of a void *) Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: AO_SCHEME_IS_CONS -> ao_scheme_is_consKeith Packard2017-12-19
| | | | | | | This inline was already defined; just use it. Also, switch some places to use ao_scheme_is_pair instead as appropriate. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: ao_scheme__cons -> ao_scheme_consKeith Packard2017-12-19
| | | | | | Fix the double underscore in this name. Ick. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Don't optimize ao_scheme_make_constKeith Packard2017-12-19
| | | | | | | Performance isn't interesting, and it's nice to have a bare system ready for debugging. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Clean up test CFLAGSKeith Packard2017-12-19
| | | | | | make it easy to switch between debug and optimized builds. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: (define (foo . bar)) has a pair, not list as cardKeith Packard2017-12-19
| | | | | | | | When defining a lambda with varargs, the args are not a list as the final element is not a pair or nil. Use pair? instead of list? to detect this form correctly. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: apply also needs to not free value list on lambdasKeith Packard2017-12-19
| | | | | | | | | | When apply is invoked on any function, the cons in the argument list cannot be immediately freed as they have been passed to the function. That applies to both built-ins as well as lambdas; this patch removes the special ao_scheme_skip_cons_free global and just marks the stack in both cases. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Rework display/write codeKeith Packard2017-12-19
| | | | | | | | | | Unify output functions and add bool to switch between write and display mode. Make that only affect strings (as per r⁷rs). Use print recursion detection in frame and stack code, eliminating PRINT flags in type field. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Compile scheme test with -O3Keith Packard2017-12-18
| | | | | | This level of optimization caused trouble, so use it all of the time. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Work around gcc 7.2.0 optimization bug in memory managerKeith Packard2017-12-18
| | | | | | | | | | | | | After marking a set of memory chunks, it's possible that all of them will be packed tight against 'top', in which case none of them will be moving. In that case, gcc 7.2.0 appears to generate incorrect code causing the loop to be abandoned, meaning that we don't actually collect anything at all. Add a quick short-circuit test just after the mark phase that skips the code which wouldn't do anything in this case. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: rearrange debugging definesKeith Packard2017-12-18
| | | | | | | Allow applications to redefine these as desired, add more flexibility in what the various memory debugging flags can do. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: abort when we try to print an invalid valueKeith Packard2017-12-18
| | | | | | | This can catch a host of interpreter bugs; best to abandon the program when it happens. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Use memory manager mark code to note recursive printKeith Packard2017-12-17
| | | | | | | This flags any object being printed and checks before recursing to avoid infinite loops. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Use AO_SCHEME_IS_CONS in cons memory funcsKeith Packard2017-12-17
| | | | | | | More efficient than ao_scheme_poly_type as it doesn't care about non-prim types. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: swap BIGINT and STRING typesKeith Packard2017-12-14
| | | | | | | | This lets BIGINT be a primitive type, allowing it to use all 32 bits for storage. This does make strings another byte longer, and also slightly harder to deal with. It's a trade off. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: integer? is builtin on all versionsKeith Packard2017-12-12
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: inline some mem calls to reduce stack usage.Keith Packard2017-12-12
| | | | | | Also includes some code to display stack usage during collect calls. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Use direct calls from frame to frame_vals mem functionsKeith Packard2017-12-12
| | | | | | Avoids the extra stack depth of the poly versions. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: More compiler warning cleanupsKeith Packard2017-12-12
| | | | | | Make local funcs static. Don't mix decls and code.x Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: apply const to places taking const strings.Keith Packard2017-12-12
| | | | | | Mostly printf and friends. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Support scheme subsetting via feature settingsKeith Packard2017-12-12
| | | | | | | This provides for the creation of smaller versions of the interpreter, leaving out options like floating point numbers and vectors. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Add ao_scheme_vector.cKeith Packard2017-12-12
| | | | | | Useful to include the code for implementing vectors Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Allow ao_scheme_read_eval_print to be restartedKeith Packard2017-12-11
| | | | | | Reset exceptions at the top so that we can call it more than once. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Add Makefile for scheme test appKeith Packard2017-12-11
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Make test scheme app heap maximum sizeKeith Packard2017-12-11
| | | | | | It's only 32kB. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Make eqv? work for numbers and stringsKeith Packard2017-12-11
| | | | | | | Large numbers, floats and strings need a value check, not just a comparison between ao_polys Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/scheme: Stash cons across value allocation in compareKeith Packard2017-12-11
| | | | | | | Large ints, strings and floats can cause allocation, requiring that the 'cons' pointer be stashed and retrieved in case it moved. Signed-off-by: Keith Packard <keithp@keithp.com>