Commit Graph

132 Commits

Author SHA1 Message Date
= a6f3fc96e6 Fixed bug where all func calls require an argument
Certain I/O functions (like `inp` or `repl`) do not need arguments, but
previously all functions required at least one argument to called correctly
(i.e. `(inp 0)` or `(repl "banana")`). Now, these can be called as intended:
`(inp)` or `(repl)`.
2021-07-13 21:46:15 +01:00
Sage Vaillancourt 811e9e3dd2 Breaking: Stop `def` adding vars to higher scopes
Fixed OOP error in allocating lambda environments. Add ability to disable test
groups. Disabled forbble tests and `switch` implementation (broken by `def`
change)
2021-07-12 20:34:54 -04:00
Sage Vaillancourt ce28c84696 Slightly better error-handling in Forbble 2021-07-12 20:13:02 -04:00
Sage Vaillancourt b222df047d Only run tests if 'make' succeeded 2021-07-12 20:10:45 -04:00
Sage Vaillancourt 77cb35f961 Add newline print to lib and use it in examples 2021-07-10 23:35:05 -04:00
Sage Vaillancourt f89417ab9e Load script arguments into `args` list
For example, running "./do_math.pl 5 + 5" would define args as a list of
( /usr/bin/pl ./do_math.pl 5 + 5 ), where each of the five elements is a
string object. The arguments will also be loaded when opening the repl,
but NOT when writing  pl code directly as command-line arguments (i.e.
'./pl "(* 9 9)"').
2021-07-10 22:46:31 -04:00
Sage Vaillancourt 96a47590f1 Left-align checkmarks for valgrind testing 2021-07-05 05:32:47 -04:00
Sage Vaillancourt 5a69d5730a Add another Forbble test 2021-07-05 05:17:59 -04:00
Sage Vaillancourt 4974e87273 Disable Forbble REPL. Add Forbble-based tests 2021-07-05 05:09:32 -04:00
Sage Vaillancourt d4d1f27a63 Corrects all known memory leaks 2021-07-05 05:08:37 -04:00
Sage Vaillancourt c7d3d7f457 forbble stability and usability 2021-07-05 01:15:01 -04:00
Sage Vaillancourt 166c9d4889 Add simple 'switch' implemented in pbl 2021-07-05 01:14:39 -04:00
Sage Vaillancourt 77c9c39295 Check indexes etc for `at` 2021-07-05 01:13:59 -04:00
Sage Vaillancourt 6ec0da6353 Add anonymous lambda test 2021-07-05 00:26:29 -04:00
Sage Vaillancourt dbaf57abad Correct executable target location 2021-07-05 00:26:18 -04:00
Sage Vaillancourt c9babe439d Test display and code style tweaks 2021-07-05 00:18:14 -04:00
Sage Vaillancourt 2af48f63ca More consistent whitespace in tests.sh 2021-07-04 23:56:55 -04:00
Sage Vaillancourt 0c9c876d00 Some type-check functions. Consistent 'if' styling 2021-07-04 23:48:26 -04:00
Sage Vaillancourt 6a2e12ebfe More dense test output 2021-07-04 23:46:59 -04:00
Sage Vaillancourt 3d48c2eae0 Added `loadfile` to standalone.
Tests now manually load the library file, instead of needing it to be
installed.
2021-07-04 21:49:41 -04:00
Sage Vaillancourt cc199b0e57 Add Forbble comment 2020-11-08 16:44:53 -05:00
Sage Vaillancourt fc3fcf34ed Added missing cleanObject() call 2020-11-08 15:26:28 -05:00
Sage Vaillancourt 35f0a94f40 Add dup, rot, and over to Forbble example 2020-11-08 13:12:00 -05:00
Sage Vaillancourt fe86f7c836 Add Forbble example code
Forbble is a very, very, simple implementation of Forth, written in PebbLisp.
Forbble isn't very practical, but has been a great test-bed for finding areas
where PebbLisp is particularly lacking in features, or expressiveness.
2020-11-08 12:31:45 -05:00
Sage Vaillancourt a3fe0b075d Remove lingering printObj() from defe 2020-11-08 11:48:50 -05:00
Sage Vaillancourt 18b1e28185 Script dir set in Makefile. Rename exec to `pl`
Changed install dir.
General cleanup of Makefile.
Added `make uninstall` to Makefile.
Tests still require that lib scripts already be installed to pass.
2020-11-07 00:14:19 -05:00
Sage Vaillancourt 0962601976 Move library-like functions into examples/lib.pbl
Remove `tip` demo function for now. May make a move toward a folder of
.pbl files to test with, and it will be re-included then.
2020-11-06 16:12:52 -05:00
Sage Vaillancourt 775be84f5f Add examples/. Install to system on `make install`
Installs examples/* to /usr/share/pebblisp
A basic REPL is one of these examples, replacing the built-in C version
with one actually written in PebbLisp. It can be invoked the same way:
running `pl` without any arguments.
2020-11-06 15:40:41 -05:00
Sage Vaillancourt 7c7a68df5f Add `iserr`, `defe`. Fix `eval`. Increase env size
`iserr` is a basic type-check like `isnum`
`defe` adds a string to the environment as the equivalent symbol
`eval` can take in variables or functions, instead of just raw strings
Broke type-printing into its own function
Errors maxing out an environment. Likely extending incorrectly
2020-11-06 15:07:12 -05:00
Sage Vaillancourt 31fcf0c2d8 Try to skip double evaluations in list 2020-11-04 15:24:09 -05:00
Sage Vaillancourt 9da87f5674 Clean up after adding `codes[]` 2020-11-03 15:20:09 -05:00
Sage Vaillancourt 68705da88f No longer evals (x) to x 2020-11-03 14:44:37 -05:00
Sage Vaillancourt d8d8231f0d Break up evalList() and document the new functions 2020-11-03 14:35:47 -05:00
Sage Vaillancourt a39c6b2c53 Comments and renaming in evalDefArgs() 2020-11-03 09:46:34 -05:00
Sage Vaillancourt 8c71fd2242 Use more cloneObject() 2020-11-03 00:07:08 -05:00
Sage Vaillancourt e0153528a1 Take input in standalone. Print numbers as chars 2020-11-02 16:38:37 -05:00
Sage Vaillancourt f8176fef4f Add plain stringFromSlice()
Doesn't try to ignore quote marks. objFromSlice() utilizes it, but should have the same behavior as before.
2020-11-02 15:55:55 -05:00
Sage Vaillancourt 963996f3a0 Add (eval) function, for evaluating strings
Added a few tests for this new function
2020-11-02 15:46:17 -05:00
Sage Vaillancourt 875228a2b6 Add `isstr` to type-checking collection 2020-11-02 15:29:03 -05:00
Sage Vaillancourt 78f5b98f9f Don't print newlines on (prn) or last expr in file 2020-11-02 15:23:04 -05:00
Sage Vaillancourt 058bd302df `def` can bind multiple vars at once
For example `(def (a b) (10 15))` binds `a` to 10, and `b` to 15
2020-11-02 13:42:37 -05:00
Sage Vaillancourt 3319fdf2c3 Lambdas return only last item. EOL file comments
Added (penv) to print the current environment
Changed "Duplicate" test to work with new Lambda structure
2020-11-02 12:40:42 -05:00
Sage Vaillancourt ba74561bed Increase MAX_TOK_CNT. Impact on watch unsure 2020-11-02 12:38:51 -05:00
Sage Vaillancourt a408472494 Add '->' to lambda printing 2020-11-02 12:38:38 -05:00
Sage Vaillancourt 3a413c28fc Attempting to correct some (def) weirdness 2020-11-02 07:58:09 -05:00
Sage Vaillancourt f9cb2d544a More robust comment processing 2020-11-02 07:57:13 -05:00
Sage Vaillancourt 54e2e09c5c Add explicit (print) function 2020-10-30 14:36:44 -04:00
Sage Vaillancourt 99fc088d3e Try to be less strict about whitespace in files 2020-10-30 09:52:46 -04:00
Sage Vaillancourt b5648963a7 Correct string equality check 2020-10-30 09:07:09 -04:00
Sage Vaillancourt b443a54822 Add `pre` for prepending to lists 2020-10-29 11:23:35 -04:00