1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

68 commits

Author SHA1 Message Date
Andy Wingo
a41bed83ab Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/read.c
	test-suite/tests/tree-il.test
2012-02-11 18:14:48 +01:00
Mark H Weaver
e7cf0457d7 Support => within case, and improve error messages for cond and case
* module/ice-9/boot-9.scm (cond, case): Reimplement using syntax-case,
  with improved error messages and support for '=>' within 'case' as
  mandated by the R7RS.  Add warnings for duplicate case datums and
  case datums that cannot be meaningfully compared using 'eqv?'.

* module/system/base/message.scm (%warning-types): Add 'bad-case-datum'
  and 'duplicate-case-datum' warning types.

* test-suite/tests/syntax.test (cond, case): Update tests to reflect
  improved error reporting.  Add tests for '=>' within 'case'.

* test-suite/tests/tree-il.test (partial evaluation): Update tests to
  reflect changes in how 'case' is expanded.

* doc/ref/api-control.texi (Conditionals): Document '=>' within 'case'.
2012-02-08 16:27:48 -05:00
Andy Wingo
91ee7515da Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/__scm.h
	libguile/array-map.c
	libguile/procprop.c
	libguile/tags.h
	module/ice-9/deprecated.scm
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
	test-suite/standalone/test-num2integral.c
	test-suite/tests/regexp.test
2012-01-10 00:41:42 +01:00
Andy Wingo
0bdd43515e Merge commit 'f78a1ccede' 2012-01-10 00:23:49 +01:00
Andy Wingo
bbc2364a3e Merge commit 'cc8afa2b36'
Conflicts:
	module/ice-9/psyntax-pp.scm
	module/language/tree-il/peval.scm
2012-01-10 00:21:48 +01:00
Ludovic Courtès
9133716faa Fix the exception type of the (begin) test.
* test-suite/tests/syntax.test (exception:zero-expression-sequence): New
  variable.
  ("begin")["legal (begin)"]: Rename to "valid (begin)".
  ["illegal (begin)"]: Ditto.  Expect `exception:zero-expression-sequence'.
2012-01-05 23:49:01 +01:00
Ludovic Courtès
f78a1ccede Raise an error for (begin) when `--disable-deprecated'.
* module/ice-9/psyntax.scm (define-expansion-constructors)[begin-form]:
  Emit a syntax-violation error for empty sequences when
  --disable-deprecated.

* test-suite/tests/syntax.test (pass-if-syntax-error): Fix typo in error
  message.
2012-01-05 22:38:06 +01:00
Andy Wingo
dc65d1cf5b document invalidity of (begin) as expression; add back-compat shim
* doc/ref/api-control.texi (begin): Update to distinguish between
  splicing begin and sequencing begin.

* module/ice-9/psyntax.scm (expand-expr): Add a back-compatibility shim
  for `(begin)'.
* module/ice-9/psyntax-pp.scm: Regenerate.

* test-suite/tests/syntax.test: Update to run illegal (begin) test only
  if we are not including deprecated features.
2011-12-21 20:14:59 -05:00
Andy Wingo
adf91e1cc5 add tests for hygienic name introduction
* test-suite/tests/syntax.test ("top-level define"): Add tests for
  hygienic introduction of names.
2011-11-07 11:48:04 +01:00
Andy Wingo
ab2d0f8f0c another scoping test
* test-suite/tests/syntax.test ("top-level define"): Add another test
  for scoping.
2011-11-07 11:45:15 +01:00
Andy Wingo
1ce645567d add scoping test
* test-suite/tests/syntax.test ("top-level define"): Add a test for
  module scoping of introduced identifiers.
2011-11-07 11:42:29 +01:00
Andy Wingo
91956a94fe allow while as an expression
* module/ice-9/boot-9.scm (while): Specify the return value as #f under
  normal conditions, #t under (break), and arg... under (break arg...).
* test-suite/tests/syntax.test ("while"): Test.
* doc/ref/api-control.texi (while do): Document.
2011-04-28 15:48:35 +02:00
Andy Wingo
36ad25332e fix quasiquote test
* test-suite/tests/syntax.test ("quasiquote"): Fix unquote-splicing
  extra args test to update for current behavior.
2011-02-08 22:43:43 +01:00
Andy Wingo
e75184d5d2 adapt tests to new syntax-error form
* test-suite/tests/syntax.test (pass-if-syntax-error): Fix up for new
  form of syntax errors. Adapt all tests.

* test-suite/tests/srfi-17.test: Likewise.
2010-11-18 11:04:15 +01:00
Andy Wingo
31fe120216 fix matches? test
* test-suite/tests/syntax.test (matches?): Unfortunately this relatively
  recent macro fails due to the underscore-in-literals-list prohibition.
  But, it seems I was in the minority wanting _ for a literal.
2010-06-21 21:06:29 +02:00
Andy Wingo
5f8c55ce3b fix order of internal definitions
* module/ice-9/psyntax.scm (chi-body): Whoops, actually render internal
  definitions into a letrec* in the right order.
* module/ice-9/psyntax-pp.scm: Regenerate.

* test-suite/tests/syntax.test: Add some letrec* tests.
2010-06-17 14:39:32 +02:00
Andy Wingo
10e69149f6 while in terms of syntax-case
* module/ice-9/boot-9.scm (while): Reimplement in terms of syntax-case.
  Prompt inlining is coming later.

* test-suite/tests/syntax.test ("while"): Update the expected syntax
  errors.
2010-06-11 16:58:36 +02:00
Andy Wingo
5f1611640a really boot primitive-eval from scheme.
* libguile/eval.c (scm_primitive_eval, scm_c_primitive_eval):
  (scm_init_eval): Rework so that scm_primitive_eval always calls out to
  the primitive-eval variable. The previous definition is the default
  value, which is probably overridden by scm_init_eval_in_scheme.

* libguile/init.c (scm_i_init_guile): Move ports and load-path up, so we
  can debug when initing eval. Call scm_init_eval_in_scheme. Awesome.

* libguile/load.h:
* libguile/load.c (scm_init_eval_in_scheme): New procedure, loads up
  ice-9/eval.scm to replace the primitive-eval definition, if everything
  is there and up-to-date.

* libguile/modules.c (scm_module_transformer): Export to Scheme, so it's
  there for eval.go.

* module/ice-9/boot-9.scm: No need to define module-transformer.

* module/ice-9/eval.scm (capture-env): Only reference the-root-module if
  modules are booted.
  (primitive-eval): Inline a definition for identity. Throw a more
  standard error for "wrong number of arguments".

* module/ice-9/psyntax.scm (chi-install-global): The macro binding for a
  syncase macro is now a pair: the transformer, and the module that was
  current when the transformer was installed. The latter is used for
  hygiene purposes, replacing the use of procedure-module, which didn't
  work with the interpreter's shared-code closures.
  (chi-macro): Adapt for the binding being a pair, and get the hygiene
  from the cdr.
  (eval-local-transformer): Adapt to new form of macro bindings.

* module/ice-9/psyntax-pp.scm: Regenerated.

* .gitignore: Ignore eval.go.stamp.

* module/Makefile.am: Reorder for fastest serial compilation, now that
  there are no ordering constraints. I did a number of experiments here
  and this seems to be the best; but the bulk of the time is compiling
  psyntax-pp.scm with eval.scm. Not so great.

* libguile/vm-engine.c (vm-engine): Throw a more standard error for
  "wrong type to apply".

* test-suite/tests/gc.test ("gc"): Remove a hack that shouldn't affect
  the new evaluator, and throw in another (gc) for good measure.

* test-suite/tests/goops.test ("defining classes"):
* test-suite/tests/hooks.test (proc1): We can't currently check what the
  arity is of a closure made by eval.scm -- or more accurately all
  closures have 0 required args and no rest args. So punt for now.

* test-suite/tests/syntax.test ("letrec"): The scheme evaluator can't
  check that a variable is unbound, currently; perhaps the full "fixing
  letrec" expansion could fix this. But barring that, punt.
2009-12-03 00:00:38 +01:00
Andy Wingo
b7742c6b71 new evaluator, y'all
* libguile/eval.c: So, ladies & gents, a new evaluator. It's similar to
  the old one, in that we memoize and then evaluate, but in this
  incarnation, memoization of an expression happens before evaluation,
  not lazily as the expression is evaluated. This makes the evaluation
  itself much cleaner, in addition to being threadsafe. In addition,
  since this C evaluator will in the future just serve to bootstrap the
  Scheme evaluator, we don't have to pay much concern for debugging
  conveniences. So the environment is just a list of values, and the
  memoizer pre-computes where it's going to find each individual value
  in the environment.

  Interface changes are commented below, with eval.h.

  (scm_evaluator_traps): No need to reset the debug mode after rnning te
  traps thing. But really, the whole traps system needs some love.

* libguile/memoize.h:
* libguile/memoize.c: New memoizer, which runs before evaluation,
  checking all syntax before evaluation begins. Significantly, no
  debugging information is left for lexical variables, which is not so
  great for interactive debugging; perhaps we should change this to have
  a var list in the future as per the classic interpreters. But it's
  quite fast, and the resulting code is quite good. Also note that it
  doesn't produce ilocs, memoized code is a smob whose type is in the
  first word of the smob itself.

* libguile/eval.h (scm_sym_and, scm_sym_begin, scm_sym_case)
  (scm_sym_cond, scm_sym_define, scm_sym_do, scm_sym_if, scm_sym_lambda)
  (scm_sym_let, scm_sym_letstar, scm_sym_letrec, scm_sym_quote)
  (scm_sym_quasiquote, scm_sym_unquote, scm_sym_uq_splicing, scm_sym_at)
  (scm_sym_atat, scm_sym_atapply, scm_sym_atcall_cc)
  (scm_sym_at_call_with_values, scm_sym_delay, scm_sym_eval_when)
  (scm_sym_arrow, scm_sym_else, scm_sym_apply, scm_sym_set_x)
  (scm_sym_args): Remove public declaration of these symbols.
  (scm_ilookup, scm_lookupcar, scm_eval_car, scm_eval_body)
  (scm_eval_args, scm_i_eval_x, scm_i_eval): Remove public declaration
  of these functions.
  (scm_ceval, scm_deval, scm_ceval_ptr): Remove declarations of these
  deprecated functions.
  (scm_i_print_iloc, scm_i_print_isym, scm_i_unmemocopy_expr)
  (scm_i_unmemocopy_body): Remove declarations of these internal
  functions.
  (scm_primitive_eval_x, scm_eval_x): Redefine as macros for their less
  destructive siblings.

* libguile/Makefile.am: Add memoize.[ch] to the build.

* libguile/debug.h (scm_debug_mode_p, scm_check_entry_p)
  (scm_check_apply_p, scm_check_exit_p, scm_check_memoize_p)
  (scm_debug_eframe_size): Remove these vars that were tied to the old
  evaluator's execution model.
  (SCM_RESET_DEBUG_MODE): Remove, no more need for this.
  (SCM_MEMOIZEDP, SCM_MEMOIZED_EXP, SCM_MEMOIZED_ENV): Remove macros
  referring to old memoized code representation.
  (scm_local_eval, scm_procedure_environment, scm_memoized_environment)
  (scm_make_memoized, scm_memoized_p): Remove functions operating on old
  memoized code representation.
  (scm_memcons, scm_mem_to_proc, scm_proc_to_mem): Remove debug-only
  code for old evaluator.

* libguile/debug.c: Remove code to correspond with debug.h removals.
  (scm_debug_options): No need to set the debug mode or frame limit
  here, as we don't have C stack limits any more. Perhaps this is a bug,
  but as long as we can compile eval.scm, we should be fine.

* libguile/init.c (scm_i_init_guile): Init memoize.c.

* libguile/modules.c (scm_top_level_env, scm_env_top_level)
  (scm_env_module, scm_system_module_env_p): Remove these functions.

* libguile/print.c (iprin1): No more need to handle isyms. Adapt to new
  form of interpreted procedures.

* libguile/procprop.c (scm_i_procedure_arity): Adapt to new form of
  interpreted procedures.

* libguile/procs.c (scm_thunk_p): Adapt to new form of interpreted
  procedures.
* libguile/procs.h (SCM_CLOSURE_FORMALS): Removed, this exists no more.
  (SCM_CLOSURE_NUM_REQUIRED_ARGS, SCM_CLOSURE_HAS_REST_ARGS): New
  accessors.

* libguile/srcprop.c (scm_source_properties, scm_source_property)
  (scm_set_source_property_x): Remove special cases for memoized code.

* libguile/stacks.c (read_frame): Remove a source-property case for
  interpreted code.
  (NEXT_FRAME): Remove a case that I don't fully understand, that seems
  to be designed to skip over apply frames. Will be obsolete in the
  futures.
  (read_frames): Default source value for interpreted frames to #f.
  (narrow_stack): Don't pay attention to the system_module thing.

* libguile/tags.h: Remove isyms and ilocs. Whee!

* libguile/validate.h (SCM_VALIDATE_MEMOIZED): Fix to use the new
  MEMOIZED_P formulation.

* module/ice-9/psyntax-pp.scm (do, quasiquote, case): Adapt for these no
  longer being primitive macros.
* module/ice-9/boot-9.scm: Whitespace change, but just a poke to force a
  rebuild due to and/or/cond/... not being primitives any more.

* module/ice-9/deprecated.scm (unmemoize-expr): Deprecate, it's
  unmemoize-expression now.

* test-suite/tests/eval.test ("define set procedure-name"): XFAIL a
  couple of tests here; I don't know what to do about them. I reckon the
  expander should ensure that defined values are named.

* test-suite/tests/chars.test ("basic char handling"): Fix expected
  exception when trying to apply a char.
2009-12-01 21:00:26 +01:00
Andy Wingo
c89222f8ce refactor psyntax.scm's treatment of lambda and lambda*
* module/ice-9/psyntax.scm (lambda-formals, chi-simple-lambda)
  (lambda*-formals, chi-lambda-case): Refactor the lambda
  transformations with an eye to being able to do case-lambda.

* module/ice-9/psyntax-pp.scm: Regenerated.

* test-suite/tests/syntax.test: Adapted tests so that the errors we
  expect match what is given by psyntax.
2009-10-25 12:36:44 +01:00
Andy Wingo
afe5e6baa7 eval is actually compile
* module/ice-9/boot-9.scm (eval): Here at the tail of boot-9, replace
  the root definition of `eval' with a procedure that will call
  `compile'.

* test-suite/tests/syntax.test ("top-level define"):
  ("internal define"): Run unmemoization tests in the interpreter, using
  primitive-eval.
2009-08-20 18:52:51 +02:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Andy Wingo
9ecac781bf syntax.test is passing, yay
* test-suite/tests/syntax.test ("top-level define"): Remove the test for
  currying, as we don't do that any more by default. It should be easy
  for the user to add in if she wants it, though.
  ("do"): Remove unmemoization tests, as sc-expand fully expands `do'.
  ("while"): Remove while tests in empty environments. They have been
  throwing 'unresolved, and the problem they seek to test is fully
  handled by hygiene anyway.

  And otherwise tweak expected exception strings, and everything passes!
2009-05-22 12:22:39 +02:00
Andy Wingo
dc1eed52f7 residualize names into procedures. re-implement srfi-61. module naming foo.
* module/ice-9/boot-9.scm (cond): Implement srfi-61; most of the code is
  from the SRFI itself. Yuk.
  (%print-module, make-modules-in, %app, (%app modules))
  (module-name): Syncase needs to get at the names of modules, even at
  anonymous modules. So lazily assign gensyms as module names. Name %app
  as (%app), but since (%app modules) is at the top of the module
  hierarchy, name it ().

* module/ice-9/psyntax.scm: When building tree-il, try to name lambdas in
  definitions and in lets.
  (let, letrec): Give more specific errors in a couple of cases.

* module/ice-9/psyntax-pp.scm: Regenerated.

* test-suite/tests/syntax.test: More work. Many exceptions have different
  messages than they used to, many more generic; we can roll this back to
  be faithful to the original strings, but it doesn't seem necessary to
  me.
2009-05-22 12:08:50 +02:00
Andy Wingo
0260421208 some work on syntax.test
* module/language/tree-il.scm (tree-il->scheme):
* module/ice-9/psyntax.scm (build-conditional): Attempt to not generate
  (if #f #f) as the second arm of an if, but it doesn't seem to be
  successful.

* module/ice-9/psyntax-pp.scm (syntax-rules): Regenerate.

* test-suite/tests/syntax.test (exception:unexpected-syntax): Change
  capitalization.
  ("unquote-splicing"): Update test.
  ("begin"): Add in second arms on these ifs, to avoid the strange though
  harmless expansion of `if'.
  (matches?): New helper macro.
  ("lambda"): Match on lexically bound symbols, as they will be
  alpha-renamed.
2009-05-21 22:43:07 +02:00
Andy Wingo
40b36cfbbe catch syntax errors in unquote and unquote-splicing
* module/ice-9/psyntax.scm (quasiquote): Catch syntax errors in unquote
  and unquote-splicing.

* module/ice-9/psytax-pp.scm: Regenerated.
2009-05-21 22:11:48 +02:00
Andy Wingo
ce09ee1989 add tree-il->glil compilation test suite
* module/language/tree-il.scm (parse-tree-il): Fix a number of bugs.
  (unparse-tree-il): Apply takes rest args now.

* module/language/tree-il/analyze.scm (analyze-lexicals)
  (analyze-lexicals): Heap vars shouldn't increment the number of locals.

* module/language/tree-il/optimize.scm (resolve-primitives!): Don't
  resolve public refs to primitives, not at the moment anyway.

* test-suite/Makefile.am (SCM_TESTS): Add tree-il test.

* test-suite/lib.scm (pass-if, expect-fail, pass-if-exception)
  (expect-fail-exception): Rewrite as syntax-rules macros. In a very
  amusing turn of events, it turns out that bindings introduced by
  hygienic macros are not visible inside expansions produced by
  defmacros. This seems to be expected, so go ahead and work around the
  problem.

* test-suite/tests/srfi-31.test ("rec special form"): Expand in eval.

* test-suite/tests/syntax.test ("begin"): Do some more expanding in eval,
  though all is not yet well.

* test-suite/tests/tree-il.test: New test suite, for tree-il->glil
  compilation.
2009-05-18 23:45:35 +02:00
Ludovic Courtès
9ee0f67880 Changes from arch/CVS synchronization 2007-07-18 20:25:38 +00:00
Ludovic Courtès
3dcf33733c Changes from arch/CVS synchronization 2007-05-26 14:30:50 +00:00
Kevin Ryde
6e7d5622ee merge from 1.8 branch 2006-04-16 23:37:40 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Kevin Ryde
2ebe323a15 (while): Tests running in empty environment are
now "unresolved" do to workaround in while implementation.
2005-01-27 21:23:09 +00:00
Dirk Herrmann
c454c4e624 * tests/syntax.test: Added tests for unmemoization. 2004-10-03 06:15:22 +00:00
Marius Vollmer
0ac467456b * lib.scm (exception:used-before-define): New.
* tests/syntax.test ("letrec"): Use it.
2004-08-23 10:48:51 +00:00
Dirk Herrmann
aa498d0c1b * tests/syntax.test: Added various tests to check that
unmemoization works correctly.
2004-05-31 15:31:04 +00:00
Dirk Herrmann
36245b66c2 * libguile/eval.c (s_macro_keyword): New static identifier.
(scm_m_define): Change order to first create binding and
	evaluating the expression afterwards.

	(scm_m_set_x): Memoize complete set! expression.  Only leave
	symbols if no binding exists at memoization time.  Throw error if
	assigning to a syntactic keyword.

	(lazy_memoize_variable): New function.

	(CEVAL): When execution set!, perform lazy memoization if
	unmemoized symbol is detected.

	* libguile/modules.c (module_variable): Return variables with
	unbound value.

	* libguile/tags.h: Fix comment.

	* test-suite/tests/syntax.test: Add test case to check the correct
	handling of define expressions.
2004-04-26 19:59:03 +00:00
Dirk Herrmann
a264c013fd * tests/syntax.test: Added test for unmemoizing internal defines. 2004-01-23 14:24:37 +00:00
Marius Vollmer
96dfea7d7e It's "#\\space", not "#\space". 2003-11-30 00:58:25 +00:00
Dirk Herrmann
c86c440b17 * libguile/eval.c (s_mixed_body_forms): New static identifier.
(canonicalize_define, scm_m_define): The check for a bad
	expression is performed in canonicalize_define now.

	(try_macro_lookup, expand_user_macros, is_system_macro_p): New
	static helper functions for m_expand_body.

	(m_expand_body): Use ASSERT_SYNTAX to signal syntax errors.  Only
	expand user defined macros.  Fixed handling of the definition/
	expression boundary.  Fixed handling of definitions grouped with
	'begin.  Use canonicalize_define to expand definitions.

	* test-suite/tests/syntax.test: Tests that check for the correct
	handling of internal defines with begin work now.
2003-11-15 12:27:54 +00:00
Dirk Herrmann
c3d948015a * tests/syntax.test: Fixed test that checks for the correct
handling of macros in the context of internal defines.
2003-11-15 11:51:17 +00:00
Dirk Herrmann
560434b369 * tests/optargs.test: Wrap tests in module (test-suite
test-<file-name without .test>).  Rewrite test to be R5RS
	conforming.

	* tests/syntax.test: Added test to check correct handling of
	internal defines.
2003-11-09 19:07:41 +00:00
Dirk Herrmann
ced8edb0f9 * libguile/eval.c (s_missing_body_expression): New static identifier.
(s_body): Removed.

	(scm_m_expand_body): Fixed core dump when passing a body with
	defines, but without expressions (see additions to syntax.test).
	Use ASSERT_SYNTAX to signal syntax errors.

	* test-suite/tests/syntax.test (exception:missing-body-expr): New.

	Renamed section 'define' to 'top-level define' and added a new
	section 'internal define' with some tests.
2003-11-08 08:11:14 +00:00
Dirk Herrmann
89bff2fc10 * libguile/eval.c (s_expression): Added comment.
(s_empty_combination, error_unbound_variable): New static
	identifiers.

	(SCM_VALIDATE_NON_EMPTY_COMBINATION, SCM_EVALIM2, scm_lookupcar1):
	Use ASSERT_SYNTAX, syntax_error or error_unbound_variable to
	signal syntax errors.

	(SCM_CEVAL): Separated handling of evaluator bytecodes and other
	scheme objects.

	* test-suite/tests/syntax.test (exception:missing/extra-expr-misc):
	Removed.

	(exception:illegal-empty-combination): New.

	(exception:missing/extra-expr): Unified capitalization.

	Adapted test for '()' to the new way of error reporting.
2003-11-01 07:26:44 +00:00
Dirk Herrmann
da48db629c * libguile/eval.c (scm_m_cont, scm_m_at_call_with_values,
scm_m_generalized_set_x): Use ASSERT_SYNTAX to signal syntax
	errors.  Avoid unnecessary consing when creating the memoized
	code.

	(scm_m_generalized_set_x): Let scm_m_set_x handle the R5RS
	standard case.  Make sure line and file information are copied to
	every created expression.

	* test-suite/tests/syntax.test (exception:bad-var): Removed.

	Adapted tests for 'set!' to the new way of error reporting.
2003-10-18 18:26:43 +00:00
Dirk Herrmann
216286857b * libguile/eval.c: Sorted include files alphabetically.
(scm_m_begin): Added comment.

	(scm_m_or): Use ASSERT_SYNTAX to signal syntax errors.  Avoid
	unnecessary consing when creating the memoized code.

	(iqq, scm_m_quasiquote, scm_m_quote): Use ASSERT_SYNTAX to signal
	syntax errors.  Be more specific about the kind of error that was
	detected.

	(scm_m_quote, unmemocopy): As an optimization, vector constants
	are now inserted unquoted into the memoized code.  During
	unmemoization the quotes are added again to provide syntactically
	correct code.

	* test-suite/tests/syntax.test (exception:missing/extra-expr,
	exception:missing/extra-expr-misc): Renamed
	exception:missing/extra-expr to exception:missing/extra-expr-misc.

	(exception:missing/extra-expr-syntax,
	exception:missing/extra-expr): Renamed
	exception:missing/extra-expr-syntax to
	exception:missing/extra-expr.
2003-10-18 14:49:55 +00:00
Dirk Herrmann
d6754c2398 * libguile/eval.c (scm_m_let, scm_m_letstar, scm_m_letrec,
scm_m_expand_body, check_bindings): Extracted syntax checking of
	bindings to new static function check_bindings.

	(scm_m_let, memoize_named_let): Extracted handling of named let to
	new static function memoize_named_let.

	(transform_bindings, scm_m_let, scm_m_letstar, scm_m_letrec): Use
	ASSERT_SYNTAX to signal syntax errors.  Be more specific about the
	kind of error that was detected.  Avoid use of SCM_CDRLOC.  Avoid
	unnecessary consing when creating the memoized code.

	* test-suite/lib.scm (exception:bad-variable): New.

	* test-suite/tests/syntax.test (exception:bad-binding,
	exception:duplicate-binding): New.

	(exception:duplicate-bindings): Removed.

	Adapted tests for 'let', 'let*' and 'letrec' to the new way of
	error reporting.
2003-10-18 12:07:39 +00:00
Dirk Herrmann
03a3e94134 * libguile/eval.c (s_bad_formals, s_bad_formal, s_duplicate_formal):
New static identifiers.

	(s_clauses, s_formals, s_duplicate_formals): Removed.

	(scm_m_lambda): Use ASSERT_SYNTAX to signal syntax errors.  Be more
	specific about the kind of error that was detected.  Prepare for
	easier integration of changes for separated memoization.

	* test-suite/tests/syntax.test (define exception:bad-formal, define
	exception:duplicate-formal): New.

	(exception:duplicate-formals): Removed.

	(exception:bad-formals): Adapted to the new way of error
	reporting.

	Adapted tests for 'lambda' to the new way of error reporting.
2003-10-12 20:47:32 +00:00
Dirk Herrmann
4faa1ea021 * tests/syntax.test (exception:missing/extra-expr-syntax): Fixed
to be unaware of whether line number information is given or not.
2003-10-12 13:38:58 +00:00
Dirk Herrmann
4610b011a7 * libguile/eval.c (s_duplicate_binding): New static identifier.
(scm_m_case): Call scm_c_memq instead of implementing it inline.

	(scm_m_define): Added comment about how we check for duplicate
	formals.

	(scm_m_do): Added check for duplicate bindings.

	(scm_m_if): Use ASSERT_SYNTAX to signal syntax errors.  Avoid
	unnecessary consing when creating the memoized code.

	(scm_c_improper_memq, c_improper_memq, scm_m_lambda): Renamed
	scm_c_improper_memq to c_improper_memq, since it is not exported.

	(transform_bindings): Call scm_c_memq rather than
	scm_c_improper_memq.

	(SCM_CEVAL): Simplified handling of SCM_IM_IF forms.

	* test-suite/tests/syntax.test (exception:missing/extra-expr-syntax):
        New, introduced temporarily until all memoizers use the new way of
	error reporting.

	Adapted tests for 'if' to the new way of error reporting.
2003-10-12 12:58:51 +00:00
Dirk Herrmann
cc56ba8062 * libguile/eval.c (s_missing_expression, s_bad_variable): New static
identifiers.

	(scm_m_define): Use ASSERT_SYNTAX to signal syntax errors.  Prefer
	R5RS terminology for the naming of variables.  Be more specific
	about the kind of error that was detected.  Make sure file name,
	line number etc. are added to all freshly created expressions.
	Avoid unnecessary consing when creating the memoized code.

	* test-suite/tests/syntax.test (exception:missing-expr,
	exception:extra-expr): New.

	Adapted tests for 'begin' to the new way of error
	reporting.
2003-10-11 16:03:29 +00:00