1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-10 12:47:45 +03:00
Commit Graph

1843 Commits

Author SHA1 Message Date
Iqbal Ansari
c8ac1eda7d Common Lisp: Implement step 8 2016-11-18 17:59:27 +05:30
Iqbal Ansari
3e9628d8d7 Common Lisp: Implement step 7 2016-11-18 17:59:27 +05:30
Iqbal Ansari
3dc177e408 Common Lisp: Implement step 6 2016-11-18 17:59:27 +05:30
Iqbal Ansari
626e3a1f7e Common Lisp: Implement step 5 2016-11-18 17:59:27 +05:30
Iqbal Ansari
82b73d0b29 Common Lisp: Implement step 4 2016-11-18 17:59:27 +05:30
Iqbal Ansari
526eda5741 Common Lisp: Implement step 3 2016-11-18 17:59:27 +05:30
Iqbal Ansari
d045c9cff4 Common Lisp: Implement step 2 2016-11-18 17:59:27 +05:30
Iqbal Ansari
8164982fd4 Common Lisp: Implement step 1 2016-11-18 17:59:27 +05:30
Iqbal Ansari
983d9f3b20 Common Lisp: Implement step 0 2016-11-18 17:59:27 +05:30
Joel Martin
d7a6c2d6c9 Basic: refactor memory layout.
Use a one dimensional array for the Z% value array. This enables
lists, vectors, environments and metadata pointers to all save off
1 word (2 bytes) of space.

Split the memory init and functions into mem.in.bas.

In addition, change type 14 to be metdata rather than any type 16-31.

This change saves about 560 bytes (no second array dimension
subscripts) and reduces Z% value usage by 10%-15%.

Bump the number of Z% words by 200 (to 8591). This enables
self-hosting up to step7 (without step8-stepA functions in core.mal).
2016-11-18 01:26:23 -06:00
Joel Martin
6aaee33ea8 Basic: use RE from REP. 2016-11-18 00:46:07 -06:00
Joel Martin
9d59cdb384 Basic: refactor of hashmaps, map loops, remove derefs.
- Alternate memory layout of hash-maps:

Instead of hash-maps being an alternating sequence of keys and values,
combine the key/values into a single entry. In other words, switch
from this:

    8   ->  next Z% index (0 for last)
    14      key/value (alternating)

To this:

    8   ->  next Z% index (0 for last)
    key     value

This requires refactoring of the sequence reader, EVAL_AST and
especially DO_HASHMAP and DO_KEY_VALS. So that leads to the next big
refactoring:

- Change mapping/lapping constructs to share code:

Several pieces of mapping/looping code have a common structure, so
this moves that common structure to types.in.bas: MAP_LOOP_START,
MAP_LOOP_UPDATE, MAP_LOOP_DONE. Then use this code in:
    - EVAL_AST
    - READ_SEQ_*
    - DO_MAP
    - DO_HASH_MAP
    - DO_KEYS_VALS

This also fixes the issue that several of these looping constructs
were creating new empty sequence entries instead of using the common
ones at the beginning of memory.

- Remove the use of DEREF_*.

This isn't actually needed because we no longer create structure that
refer to multiple levels of type 14 references. Replace DEREF_* with
VAL_* which gets the value of a particular sequence element i.e.
Z%(A+1,1).

All together, the above changes save over 300 bytes.

Also:

- Fix empty nil/false/true entries so they
  are treated the same as other types of data with regards to
  reference counting and ALLOC/RELEASE.
- Add a new memory summary function in debug.in.bas that just prints
  out free, value count, and references for the early scalar and empty
  list elements. Comment out the larger one. This saves about 90
  bytes.
2016-11-15 23:00:57 -06:00
Joel Martin
4cbca59401 Merge pull request #249 from hterkelsen/dart2
Add Dart implementation
2016-11-14 15:39:33 -06:00
Harry Terkelsen
eb8bc504fa add dart/Makefile stub 2016-11-14 13:28:23 -08:00
Harry Terkelsen
7cdce42011 update travis file 2016-11-13 15:24:48 -08:00
Harry Terkelsen
04d23e07d9 add dart Dockerfile 2016-11-13 15:24:02 -08:00
Harry Terkelsen
b15933d273 update number of languages Mal is implemented in 2016-11-13 14:44:11 -08:00
Harry Terkelsen
bcf95720f2 update readme 2016-11-13 14:35:35 -08:00
Harry Terkelsen
4ceefe3b50 use tabs for Makefile 2016-11-13 14:28:19 -08:00
Harry Terkelsen
46e89434f5 fix makefile 2016-11-13 14:27:03 -08:00
Harry Terkelsen
2c52c8b118 Merge branch 'master' into dart 2016-11-13 14:24:49 -08:00
Harry Terkelsen
3934e3f825 add Dart implementation 2016-11-13 14:21:44 -08:00
Joel Martin
037815e0f3 Basic: more reductions. RELEASE refactor.
Save about 400 bytes.

Increase value Z% array by 100 to 4195.

Reduce string array by 1 (to 199) since in BASIC the value is the last
index not the size.
2016-11-10 01:51:02 -06:00
Joel Martin
f9f1cec9cc Basic: memory savings and variable simplifications.
In core move incrementing of function index into
INIT_CORE_SET_FUNCTION. Switch 3 IF GOTO to ON GOTO. Reuse some
temporary variables.

Saves about 480 bytes.

Bump value array from 3950 to 4096. This allows step4 (sumdown 2) to
pass. Previously only (sumdown 1) passed.
2016-11-06 17:29:11 -06:00
Joel Martin
206e6197e8 Basic: add pr-memory-summary core function.
- Remove test POKE commands.
2016-11-04 22:53:20 -05:00
Joel Martin
1e7b6f841f Ada: add ada/obj to .gitignore 2016-11-04 22:52:58 -05:00
Joel Martin
332611f520 README: note ChucK tested on more than just Arch. 2016-11-04 22:52:05 -05:00
Joel Martin
935930128c Basic: move logic/release stack to $C000
Uses stack PUSH*/POP*/PEEK* routines instead of direct X% and Y%
access. Seems to be about the same performance (maybe a 5% performance
hit at most).

This gives us a larger stack (1920 2-byte words of $C000 rather
than 200 words as before). The release stack at $CF00 stays the same
size (64 4-byte addr/level entries).

Also saves over 1K or program and array space. So take the opportunity
to expand Z% entry space from 3712 to 3950.
2016-11-04 21:46:45 -05:00
Joel Martin
c756af8196 Basic: reduce variables. Fix func printing.
- Save over 450 bytes. Bump up Z values by 128.
- Fix function printing when function is embedded in something else by
  using strings storage as a stack while printing rather than using
  RR$
- Simplify some error messages and sanity checks in RELEASE.
2016-11-04 00:07:09 -05:00
Joel Martin
6420f327cd Basic: add string memory mgt. Fix eval, symbol fns 2016-11-03 23:27:42 -05:00
Joel Martin
4fab6aa517 Basic: more memory savings
- Do the pop of CALL return value at the end of the subroutine
  (callee) rather than at the call point (caller)
- shorten some character variables (CH$->C$, CH->C)
- remove spaces after OPEN, GET
- print REPL header directly in BASIC code

Together saves 404 bytes of memory.
2016-11-02 23:36:44 -05:00
Joel Martin
259dd13c56 Basic: more aggressive space removal
Saves over 1200 bytes so that Z% value space can be bumped up by 256
entries.
2016-11-02 22:19:51 -05:00
Joel Martin
fba3aeb2fb Ada, C: fix step3 error handling.
New step3 tests were added during basic implementation that broke Ada
and C.
2016-11-01 10:44:49 -05:00
Joel Martin
2bcc46af48 Basic: capitalize BASIC
I guess.
2016-10-31 17:50:13 -05:00
Joel Martin
2bec1db017 Basic: update to 61 impls after merge. 2016-10-31 17:45:00 -05:00
Joel Martin
b3658328e4 Merge branch 'master' of github.com:kanaka/mal 2016-10-31 17:41:58 -05:00
Joel Martin
1b03073347 Merge branch 'basic' 2016-10-31 17:40:29 -05:00
Joel Martin
1b2453005e Basic: update the README. 2016-10-31 17:38:28 -05:00
Joel Martin
fd39f14b25 Merge pull request #247 from chr15m/php-interop-extended
Php interop extended
2016-10-31 10:20:04 -05:00
Joel Martin
0197588627 Basic: add QBasic support.
make MODE=qbasic stepA_mal.bas
qb64 stepA_mal.bas
2016-10-30 19:15:24 -05:00
Chris McCormick
29ebdb9c48 Added interop notes to README. 2016-10-29 12:32:26 +08:00
Chris McCormick
e7e13ef760 Merge branch 'master' into php-interop-extended 2016-10-29 12:29:33 +08:00
Chris McCormick
07eb8b944a Tests for new PHP interop functions. 2016-10-29 12:25:04 +08:00
Chris McCormick
42f9de6a8a Tighter PHP interop using '$' and '!' fns.
($ _SERVER) returns a mal hash-map holding the contents of the $_SERVER superglobal from PHP.
(! file_get_contents "https://github.com") returns a string containing the github homepage.
file_get_contents is a native PHP function.
2016-10-29 12:24:52 +08:00
Chris McCormick
f39b8db702 Allow printing of more PHP types.
In case return type from interop is a complex native PHP type.
2016-10-29 11:30:23 +08:00
Chris McCormick
5f0857261f New functions for converting between PHP and mal types. 2016-10-29 11:30:19 +08:00
Joel Martin
4b9b1d2506 Basic: enable Travis testing. 2016-10-28 22:05:30 -05:00
Joel Martin
37d75dc6dd Basic: pass required tests. Printer fix.
Also, move dissoc and hashmap equality tests to optional/soft since
they aren't actually needed for self-hosting.
2016-10-28 22:02:59 -05:00
Joel Martin
7381834f55 Basic: add Dockerfile
- installs patch cbmbasic
2016-10-28 21:57:35 -05:00
Joel Martin
5afc402eb8 Basic: d64 disk image build rules.
- Include .args.mal file and core.mal into the image.
2016-10-28 21:49:29 -05:00