summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-03-04Update reference for GUILE_EXTENSIONS_PATHAndy Wingo2-4/+12
* NEWS: Update. * doc/ref/guile-invoke.texi (Environment Variables): Add entry.
2021-03-04Update documentation to incorporate read-syntaxAndy Wingo4-42/+96
* NEWS: Update a bit. * doc/ref/api-debug.texi (Source Properties): Mention read-syntax. * doc/ref/api-evaluation.texi (Annotated Scheme Read): New section. * doc/ref/api-macros.texi (Syntax Case): Update for source vectors.
2021-03-04Syntax objects print with source locationsAndy Wingo1-2/+11
* module/system/syntax.scm (print-syntax): Print source locations.
2021-03-04Add docstring for array-shapeDaniel Llorens1-2/+12
2021-03-04Fix reading improper curly-infix expressionsAndy Wingo1-3/+3
* module/ice-9/read.scm (%read): A fix to last night's fix, to make srfi-105.test pass.
2021-03-03don't presume availability of gmp.pcMichael Gran8-32/+34
This suggests moving the conditional that determines if mini-gmp is used into scmconfig.h. * configure.ac: replace PKG_CHECK_MODULES for gmp with AC_LIB_HAVE_LINKFLAGS Remove ENABLE_MINI_GMP define. Also don't run mpz_inits test for --enable-mini-gmp. * libguile/gen-scmconfig.c (main) [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP with SCM_I_GSC_ENABLE_MINI_GMP * libguile/bytevectors.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP with SCM_ENABLE_MINI_GMP * libguile/init.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP with SCM_ENABLE_MINI_GMP * libguile/numbers.c: include scm.h [SCM_ENABLE_MINI_GMP]: provide mpz_inits and mpz_clears [ENABLE_MINI_GMP]: prefer SCM_ENABLE_MINI_GMP to ENABLE_MINI_GMP * libguile/numbers.h: include scm.h * libguile/random.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP with SCM_ENABLE_MINI_GMP * libguile/socket.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP with SCM_ENABLE_MINI_GMP
2021-03-03Fix reading #c32 vectorsAndy Wingo1-1/+1
* module/ice-9/read.scm (%read): Fix a wee typo.
2021-03-03Fix some srfi-105 parsing errorsAndy Wingo1-7/+8
* module/ice-9/read.scm (%read): Fix parsing errors.
2021-03-03Fix length of \U hex escape in new readerAndy Wingo1-1/+1
* module/ice-9/read.scm (%read): \U escape is 6 digits long.
2021-03-03Remove read extension support from primitive-readAndy Wingo1-37/+5
* libguile/read.c (scm_read_sharp_extension): Remove. (scm_read_sharp): Adapt.
2021-03-03More read.c simplificationsAndy Wingo1-30/+28
* libguile/read.c: Use "return EXPR" instead of "return (EXPR)". Avoid passing around line and column info, as we don't use it any more.
2021-03-03primitive-read handles only default reader optionsAndy Wingo1-656/+122
* libguile/read.c: Remove support for all non-default reader options. Also remove support for source positions. The idea is that primitive-read should just be a stripped-down, easy-to-understand reader that is enough to bootstrap the C reader. Probably more refactoring will follow.
2021-03-03Scheme reader fully replaces C readerAndy Wingo2-4/+22
* libguile/read.h: * libguile/read.c (scm_primitive_read): New name for C reader. (scm_read): Call current value of "read" variable. (scm_init_read): Initialize "read" binding to "primitive-read". Replaced later in boot-9.
2021-03-03Fix bug in new array readerDaniel Llorens2-5/+37
* module/ice-9/read.scm (read-array): Return pair for dimension when len is given; single number is lbnd for list->typed-array. * test-suite/tests/arrays.test: More test cases for the reader.
2021-03-03Read-in-scheme replaces boot "read" definitionAndy Wingo11-46/+62
Instead of defining a separate module, given that "read" calls are quite all over the place, we're just going to replace the boot "read" binding with read.scm. This way, we'll be able to remove support for reader options in the boot reader, as it will only ever be used for a finite set of files. * NEWS: Update. * module/Makefile.am (ice-9/boot-9.go): Depend on read.scm. (SOURCES): * am/bootstrap.am (SOURCES): Don't build a ice-9/read.go, as we include it. * module/ice-9/boot-9.scm (read-syntax): Define here, as "include" now uses it. (read-hash-procedures, read-hash-procedure, read-hash-extend): New procedures. Will replace C variants. (read, read-syntax): Include read.scm to define these. * module/ice-9/psyntax-pp.scm (include): Regenerate. * module/ice-9/psyntax.scm (include): Use read-syntax, so we get better source information. * module/ice-9/read.scm (let*-values): New local definition, to avoid loading srfi-11. (%read): Use list->typed-array instead of u8-list->bytevector. * module/language/scheme/spec.scm: Remove (ice-9 read) import; read-syntax is there in the boot environment
2021-03-03Relax srfi-105 source expectationsAndy Wingo1-2/+8
* test-suite/tests/srfi-105.test ("curly-infix"): For { EXPR }, allow the source to be at the { rather than at EXPR.
2021-03-03Fix unterminated #!...!# error message in Scheme readerAndy Wingo1-1/+1
* module/ice-9/read.scm (%read): Tweak "unterminated block constant" error to be more compatible with C reader.
2021-03-03Fix reading neoteric exprs in Scheme readerAndy Wingo1-1/+1
* module/ice-9/read.scm (%read): Call the inner reader, not the outer reader.
2021-03-03Fix reader extensions in Scheme readerAndy Wingo1-1/+1
* module/ice-9/read.scm (%read): Fix invocation of hash procedure.
2021-03-03Invalid charset at EOF does not cause decoding errorAndy Wingo2-10/+3
* libguile/ports.c (peek_iconv_codepoint): If the input has no bytes, there's little point in raising a decoding error here. Therefore remove the needless iconv acquisition, harmonising with suspendable-ports. * test-suite/tests/ports.test ("port-encoding"): Update test to include some input so that the exception gets raised.
2021-03-03Remove textual-ports include from (ice-9 read)Andy Wingo1-2/+1
* module/ice-9/read.scm: We'll be loading this file early, so avoid extraneous deps.
2021-03-02improve autoconfigury for minigmpMichael Gran10-15/+23
* configure.ac: add SCM_I_GSC_ENABLE_MINI_GMP var and rename GUILE_MINI_GMP to ENABLE_MINI_GMP * libguile/bytevectors (GUILE_MINI_GMP): rename to ENABLE_MINI_GMP * libguile/gen-scmconfig.c: renamed GUILE_MINI_GMP to ENABLE_MINI_GMP. rename GUILE_MINI_GMP to SCM_ENABLE_MINI_GMP * libguile/gen-scmconfig.h: add SCM_I_GSC_ENABLE_MINI_GMP * libguile/init.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP * libguile/numbers.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP * libguile/numbers.h: include scmconfig.h rename GUILE_MINI_GMP to SCM_ENABLE_MINI_GMP * libguile/random.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP * libguile/socket.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP * libguile.h [GUILE_MINI_GMP]: prefer SCM_ENABLE_MINI_GMP
2021-03-02Enable option to prefer mini-gmp over libgmpMichael Gran12-25/+4951
* configure.ac: rework gmp library detection. Add new flag. * libguile.h: modify gmp header inclusion * libguile/Makefile.am: add mini-gmp.[ch] files * libguile/bytevectors.c: add mini-gmp headers * libguile/gen-scmconfig.c: new #include variable GUILE_MINI_GMP * libguile/init.c: add mini-gmp header * libguile/mini-gmp.c: new file * libguile/mini-gmp.h: new file * libguile/numbers.c: add fallback for missing mpz_get_d_2exp * libguile/numbers.h: yse mini-gmp header * libguile/random.c: use mini-gmp header * libguile/socket.c: use mini-gmp header
2021-03-02Fix another typo in routine reading arraysDaniel Llorens2-2/+6
* module/ice-9/read.scm: As stated. * test-suite/tests/arrays.test: Test a fixed case.
2021-03-02Fix bug reading arrays with lengthsAndy Wingo1-1/+1
* module/ice-9/read.scm (%read): Fix typo.
2021-03-01Update NEWSAndy Wingo1-0/+62
* NEWS: Start updating for new release.
2021-02-28Fix Scheme read without source positionsAndy Wingo1-1/+2
* module/ice-9/read.scm (read): Fix annotate when positions are disabled.
2021-02-25Shunt syntax-sourcev to (system syntax internal)Andy Wingo1-1/+2
* module/ice-9/boot-9.scm: Add syntax-sourcev to hidden bindings.
2021-02-25read-syntax uses vector source representationAndy Wingo1-3/+1
* module/ice-9/read.scm (read-syntax): Switch to sourcev format.
2021-02-25Psyntax uses sourcev internallyAndy Wingo2-150/+220
* module/ice-9/psyntax.scm: Use the vector representation of source properties internally. We have to convert to alists when going to Tree-IL, but this will be in harmony with syntax objects once the reader switches to vectors too. * module/ice-9/psyntax-pp.scm: Regenerate.
2021-02-25Assembler writes vector source propertiesAndy Wingo1-2/+2
* module/system/vm/assembler.scm (intern-constant, link-data): Write the vector representation of source instead of the alist. Saves a lot of heap size, object file size, and init time when serializing syntax objects with source.
2021-02-25Add syntax-sourcevAndy Wingo2-3/+53
* libguile/syntax.c (sourcev_to_props, props_to_sourcev) (scm_syntax_source, scm_syntax_sourcev): Add alternate source representation for syntax objects.
2021-02-25Optimize run-time init and relocation procedureAndy Wingo1-57/+109
* module/system/vm/assembler.scm (<asm>, make-assembler) (intern-constant, emit-init-constants): Instead of loading a dependent value each time it's needed in the relocation procedure, eagerly patch values when they are created. Allows keeping values in registers, which decreases code size.
2021-02-25Commit updates from newest autoconfAndy Wingo2-988/+1157
* ABOUT-NLS: * build-aux/config.rpath: These files were overwritten by re-bootstrapping with the newest autoconf. OK computer!
2021-02-25Read Scheme via read-syntaxAndy Wingo3-8/+16
* module/language/scheme/spec.scm: Use read-syntax. * test-suite/tests/dwarf.test: Adapt expected source locations. * am/bootstrap.am (SOURCES): Add ice-9/read.
2021-02-25Fix read-syntax on vectors and arraysAndy Wingo1-3/+3
* module/ice-9/read.scm (%read): Strip annotations from reading the array elements.
2021-02-25Ensure that (syntax ()) results in ()Andy Wingo2-34/+40
* module/ice-9/psyntax.scm: Add a special case for (). There are already special cases for pairs, vectors, etc; the issue is that with read-syntax, the () might be come into psyntax as an annotated syntax object, which here we would want to strip, to preserve the invariant to psyntax users that all lists are unwrapped.
2021-02-24Fix module scoping for datum->syntax with no identifierAndy Wingo2-115/+124
* module/ice-9/psyntax.scm: With the new behavior of datum->syntax which allows #f for the lexical context, we have the question of what module to attach to these newly created syntax objects. In that case we'll mark down #f as the module, indicating that we know nothing. We have to extend a number of other cases to default to the expander's idea of the current module, if a syntax object has no module scope. Also, change datum->syntax to attach the empty wrap, not the top wrap. Attaching the top wrap leads to multiply applying the top mark, as you recurse into subexpressions.
2021-02-24Remove top-marked? optimization from psyntaxAndy Wingo2-192/+135
* module/ice-9/psyntax.scm (strip): It used to be that terms in the source program could have a "top" mark, and when stripping marks we'd stop recursing when we see an expression with the top mark. This had the good effect that source programs could contain quoted syntax objects, or quoted objects with shared structure -- in theory anyway. In practice the compiler didn't support objects with shared structure. Anyway when we switch to "read-syntax", quoted expressions can contain syntax objects introduced by the reader, which naturally we would want to strip away in a (quote FOO) form. Therefore we remove the top-marked? optimization.
2021-02-24Add quote-syntaxAndy Wingo3-38/+47
* module/ice-9/psyntax.scm (quote-syntax): New core form. Usually the expander will unwrap all syntax objects from the input term. However sometimes you want to preserve a syntax object, as a datum. That's when you want quote-syntax. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/local-eval.scm (identifier-syntax-from-box): Use quote-syntax instead of our datum->syntax trick, which relied on psyntax's special treatment of the top mark.
2021-02-21Implement read-syntaxAndy Wingo4-40/+55
* doc/ref/api-macros.texi (Syntax Case): Update documentation for datum->syntax. * module/ice-9/psyntax.scm (datum->syntax): Use #:source keyword for source location info instead of an optional, and allow an alist. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/read.scm (%read, read): Refactor to allow read and read-syntax to share an implementation. (read-syntax): New function.
2021-02-21Document datum->syntax extensionsAndy Wingo3-62/+80
* doc/ref/api-macros.texi (Syntax Case): Document that template-id can be false, and document srcloc. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (syntax?): Allow the lexical context to be null. Allow srcloc to be a source properties alist. Inspired by Racket.
2021-02-21Adapt uses of make-syntax to preserve syntaxAndy Wingo2-68/+93
* module/ice-9/psyntax.scm (datum->syntax): Add an additional optional argument, to allow callers to provide source annotation information. * module/ice-9/psyntax-pp.scm: Regenerate.
2021-02-21psyntax preserves source via syntax objectsAndy Wingo2-79/+73
* module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (wrap, source-wrap): Preserve source via syntax objects.
2021-02-20Syntax objects have "source" fieldAndy Wingo6-31/+73
* libguile/syntax.c (scm_make_syntax): Add optional "source" argument. Note that this function is internal. (scm_syntax_source): New function, replacing definition in boot-9.scm. * libguile/syntax.h: Add new declarations. * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm (source-annotation): For syntax objects, the source annotation comes direct from the syntax object. * module/system/vm/assembler.scm (link-data, intern-constant): Write 5-word syntax objects.
2021-02-17Use lists instead of string ports to accumulate resultsAndy Wingo1-70/+61
* module/ice-9/read.scm (read): Use lists, like read-delimited does. About 30% faster.
2021-02-17Fix read.scm bugs related to nonstandard reader optionsAndy Wingo1-12/+10
* module/ice-9/read.scm (compute-reader-options): Fix handling of reader options, inline and otherwise.
2021-02-17Improve read error reportingAndy Wingo1-43/+50
* module/ice-9/read.scm (read): Issue properly formatted read-errors, as users expect.
2021-02-17Scheme read respects "positions" reader optionAndy Wingo1-1/+2
* module/ice-9/read.scm (read): Don't add source positions if the option is off.
2021-02-17More read micro-optimizationsAndy Wingo1-3/+3
* module/ice-9/read.scm (read): Use R5RS read-char, peek-char, write-char rather than (ice-9 textual-ports) wrappers, because the latter are expressed in terms of the former.