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

544 Commits

Author SHA1 Message Date
Loredana Cirstea
fbee4ec615 wasm: add seq 2024-09-06 08:49:42 -04:00
Vasilij Schneidermann
43ae30f21a chuck: Fix soft-fail for with-meta 2024-08-29 01:58:05 +02:00
Vasilij Schneidermann
5891315a98 chuck: Improve error handling 2024-08-29 01:58:05 +02:00
Vasilij Schneidermann
6002edd9bd chuck: Remove remnants of boxed types 2024-08-29 01:58:05 +02:00
Vasilij Schneidermann
78bd99f2fd chuck: Add DEBUG-EVAL 2024-08-29 01:58:05 +02:00
Vasilij Schneidermann
02299daa5c chuck: Rework internal representation for perf 2024-08-28 23:08:05 +02:00
Vasilij Schneidermann
665471a8d6 chuck: Update to ChucK 1.5.2.5 2024-08-28 23:08:05 +02:00
Joel Martin
2dedaa3919 nim: exit on Ctrl-D in steps 1-8
step9 and stepA had a catch handler for this but the earlier steps were
missing it.
2024-08-28 09:35:42 -05:00
Joel Martin
4c7b1d6af0 nim: fix env binding in steps 3 & 4
In step4 the following fails to return 0:
    ```
    (let* [b 0 f (fn* [] b)] (let* [b 1] (f)))
    ```

Just use the initEnv initializer in steps 3 and 4 (following the same
pattern used by step 5 on onwards).
2024-08-28 09:35:42 -05:00
Nicolas Boulenguez
8406b21f84 wasm: remove the now unneeded ENV_FIND environment method 2024-08-28 08:52:14 -05:00
Nicolas Boulenguez
87b0b23970 perl: backport all recent style changes from stepA to previous steps 2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
4e02e6231e perl: capitalize the modules 2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
7c1238c1e7 perl: use perl conventions for env.pm
In Perl, a class should be alone in a module, with a capitalized name
(Mal::Env would require a subdirectory).
2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
ca88d3ad8f perl: replace package variables for nil true false with functions
See critic: Variables::ProhibitPackageVars.
2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
2a5d5ee207 perl: remove some hacks for sequence and hash functions
These changes arguably improve the readability by reducing the
implicit interface between types.pm and core.pm..
2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
292a758dd9 perl: remove obsolete clone method for atoms 2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
2d190718f7 perl: search for special forms with a hashed jump
Perlcritic find this prettier than a cascade of tests.
2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
72db33ec9d perl: rewrite the reader
This version is hopefully more readable.

It removes the specific exception for blank lines, which is not
required and obfuscates the repl loop for little benefit.
2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
ce7c1f89e7 perl: remove experimental given/when statement 2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
070fb90087 perl: more cosmetic style changes
'say' is deprecated

'--raw' must be removed before step6 checks for a MAL script file name.
2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
bb70b77b78 perl: fix perl-critic issues with severity 1 2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
119b4e281a perl: fix perl-critic issues with severity 2 2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
32b6f981de perl: fix perl-critic issues with severity 3 2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
d94f65cb93 perl: fix perl-critic issues with severity 4 2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
504692f13f perl: add shebang to scripts
Else perlcritic complains about the absence of $VERSION.
2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
b18f823d39 perl: clarify package imports
Remove unused dependencies.

Import explicit lists for clarity.

Avoid module::function prefixs, as some modules will be renamed
(critic: modules must be capitalized).

Add an explicit export list to core.pm, so that all symbols are not
exported by default.

Introduce a pr_list function, which is convenient and removes the need
to rename _pr_str (critic: a leading underscore means a private
function).

Uppercase core::ns (critic complains about lowercase exported
variables).
While at it, convert values to MAL functions on the fly.
2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
9a80cb7a64 perl: fix perl-critic issues with severity 5
Implement env->get with a loop instead of a recursion, for readability and efficiency.

Simplify mal_readline and avoid storing empty lines in the history.
2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
61f1b079f2 perl: reformat sources with perltidy 2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
7502ce9bcc perl: add lint target to Makefile 2024-08-27 15:19:20 -05:00
Nicolas Boulenguez
55495852b4 mal: implement DBGEVAL without assuming that a: is a valid symbol
This does not seem worth a test, but can currently break the
self-hosting.
2024-08-27 14:05:20 -05:00
Nicolas Boulenguez
99f8b02d68 objc: prevent defmacro! from mutating its argument 2024-08-27 09:46:25 -05:00
Nicolas Boulenguez
55c28a799f objc: fix (keyword :a) 2024-08-27 09:46:25 -05:00
Nicolas Boulenguez
35166947f0 objc: print *host-language* when interactive 2024-08-27 09:46:25 -05:00
Nicolas Boulenguez
4e7b6176de objc: remove the now unneeded env.find method 2024-08-27 09:46:25 -05:00
Nicolas Boulenguez
59775ee9b7 objc: implement DEBUG-EVAL 2024-08-27 09:46:25 -05:00
Nicolas Boulenguez
ad164bfb09 objc: merge eval_ast into EVAL 2024-08-27 09:46:25 -05:00
Joel Martin
19898d7893 Update Dockerfile 2024-08-26 13:07:28 -05:00
Nicolas Boulenguez
93130921d8 powershell: select Ubuntu 16.04 Docker image 2024-08-26 13:07:28 -05:00
Nicolas Boulenguez
d4ab5e3eed powershell: merge eval-ast and fix a few tests
Fix (false? 1) and (true? 0).
Change the type of the env.{find,get,set} key to a raw string.
Merge eval-ast into EVAL.
Implement DEBUG-EVAL.
Prevent defmacro! from mutating the original function.
2024-08-26 13:07:28 -05:00
Nicolas Boulenguez
7e9db5ff00 elisp: require a recent emacs version 2024-08-26 13:07:28 -05:00
Nicolas Boulenguez
0e80e7a7db elisp: fix new tests, byte-compile, various improvements
The original motivation is to fix the new (= nil ()) and
core_apply_accepts_macros tests.
Improve speed and warnings with byte compilation.

mal/core.el:
Wrap core functions during the loop in main, instead of writing the
conversion in each line of core-ns.
Use apply built-in concatenation of last argument.
Move handling of metadata to types.el.

mal/env.el:
Represent environments as cons cells instead of vectors.

mal/func.el:
Merged into types.el, it is not a special case anymore.

mal/printer.el:
Add macro case.
Define a pr-join helper for sequences and core.el.

mal/reader.el:
Rename the tokens local variable in reader.el (compiler warning).

mal/types.el:
Use type-specific accessors returning nil for the wrong type
(structural pattern matching would be better, but is too slow).
Represent native types directly when possible, and inline some trivial
accessors.
Use dedicated records instead of vectors.
Implement metadata only when required.
Represent keywords as strings (easyer, no counterpart).

run:
Run byte-compiled version.

steps:
Backport good ideas from stepA to step1, reducing the diff between
steps for future maintenance.
Implement 'do with a simple iteration (without map and butlast).
Make the repl-env local to main (compiler warning).

Make the code more idiomatic
 * prefer loop over recursion (search in environments)
 * declare variable and reassign them when convenient (exit of the TCO loop)
 * car cdr cadr and so on instead of nth
 * remove various vector <-> list conversions.
2024-08-26 13:07:28 -05:00
Nicolas Boulenguez
c5788b3790 purs: merge evalAst into eval and add DEBUG-EVAL
See #592 for context.
2024-08-26 12:56:33 -05:00
Dov Murik
1354b3fe9c jq: Remove stray _debug call in nth implementation 2024-08-26 10:10:44 -05:00
Dov Murik
f7ab284599 jq: Fix functions with empty list body
jq's find_free_references failed on empty lists; add handling for that
case.

Add relevant test in step4.
2024-08-26 10:10:44 -05:00
Nicolas Boulenguez
dab788cf4f lua: style improvements, especially for try* 2024-08-26 10:00:47 -05:00
Nicolas Boulenguez
a9456d0179 lua: simplify and debug environments
Use plain LUA strings as keys in environments.
Search outers environments with a loop.
Remove the now unneeded Env:find trick.
Let DEBUG-EVAL show the contents of all outer environments but repl_env.
2024-08-26 10:00:47 -05:00
Nicolas Boulenguez
ae91e2b0af lua: remove some unneeded imports 2024-08-26 10:00:47 -05:00
Nicolas Boulenguez
b4244ddb09 lua: prevent defmacro! from mutating the original function 2024-08-26 10:00:47 -05:00
Nicolas Boulenguez
69d7d8d120 lua: prevent vec from mutating the original list 2024-08-26 10:00:47 -05:00
Nicolas Boulenguez
9a22e8a653 lua: merge eval and eval AST 2024-08-26 10:00:47 -05:00