1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-17 16:47:22 +03:00
Commit Graph

2758 Commits

Author SHA1 Message Date
Ben Harris
26460a25ff README: Correct a stray mention of PL/pgSQL in the PL/SQL section. 2019-07-07 10:31:36 +01:00
Ben Harris
e007416e0c README: Correct capitalisation of "PostScript" and "Ghostscript". 2019-07-07 10:31:36 +01:00
Ben Harris
69990448a0 README: Escape asterisks in "SQL*Plus". 2019-07-07 10:31:36 +01:00
Ben Harris
31ef021712 python: Correct spelling in a test comment. 2019-07-07 10:31:36 +01:00
Joel Martin
eacb46df65
Merge pull request #394 from bjh21/bjh21-unterminated-string-fixes
Unterminated string fixes: c, d
2019-06-11 10:54:31 -04:00
Joel Martin
ded1d76bf7
Merge pull request #396 from inkydragon/fix-test-on-windows
run test on cygwin
2019-06-03 11:05:00 -04:00
woclass
c89b2a6f7d run test on cygwin 2019-06-02 22:22:52 +08:00
Joel Martin
05531aa0a4
Merge pull request #389 from bjh21/bjh21-mal-kw-outer
mal: Use a keyword to link each environment to its outer one.
2019-05-31 12:27:27 -04:00
Ben Harris
c20b346487 mal: Use a keyword to link each environment to its outer one.
Heretofore, the mal implementation has linked each environment to its
outer environment by defining a special symbol, '--outer--' in that
environment.  This causes that symbol to be unusable by programs running
under that implementation.  For instance:

  (def! foo 123)
  (def! f (fn* (--outer--) foo))
  (f)

gives an error because overwriting '--outer--' breaks the environment
chain.

Happily, mal provides a way around this.  Keywords are guaranteed to
work as hashmap keys, so by using a keyword instead of a string as the
key for the outer environment, it can be hidden from user code.  This
also provides a motivation for keywords, which aren't otherwise used by
the mal implementation.
2019-05-31 10:04:45 +01:00
Joel Martin
4aa1c85b88 travis_trigger.sh: Support .com and env var tokens 2019-05-30 22:50:20 -05:00
Joel Martin
108d07a2ab Travis: travis_trigger.sh script. 2019-05-30 22:16:46 -05:00
Joel Martin
eff950f40d
Merge pull request #393 from bjh21/bjh21-bbc-basic
bbc-basic: Increase Brandy heap size so we run out of memory less
2019-05-30 23:15:00 -04:00
Ben Harris
aa39ccbcb1 d: Detect more unterminated strings.
Rather than checking for a trailing '"' to detect unterminated string
tokens, use a regexp (derived from the tokenizing regexp) to do so.
This correctly handles cases where a token ending with '"' isn't a
valid string.
2019-05-30 23:39:46 +01:00
Ben Harris
07a6a32062 bbc-basic: Enlarge Brandy's heap size.
Having found the perfect mal heap size to get self-hosting to work in
64-bit Brandy, I tried the performance tests, and they failed.  I've
therefore accepted that I need to increase Brandy's heap size, so I'm
doubling it to a megabyte.  That doesn't seem especially generous on
modern hardware.
2019-05-30 23:02:53 +01:00
Ben Harris
022d4cb9f7 bbc-basic: Slight tweak to heap size.
Making the mal heap very slightly smaller allows the self-hosting test
to complete on a 64-bit host.

This is really not the right approach, though.  I should really just
give in and specify "-size 1024k" to Brandy, or have the GC somehow
detect that we're wasting a lot of memory on strings and it should run
early.  At the moment, there's a tiny range of heap sizes that
actually work.
2019-05-30 22:31:12 +01:00
Ben Harris
471535e485 c: Detect more unterminated strings.
I split the string-recognizing part of the read_atom regexp in two, one
part for recognising valid strings (using a fragment of the tokenising
regexp) and another to recognize invalid strings.  This follows the
practice of other implementations with a single read_atom regexp.
2019-05-30 21:44:48 +01:00
Joel Martin
a003046c8d Travis: combine build into .travis_test.sh 2019-05-29 22:41:35 -05:00
Joel Martin
6c4cc8adb2 Various small self-host mode fixes.
- clojure (cljs): self-host arity fix. Apparently ClojureScript
  functions that have metadata attached only support arity of 20. This
  is problem during self-host because the main EVAL cond macro is 22
  items so it blows up when applied in macroexpand. So we preserve the
  origin unadorned function through to macroexpand and use it there
  instead of the adorned function/macro.
- basic: fix build when in self-host qbasic mode.
- coffee, cs, dart, elisp, hy, rexx, vb: fix self-host reader errs. Preserve
  or extract the correct error message in try*/catch* loops so that it
  works for self-host error message printing as well.
- mal: pathing issue in ./run script that affected the wasm
  implementation path permissions
- miniMAL: remove extraneous command line printing of "nil".
- ps: inc function was not actually defined.
- rust: write warning about missing .mal-history to stderr to fix
  self-host failure in step6.
- wasm: the map function was stopping on nil values; fix the list end
  check. Double the macroexpand stack so that sumdown test in stepA
  tests passes without mac stack overflow.
- yorick: read from /dev/stdin in readline builtin function.
2019-05-29 21:18:52 -05:00
Joel Martin
7864f19b1b Travis: detect special self-host-test branch.
- If the branch name is "self-host-test" then do self-hosted test.
- Fix pass through of *_MODE values during self-hosting.
- Add capability to skip of build/test/perf during self-host.
- Skip self-host for basic, io, logo, make.
- Reformat travis.yml list for better alignment
2019-05-29 21:15:00 -05:00
Joel Martin
ad4f7b1f62
Merge pull request #390 from bjh21/bjh21-bbc-basic
bbc-basic: Assorted fixes
2019-05-28 16:55:24 -04:00
Ben Harris
94d9649533 bbc-basic: Shrink mal heap a little.
On 64-bit systems, Brandy uses rather a lot of memory for string arrays,
so having the heap too large runs it out of memory.
2019-05-28 20:48:56 +01:00
Ben Harris
b0d6aa71bd bbc-basic: Add comment explaining sizing of mal heap. 2019-05-28 20:47:13 +01:00
Joel Martin
97e1fd50a1
Merge pull request #388 from bjh21/bjh21-large-files-step6
step6: Test loading of a large (>255 byte) file earlier than before.
2019-05-28 13:30:27 -04:00
Joel Martin
7607476876
Merge pull request #392 from asarhaddon/ada-unterminated-string
ada: fix the fix for unterminated strings
2019-05-28 13:26:25 -04:00
Joel Martin
a10fc90306
Merge pull request #391 from asarhaddon/test-let-recursive-def
Test mutual recursion in let*
2019-05-28 13:22:41 -04:00
Nicolas Boulenguez
8734e2eb01 Test mutual recursion in let* without vectors, which are deferrable.
Thanks to bjh21 for spotting this inconsistency.
2019-05-28 16:36:21 +02:00
Nicolas Boulenguez
7b2080df7c ada: fix the fix for unterminated strings
Thanks bjh21. I have been distracted by a less important issue (should
"\a" be read as "\a" or "a"?).
2019-05-28 16:22:21 +02:00
Nicolas Boulenguez
8150202bed Test mutual recursion in let* 2019-05-28 15:18:57 +02:00
Ben Harris
869a03e475 bbc-basic: Fix accidental quadratic behaviour in string handling.
The code for constructing long strings in FNstring_concat and 'slurp'
was accidentally quadratic in the size of output.  This meant that it
consumed BASIC heap space in inordinate quantities for storing strings.
Mal doesn't monitor the usage of the BASIC heap, so it didn't run the
garbage collector and instead suffered a fatal error.  Making these
functions use sane amounts of memory avoids that problem.
2019-05-27 22:51:09 +01:00
Ben Harris
7df7eeecbf step6: Test loading of a large (>255 byte) file earlier than before.
I just introduced a bug in the BBC BASIC implementation meaning that
'load-file' was broken on files over 255 bytes long, and it was only
caught by the optional test of 'time-ms' in step A.  This change brings
forward the relevant part of that test so the failure can be detected
earlier and more obviously, at the same time as the other tests of
'load-file'.
2019-05-27 22:32:16 +01:00
Joel Martin
221151f608
Merge pull request #386 from asarhaddon/test-let-recursive-def
test recursive definitions in let*
2019-05-27 15:49:02 -04:00
Joel Martin
b37d10ad34
Merge pull request #385 from asarhaddon/ada-unterminated-string
ada: fix unterminated string and creation of object directory by Make.
2019-05-27 15:42:13 -04:00
Ben Harris
e55d7a2d9a bbc-basic: Clean up long-string support.
When I first implemented support for strings over 255 characters long, I
did so quite crudely, and the procedures to construct long strings
modified the mal objects passed into them.  This was unfortunate: no
other routine (apart from PROCatom_reset, of course) modified an object
in the mal heap after it had escaped from the "types" library.  It also
led to quite a few annoying bugs.

This is now fixed: all routines that modify long strings now return a
new object as necessary, and leave the arguments unchanged.  This is
probably rather slower than the old code, but it's also much cleaner.
2019-05-27 14:25:13 +01:00
Ben Harris
afddcb3209 bbc-basic: Remove the word "partial" from the README. 2019-05-27 14:25:13 +01:00
Ben Harris
d1d0688904 bbc-basic: Slight printer tidying.
When printing a vector, don't allocate a string for "(" and then
immediately throw it away.
2019-05-26 13:38:25 +01:00
Ben Harris
30409c3d68 bbc-basic: Make metadata on string-like types work.
The new string handling makes this simpler than forbidding it.
2019-05-26 13:36:39 +01:00
Ben Harris
94b7a0797a bbc-basic: Radically simplify string storage.
Rather than having a separately indexed array of strings, S$(), with
its own free-list in S%(), we now keep string values in an array,
Z$(), whose indices parallel those in Z%(), so Z$(x) is the string
value of the object at Z%(x,y).  This saves a fair amount of
complexity at the expense of slightly more memory usage.
2019-05-26 13:28:16 +01:00
Nicolas Boulenguez
8c0d5c4d72 test recursive definitions in let*
Detected while attempting to rewrite let* with fn*.
2019-05-25 19:20:06 +02:00
Nicolas Boulenguez
563eba428c ada: fix unterminated string and creation of object directory by Make. 2019-05-23 01:18:37 +02:00
Joel Martin
a4cb289ffb
Merge pull request #371 from asarhaddon/extend-core.mal
Extend core.mal
2019-05-20 22:42:28 -05:00
Nicolas Boulenguez
6db6cf38b7 lib/tests: report parsing errors, move threading out of steps
When testing `foo.mal`, it makes sense to report parsing errors in
`foo.mal`.

Move tests of `->` and `->>` from `tests/step8_macros.mal` to
`tests/lib/theading.mal`.

Add `lib/trivial.mal`.
2019-05-19 19:20:20 +02:00
Nicolas Boulenguez
9bdff6ea55 lib/ README.md should not repeat the process unless needed 2019-05-19 19:17:55 +02:00
Joel Martin
1b5bd10bc9
Merge pull request #382 from bjh21/bjh21-unterminated-string-fixes
Unterminated string fixes: clojure, fantom, groovy, haxe, hy, io, java, julia, kotlin, livescript, matlab, miniMAL, objc, plpgsql, scala, vb, vimscript, yorick
2019-05-19 09:40:41 -05:00
Joel Martin
7aecf6639a
Merge pull request #383 from asarhaddon/ada2tco-do
ada.2: optimize tail call recursion for last `do` evaluation
2019-05-19 09:38:29 -05:00
Joel Martin
c6f6f26efa
Merge pull request #380 from bjh21/bjh21-bbc-basic
BBC BASIC V implementation
2019-05-19 09:29:27 -05:00
Ben Harris
c1982f1a72 vb: Detect more unterminated strings.
I split the string-recognizing part of the read_atom regexp in two, one part for
recognising valid strings (using a fragment of the tokenising regexp) and
another to recognize invalid strings.  This follows the practice of other
implementations with a single read_atom regexp.
2019-05-19 12:00:28 +01:00
Ben Harris
4564d4e4bd objc: Detect more unterminated strings.
This is done by tightening the part of the read_atom regexp that
recognises valid strings.
2019-05-19 12:00:28 +01:00
Ben Harris
9a924bddaa matlab: Detect more unterminated strings.
Rather than treating anything beginning and ending with '"' as a valid
string, we now use a regexp to detect a valid string and treat any other
token starting with '"' as an error.

This does not fix all of the bugs found by #359, though: there remains a
problem with long strings of backslashes in the input getting expanded
into too many backslashes in the resulting string.
2019-05-19 12:00:28 +01:00
Ben Harris
c45de46ff1 miniMAL: Detect more unterminated strings.
Rather than treating anything beginning and ending with '"' as a valid
string, we now use a regexp to detect a valid string and treat any other
token starting with '"' as an error.
2019-05-19 12:00:28 +01:00
Ben Harris
0b66c9961f plpgsql, scala, vimscript, yorick: Detect more unterminated strings.
This is achieved by tightening the regexp used to detect valid strings.
2019-05-19 12:00:07 +01:00