1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-19 09:38:28 +03:00
Commit Graph

30 Commits

Author SHA1 Message Date
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
0ee03cc7f8 wasm: fix platform_wasi preopen search.
This better supports both wasmtime and wasmer. One key issue is that
we need to handle string endings differently between the two projects.
2019-05-13 13:43:48 -05:00
Nicolas Boulenguez
14ab099cea gensym: hide the counter in an environment, define inc in stepA.
tests: check that `inc` is present in stepA.
nasm: split lines in mal_startup_string for readability.
objpascal: remove obsolete .orig file
swift: remove an unneeded line in template
swift4: remove duplicate definition of `or` macro
2019-05-11 16:37:26 +02:00
Joel Martin
030f725c4a wasm: wax runtime. Use WASI preopen process.
Add wasi-sdk to Dockerfile to be able to compile C code to wasm that
uses WASI API calls.
2019-04-19 01:07:08 -05:00
Joel Martin
d88adace47 README: add webassembly embeddings/runtimes. 2019-04-17 00:35:39 -05:00
Joel Martin
dad306ed73 wasm: Support/add wasmtime runtime. WASI platform. 2019-04-15 22:08:07 -05:00
Joel Martin
f63e8624a0 wasm: use wam-1.0.8 which supports new binaryen.
New binaryen doesn't allow data section to contain multiple strings to
be concatenated together any more. So wamp-1.0.8 does the
concatenating for it.
2019-04-15 20:54:11 -05:00
Joel Martin
ed13313d87 wasm: direct platform, wam memory
- Rename platform_os.wam to platform_direct.wam and update the direct
  interface to use printline instead of fputs/stdout.
- Update to wamp 1.0.7 and new memory/memoryBase semantics: in
  platform_direct and platform_libc, import memory and memoryBase
  rather than relying on wamp to add it because wamp add direct memory
  and memoryBase defintions (not imports) if the program doesn't
  already define or import memory/memoryBase.
- Simplify entry point logic by moving it into the platform files.
2019-04-15 00:57:59 -05:00
Joel Martin
c4269f9bf5 Convert to loccount based stats calculation. 2019-03-20 23:34:21 -05:00
Joel Martin
4aa0ebdf47 Error on unterminated strings.
Add a step1 test to make sure that implementations are properly
throwing an error on unclosed strings.

Fix 47 implementations and update the guide to note the correct
behavior.
2019-01-25 16:16:06 -06:00
Joel Martin
5425eafbbc wasm: update Dockerfile to force warpy build. 2019-01-16 21:01:15 -06:00
Joel Martin
266391c550 wasm: revert to i32 get_time_ms (subtract 30 years)
JS doesn't support i64 types for exports/imports so revert to i32
return type but subtract 30 years to avoid wrapping/negative values.
2019-01-16 20:03:37 -06:00
Joel Martin
c4ce75c08f wasm: fix get_time_ms to return millis.
Also, to avoid overflow, subtract 30 years so that the value won't
wrap in i32.
2019-01-16 13:54:20 -06:00
Joel Martin
53619a6e59 wasm: Add warpy wasm_MODE.
- Update Dockerfile to install rpython and then use that build and
  install warpy (nojit).
- Support 'warpy' in wasm_MODE. Update wasm/Makefile and wasm/run to
  support the new mode.
2019-01-16 01:12:00 -06:00
Joel Martin
0a19c2f1c7 wasm: update to 2019 wat syntax, use .wat extension
wasm: update to wat syntax as of Jan 2019.

Examples:
- get_local -> local.get
- i32.wrap/i64 -> i32.warp_i64
- etc

The distinction between wat and wast has been clarified:
- wat: textual format for web assembly modules
- wast: superset of wat used in the specification to define tests.
2019-01-16 00:13:51 -06:00
Joel Martin
6a51946b52 wasm: use platform_os for JS mode.
Drop platform_js and use refactor platform_os to support JS mode. Add
get_time_ms import to platform_os so this depends on run.js and
fooboot providing that.
2019-01-14 22:37:46 -06:00
Joel Martin
dd7a4f55f3 Test uncaught throw, catchless try* . Fix 46 impls.
Fixes made to: ada, c, chuck, clojure, coffee, common-lisp, cpp,
crystal, d, dart, elm, erlang, es6, factor, fsharp, gnu-smalltalk,
groovy, guile, haxe, hy, js, livescript, matlab, miniMAL, nasm, nim,
objc, objpascal, ocaml, perl, perl6, php, plsql, ps, python, r,
rpython, ruby, scheme, swift3, tcl, ts, vb, vimscript, wasm, yorick.

Catchless try* test is an optional test. Not all implementations
support catchless try* but a number were fixed so they at least don't
crash on catchless try*.
2018-12-12 14:18:26 -06:00
Joel Martin
76adfab958 wasm: split js mode platform code out.
Simplify the interface to remove imports that aren't used (stdout and
add_history) and simplify (rename fputs to printline).
2018-12-10 00:36:39 -06:00
Joel Martin
8914943790 wasm: enable execution with Node
Add node mode to travis alongside wace_libc.
2018-12-09 22:55:49 -06:00
Joel Martin
8faa94c66a wasm: add package.json to pull in wamp. 2018-12-08 18:13:53 -06:00
Joel Martin
df43e71977 wasm: Update Dockerfile. WAMP and WASM_AS params. 2018-12-08 17:02:13 -06:00
Joel Martin
77bf4e612d wasm: fix to work with wabt's wat2wasm. 2018-12-08 17:02:13 -06:00
Joel Martin
0c62f14e6a wasm: drop unnecessary signed suffixes.
Apparently some of the assemblers ignored these sign indicators and so
this worked in the past.
2018-12-08 17:02:13 -06:00
Joel Martin
f2858819cc wasm: add line count rules. 2018-12-08 17:02:12 -06:00
Joel Martin
349faa83e3 wasm: use LET macro and br_if. 2018-12-08 17:02:12 -06:00
Joel Martin
50eea9ad9c wasm: String refactor. Release macro memory
Also split platform out.
2018-12-08 17:02:12 -06:00
Joel Martin
456d0a21be wasm: improve debug output using padding. 2018-12-08 17:02:12 -06:00
Joel Martin
3ea0988652 wasm: Steps 4-A, hashmaps, metadata.
- Use more concise param and local syntax.
- Separate out string.wam.
- Add pr_str_seq functionality and add in print_readably
  functionality.
- Add REPLACE3 function.
- Remove use of putchar and simplify util.wam
- Move string functions from util.wam to string.wam including some
  renames to be more consistent with C library names.
- Add temporary content to 256 character buffers so that they are
  de-duplicated/combined.
- Use AND/OR macros.
- Improve Makefile deps and use more general wasm target.
- Properly cleanup memory in try* and use TCO as part of try*.
2018-12-08 17:02:12 -06:00
Joel Martin
33309c6a62 wasm: Convert to wam syntax using wamp.
- Convert sources to much more concise wam syntax supported by wamp.
- Rename sources from *.wast to *.wam and generate *.wast files by
  translating via wamp.
2018-12-08 17:02:09 -06:00
Joel Martin
b16fe73ec1 wasm: Steps 0-3 ported from basic. Preprocessor.
Needs wace from https://github.com/kanaka/wac to run.

wastpp.py processes the listed modules and outputs a single combined
module. It finds inline strings and hoists them to the top into a data
section and creates pointer variables into that memory and replaces
the inline strings with pointer lookups.
2018-12-08 17:01:04 -06:00