(lookup_global_symbol, lookup_symbol): New static functions.
(s_test, s_bindings, s_duplicate_bindings, s_variable): Removed.
(try_macro_lookup, literal_p): Use lookup_symbol instead of
creating a temporary pair for scm_lookupcar.
(scm_unmemocar, unmemocar): Renamed scm_unmemocar to unmemocar,
created deprecated wrapper function scm_unmemocar.
(SCM_VALIDATE_NON_EMPTY_COMBINATION, scm_sym_else,
scm_sym_unquote, scm_sym_uq_splicing, scm_sym_enter_frame,
scm_sym_apply_frame, scm_sym_exit_frame, scm_sym_trace, f_apply,
undefineds, sym_three_question_marks): Moved around without
modifications.
* eval.c, eval.h (scm_macroexp, scm_unmemocar): Deprecated.
(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.
SCM_SMOB_FREE, SCM_GLOBAL_SMOB_FREE, SCM_SMOB_PRINT,
SCM_GLOBAL_SMOB_PRINT, SCM_SMOB_EQUALP, SCM_GLOBAL_SMOB_EQUALP,
SCM_SMOB_APPLY, SCM_GLOBAL_SMOB_APPLY): New macros from Paul Jarc.
Thanks!
public use of scm_m_expand_body in eval.h. In eval.c, renamed
scm_m_expand_body to m_expand_body and made it static. Added
deprecated wrapper scm_m_expand_body.
(scm_eval_body, SCM_CEVAL, SCM_APPLY): Use m_expand_body instead
of scm_m_expand_body.
(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.
handled in scm_m_body any more, but rather in scm_m_lambda.
(scm_m_body, memoize_named_let, scm_m_let, scm_m_letstar,
scm_m_letrec, scm_m_expand_body): Check for validity is done by
calling functions of scm_m_body.
(scm_m_lambda): Avoid unnecessary consing when creating the
memoized code.
(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.
Grouped together with unmemocopy, without modifications.
(build_binding_list, unmemocopy): Renamed names of list arguments
and variables to reflect the actual order of the list elements.
(scm_m_nil_cond, scm_m_atfop, scm_m_undefine): Add comments. Use
ASSERT_SYNTAX to signal syntax errors. Avoid unnecessary consing
when creating the memoized code.
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.
ASSERT_SYNTAX to signal syntax errors. Avoid unnecessary consing
when creating the memoized code.
(scm_m_atbind): Reversed the order, in which the init expressions
are stored and executed. The order of execution is now equal to
the order in which the initializers of the let-forms are executed.
Use check_bindings and transform_bindings.
(SCM_CEVAL): Eliminated SCM_NIMP in favor of more appropriate
!SCM_NULLP. Added some comments.
* test-suite/tests/dynamic-scope.test (exception:missing-expr):
Introduced temporarily until all memoizers use the new way of error
reporting.
(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.
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.
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.
(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.
static identifiers.
(scm_m_do): 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, this way also making sure that file name, line number
information etc. remain available.
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.
s_bad_cond_clause, s_missing_recipient): New static identifiers.
(s_extra_case_clause): Removed.
(scm_m_case, scm_m_cond): If a clause appears after an else
clause, report a misplaced else clause.
(scm_m_cond): Use ASSERT_SYNTAX to signal syntax errors. Be more
specific about the kind of error that was detected. Handle bound
'else and '=>. Avoid unnecessary consing when creating the
memoized code.
(scm_m_cond, unmemocopy, SCM_CEVAL): Use SCM_IM_ELSE to memoize
the syntactic keyword 'else and SCM_IM_ARROW to memoize the
syntactic keyword '=>.
* test-suite/tests/syntax.test (exception:misplaced-else-clause,
exception:bad-cond-clause): New.
(exception:bad/missing-clauses, exception:extra-case-clause):
Removed.
Adapted tests for 'case' and 'cond' to the new way of error
reporting.
The tests that check if cond is hygienic pass now.
* libguile/print.c (scm_isymnames): Add names for the new memoizer
codes.
* libguile/eval.c (s_missing_clauses, s_bad_case_clause,
s_extra_case_clause, s_bad_case_labels, s_duplicate_case_label,
literal_p): New static identifiers.
(scm_m_case): Use ASSERT_SYNTAX to signal syntax errors. Be more
specific about the kind of error that was detected. Check for
duplicate case labels. Handle bound 'else. Avoid unnecessary
consing when creating the memoized code.
(scm_m_case, unmemocopy, SCM_CEVAL): Use SCM_IM_ELSE to memoize
the syntactic keyword 'else.
* test-suite/tests/syntax.test (exception:bad-expression,
exception:missing-clauses, exception:bad-case-clause,
exception:extra-case-clause, exception:bad-case-labels): New.
Added some tests and adapted tests for 'case' to the new way of
error reporting.
ASSERT_SYNTAX, ASSERT_SYNTAX_2): New static identifiers.
(scm_m_and): Use ASSERT_SYNTAX to signal syntax errors. Avoid
unnecessary consing when creating the memoized code.
* test-suite/lib.scm (run-test-exception): Handle syntax errors.