summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* RELNOTES: Preparing for 045.Kaz Kylheku2011-12-041-0/+16
|
* * eval.c (op_qquote_error, op_unquote_error): New static functions.Kaz Kylheku2011-12-044-39/+78
| | | | | | | | | | | | | (expand_qquote): Bugfix: missing case added to handle directly quoted quasiquote. (eval_init): Error-catching pseudo-operators registered in op_table. * parser.y (force_regular_quotes): New function. (list): Quotes within unquotes and splices are regular. * txr.1: Clarified new rules. Removed description of ,'form and ,*'form special syntax.
* Expose lazy lists in TXR Lisp.Kaz Kylheku2011-12-035-12/+74
| | | | | | | | | | | | | | | * eval.c (eval_init): New intrinsic functions. * lib.c (rplaca, rplacd, lcons_fun): New functions. (make_lazycons): Renamed to make_lazy_cons, relocated and turned into external function. (lazy_stream_func, lazy_stream_cons): Follow rename of make_lazycons. * lib.h (rplaca, rplacd, make_lazy_cons, lcons_fun): Declared. * txr.1: Stub sections created.
* * eval.c (uw_protect_s, return_s, return_from_s): New symbolKaz Kylheku2011-12-033-5/+82
| | | | | | | | | | | | | | variables. (op_unwind_protect, op_block, op_return, op_return_from): New static functions. (expand): Removed case for call, if, and, and or. These operators evaluate all their arguments, so the code walker can treat them as a function calls. Added case for block and return-from. (eval_init): New symbols interned. New operator functions registered in op_table. * txr.1: Blank sections added.
* * lib.c (split_str, split_str_set): Bugfix: access beyond the end ofKaz Kylheku2011-12-032-2/+17
| | | | the input string.
* * eval.c (eval_init): String and character functionsKaz Kylheku2011-12-033-3/+78
| | | | | | exposed as intrinsics. * txr.1: Blank sections created.
* * txr.1: Added stub sections for new functions.Kaz Kylheku2011-12-022-0/+21
|
* * eval.c: Symbol related intrinsic functions and variables madeKaz Kylheku2011-12-023-1/+19
| | | | | | available: * lib.h (sym_name): Dangling declaration removed.
* * parser.y (list): unquote and splice actions look inside theKaz Kylheku2011-12-023-2/+45
| | | | | | | | | | argument form. If an unquote or splice are applied to a quoted form, its quote becomes a regular quote. This behavior is necessary to make ,',form work in nested quotes, otherwise the ' is a quasiquote which captures the comma in ,form, reducing ,',form to ,form. * txr.1: Documented this special behavior.
* * eval.c (expand_qquote): Bugfix: removed bogus recognitionKaz Kylheku2011-12-022-2/+7
| | | | | | and processing of regular quote form. This broke nested backquote processing, and quasiquote forms containing non-quasi-quotes like like '(a 'b ,c).
* Version 044txr-044Kaz Kylheku2011-12-015-6/+20
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* * txr.1: Started Lisp documentation. Updated description ofKaz Kylheku2011-12-012-11/+402
| | | | symbol syntax.
* * lib.c (int_str): Return nil rather than 0 if no digits are extractedKaz Kylheku2011-12-012-1/+9
| | | | at all.
* * match.c (h_skip, h_coll, v_skip, v_collect): Evaluate the arguments.Kaz Kylheku2011-12-012-18/+27
| | | | | (do_txeval): Optimization: short-circuit out if the expression is nil, without establishing the exception handler.
* * match.c (v_skip): Bugfix: Nov 12 commit caused regression:Kaz Kylheku2011-12-013-2/+11
| | | | | | skip min/max arguments not working! * RELNOTES: Updated.
* Dropping the silly cons return value from txeval.Kaz Kylheku2011-12-012-39/+64
| | | | | | | | | | | | | | | | | Two interfaces are provided to the function. One throws on unbound variable, the other which evaluates them to the symbol noval_s (used in exception handling). * match.c (do_txeval): New static function. (txeval): Functionality moved to do_txeval. (txeval_allow_ub): New static function. (vars_to_bindings, h_fun, v_freeform, v_next, v_merge, v_bind, v_set, v_cat, v_output, v_deffilter, v_fun): No need to use cdr to get the value from txeval. (v_throw): Use txeval_ub_allowed, since unbound variables are allowed in throw. (v_try): Detect unbound arguments by checking for noval_s rather than nil. No need to use cdr.
* * match.c (eval_form): Function renamed to txeval so its isKaz Kylheku2011-12-012-17/+24
| | | | | | not confused with the Lisp evaluation functions. (vars_to_bindings, h_fun, v_freeform, v_next, v_merge, v_bind, v_set, v_cat, v_output, v_throw, v_deffilter, v_fun): Updated.
* Update.Kaz Kylheku2011-12-011-1/+11
|
* * lib.h (or2): Restore macro version of or2, because we needKaz Kylheku2011-11-308-1/+37
| | | | | | | | | | | | | | | | | | | | the sequencing! Making it an inline function broke the tests. But we can't have multiple evaluation either, so it's going to use a temporary lexical variable. (uses_or2): Macro which declares the lexical variable needed by or2. * debug.c (debug): add uses_or2. * eval.c (eval_intrinsic, op_modplace): Likewise. * lib.c (lazy_str, lazy_str_force_upto, lazy_str_get_trailing_list): Likewise. * match.c (h_parallel, v_freeform, v_parallel, v_output): Likewise. * parser.y (unquotes_occur): Likewise. * stream.c (format): Likewise.
* Removing useless hash table.Kaz Kylheku2011-11-304-5/+15
| | | | | | | | | | | | * parser.h (ln_to_forms_hash): Declaration removed. * parser.l (ln_to_forms_hash): Variable removed. (parse_init): Initialization and protection of ln_to_forms_hash removed. * parser.y (rl): Update of ln_to_forms_hash removed. * txr.1:
* * configure (extra_debugging): New variable. EXTRA_DEBUGGINGKaz Kylheku2011-11-305-0/+58
| | | | | | | | | | | | | conditionally generated in config.h. * gc.c (break_obj): New static variable. (mark_obj): Debugging feature: if the object is the one stored in break_obj and not yet reached, then call breakpt. (deheap): New debugging function for viewing regions of the heaps. * lib.c (breakpt): New function. * lib.h (breakpt): Declared.
* * hash.c (hash_process_weak): Fix regression caused by a mistakeKaz Kylheku2011-11-302-1/+10
| | | | | | | | in the the 2010-01-26 commit, prior to release 033. When processing a table with weak values, this function was mistakenly testing the keys rather than values for for reachability. I noticed this when a test case that should run in constant memory showed unwarranted accumulation of memory.
* * eval.c (op_modplace): Bugfix: conflation of new value andKaz Kylheku2011-11-303-4/+22
| | | | | | | | increment value. Separate new value and increment value, and check number of arguments. * lib.h (or2): Turned into inline function due to multiple argument evaluation.
* * txr.vim: New operators added.Kaz Kylheku2011-11-302-2/+7
|
* * eval.c (bindings_helper): Fix uninitialized variable.Kaz Kylheku2011-11-292-0/+6
|
* * eval.c (dohash_s): New symbol variable.Kaz Kylheku2011-11-292-2/+52
| | | | | | | (op_dohash): New static function (expand): New case for dohash_s. Bugfix for do_s: expand was used rather than expand_forms. (eval_init): dohash_s initialized and entered into op_table.
* * eval.c (eval_init): hashp and maphash functions registered.Kaz Kylheku2011-11-294-0/+20
| | | | | | * hash.c (maphash): New function. * hash.h (maphash): Declared.
* * eval.c (expand_vars): Bugfix: was not handling varsKaz Kylheku2011-11-292-0/+11
| | | | of the form var, only (var initform).
* Support assignment to (car ...) and (cdr ...).Kaz Kylheku2011-11-293-15/+53
| | | | | | | | | | | | | | * eval.c (car_s, cdr_s): New symbol variables. (op_modplace): Cases for car and cdr added. (expand_place): Likewise. Calls abort should the cases fall through rather than returning 42. (expand): Bugfix: for and for* case not propagating source location info. Bugfix: expansion for do added. (eval_init): car_s and cdr_s initialized and used in place of previous intern calls. * parser.y (elem): Removed wrong logic for expanding the do form. It was expanding only the first argument.
* * eval.c (let_star_s, for_s, for_star_s): New symbols.Kaz Kylheku2011-11-282-12/+99
| | | | | | | | | | | | | (env_replace_vbind, bindings_helper): New static functions. (op_let): Refactored to allow for let* form. Code for setting up bindings moved into bindings helper, shared by for loop. (op_for, expand_vars): New static functions. (expand): Bugfix: let case was neglecting to walk the var initialization forms. This is done via expand_vars now. let_star_s added to this case to handle let* and let at the same time. New case added for for and for*. (eval_init): let_star_s, for_s, and for_star_s initialized, and entered into op_table.
* * eval.c (eval_init): More functions.Kaz Kylheku2011-11-283-0/+31
| | | | * txr.vim: More highlighting.
* Adding streams functions to Lisp evaluator.Kaz Kylheku2011-11-287-35/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (op_let): Bugfix: was not evaluating var init forms. (reg_var): New static function. (eval_init): Registered numerous stream functions and the three standard streams. * lib.c (obj_print, obj_pprint): Modified to return a value. (init): eval_init called after stream_init, because eval needs the three standrad streams prepared. * lib.h (obj_print, obj_pprint): Declarations updated. * stream.c (format): Support t as a shorthand for standard output. (formatv, open_directory, open_file, open_pipe): New functions. (w_opendir): New static function. * stream.h (formatv, open_directory, open_file, open_pipe): Declared. * txr.vim: set iskeyword such that keyword can contain special characters. Set b:current_syntax to "lisp". (txl_keyword): New keyword category populated with TXR Lisp keywords defined as separate category. (txr_list): Contains txl_keyword. (txr_meta): Contains txl_keyword and txr_list.
* mapcar, mappend and apply functions.Kaz Kylheku2011-11-282-17/+105
| | | | | | | | | | | | | | | | | | fun operator. * eval.c (apply_s): New symbol variable. (apply): Handle functions specified as symbols. Use symbol from context form in error reporting. (apply_intrinsic): New function. (interp_fun): Bugfix: removed evaluation of arguments, since arguments are already evaluated. (op_call): Simplified by not having to handle symbols, since apply does. (op_fun): New function. (expand): Handle special form fun. (mapcarv, mappendv): New functions. (eval_init): Initialize apply_s. Register op_fun function in op_table. Register mapcar, mappend and apply functions.
* Added evaluation support for quote and quasiquote with unquotes.Kaz Kylheku2011-11-288-58/+379
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New functions list, append and eval. Code walking framework for expanding quasiquotes. quotes right now. * eval.c (let_s, lambda_s, call_s, cond_s, if_s, and_s, or_s defvar_s, defun_s, list_s, append_s): New symbol variables. (eval_intrinsic, op_quote, expand_forms, expand_cond_pairs, expand_place, expand_qquote): New static functions. (expand): New external function. (eval_init): Initialize new symbol variables. Use newly defined symbol variables to register functions. Also, new functions: quote, append, list and eval. * eval.h (expand): Declared. * lib.c (appendv): New function. (obj_init): quote and splice operator symbols moved into system package. (obj_print, obj_pprint): Support for printing quotes and splices. * lib.h (appendv): Declared. * match.c (do_s): New symbol variable. (syms_init): New variable initialized. (dir_tales_init): New variable used instead of intern. * match.h (do_s): Declared. * parser.y (elem): @(do) form recognized and its argument passed through the new expander. (o_elem, quasi_item): Pass list through expander. (list): Use choose_quote to decide whether to put regular quote or quasiquote on quoted list. (meta_expr): Fixed abstract syntax so the expression is a single argument of the sys:expr, rather than multiple arguments. (unquotes_occur, choose_quote): New static function.
* * parser.y (expr): Set source location info on elements.Kaz Kylheku2011-11-262-7/+17
| | | | (strlit): Set location info.
* * match.c (subst_vars): Handle expr_s, so thatKaz Kylheku2011-11-263-7/+28
| | | | | | | | | | | Lisp expressions can be interpolated into quasiliterals. (extract_vars): Avoid recursing into expressions marked with expr_s. (do_output_line): Handle expr_s so that Lisp expressions can be interpolated into output. * parser.y (o_elem, quasi_items): Handle list expressions, annotated with expr_s.
* Task #11436Kaz Kylheku2011-11-2616-169/+1360
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lisp interpreter added. * gc.c (finalize, mark_obj): Handle ENV objects. * hash.c (struct hash): acons_new_l_fun function pointer order of arguments change. (equal_hash): Handle ENV. (make_hash, gethash_l): Use cobj_handle for type safety. Follow change in acons_new_l. (gethash, gethash_f, remhash, hash_count, hash_get_userdata, hash_set_userdata, hash_next): Use cobj_handle. (gethash_n): New function. * hash.h (gethash_n): Declared. * lib.c (env_s): New symbol variable. (code2type, equal): Handle ENV. (plusv, minusv, mul, mulv, trunc, mod, gtv, ltv, gev, lev, maxv, minv, int_str): New functions. (rehome_sym): New static function. (func_f0, func_f1, func_f2, func_f3, func_f4, func_n0, func_n1, func_n2, func_n3, func_n4): Initialize new fields of struct func. (func_f0v, func_f1v, func_f2v, func_f3v, func_f4v, func_n0v, func_n1v, func_n2v, func_n3v, func_n4v, func_interp): New functions. (apply): Function removed: sanely re-implemented in new eval.c file. (funcall, funcall1, funcall2, funcall3, funcall4): Handle variadic and interpreted functions. (acons, acons_new, acons_new_l, aconsq_new, aconsq_new_l): Reordered arguments for compatibility with Common Lisp acons. (obj_init): Special hack to prepare hash_s symbol, which is needed for type checking inside the hash table funtions invoked by make_package, at a time when the symbol is not yet interned. Initialize new env_s variable. (obj_print, obj_pprint): Handle ENV. Fix confusing rendering of of function type. (init): Call new function eval_init. * lib.h (enum type): New enumeration member ENV. (struct func): functype member changed to bitfield. New bitfied members minparam and variadic. New members in f union: f0v, f1v, f2v, f3v, f4v, n0v, n1v, n2v, n3v, n4v. (struct env): New type. (union obj): New member e of type struct env. (env_s): Variable declared. (plusv, minusv, mul, mulv, trunc, mod, gtv, ltv, gev, lev, maxv, minv,
* * match.c (h_coll): Use getplist_f to distinguishKaz Kylheku2011-11-241-2/+3
| | | | | the case that :vars is explicitly specified as (). In this case, no bindings escape from the collect.
* * lib.c (getplist_f): New function.Kaz Kylheku2011-11-246-3/+38
| | | | | | | | | | | | | * lib.h (getplist_f): Declared. * match.c (v_collect, h_coll): Use getplist_f to distinguish the case that :vars is explicitly specified as (). In this case, no bindings escape from the collect. * tests/008/soundex.txr: This test case broke due to using :vars () and yet counting on the variable to exist. * RELNOTES: Updated.
* * match.c (match_funcall): Set source location info forKaz Kylheku2011-11-242-0/+6
| | | | generated function call.
* * parser.y (texts, elem): Fixed incorrect use of rl ratherKaz Kylheku2011-11-243-4/+20
| | | | | | than rlcp. Added forgotten rlcp on result of optimize_text. * RELNOTES: Updated.
* Version 043txr-043Kaz Kylheku2011-11-235-8/+19
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOES: Updated.
* * txr.c (remove_hash_bang_line): Recognize multipleKaz Kylheku2011-11-232-8/+20
| | | | | | syntax possibilities. A hash bang could be buried in a (text ...) compound, or it could just be a string (thanks to the text form optimization).
* Optimization: if all the elements of (text ...) areKaz Kylheku2011-11-232-1/+19
| | | | | | | | strings, then replace the (text ...) by the catenation of those strings. * parser.y (optimize_text): New function. (elem): Use optimize_text.
* * lib.c (plus, minus): Fixed wrong assertion which would incorrectlyKaz Kylheku2011-11-234-3/+19
| | | | | | | | | fire for inputs that do not overflow. * match.c (search_form): Fixed incorrect loop test which could lead to nonterminating behavior. * RELNOTES: Updated.
* Semantics change. If a variable is followed by a mixtureKaz Kylheku2011-11-237-37/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of text and regular expressions, that whole mixture is considered to follow the variable and used for matching. The earlier semantics change whereby a single unescaped space denotes the regular expression / +/ broke the simple case @a word. It caused the @a to be followed not by the text " word" but by just the regular expression element. With this change @a word means that a is followed by the regex / +/ and "word". * match.c (text_s): New symbol variable. (h_text): New function. (syms_init): Initialize new symbol variable. (dir_tables_init): Hook h_text into horizontal directives table. * match.h (text_s): Declared. * parser.y (text, texts): New nonterminals. (elem): TEXT, SPACE and regex are now handled under texts grammar production. All texts are run together and produce an item which looks like (text items ...). * txr.1, RELNOTES: Updated. * txr.c (remove_hash_bang_line): Updated to find #! buried in (text ...) syntax.
* * configure: Fix environ test case for C++.Kaz Kylheku2011-11-222-0/+6
|
* * match.c (search_form): Bugfix: we must search to one characterKaz Kylheku2011-11-224-2/+39
| | | | | | | | | | position after the end of the line, otherwise we can never match @(eol). (h_eol): Bugfix: do not return t, but the line length. * txr.1: Warn users about @var@(bind ...) pitfall. * RELNOTES: Updated.
* Set release date.txr-042Kaz Kylheku2011-11-201-1/+1
|
* Version 042Kaz Kylheku2011-11-204-4/+14
| | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped.