Sage Vaillancourt
71623db37c
Fix prnl in lib.pbl
2022-03-27 20:00:55 -04:00
Sage Vaillancourt
806f63e8ae
Inline some of web.h into web.c
2022-03-27 19:36:45 -04:00
Sage Vaillancourt
34032cb1c6
Simplify Environment struct.
...
Fill in envForLambda with errorObjects if not enough are provided.
Move addStructDef() into env.c
Add dedicated Dictionary struct to env.c
env->size -> env->capacity
2022-03-27 18:52:56 -04:00
Sage Vaillancourt
69cf9212d7
Simplify several functions.
...
Namely, printObj() and _copyList().
Remove separate cloneList() function.
2022-03-27 00:49:10 -04:00
Sage Vaillancourt
b715b2116a
Remove unnecessary listLength type checking.
2022-03-27 00:13:04 -04:00
Sage Vaillancourt
9a454e6a30
Small optimizations and cleanup.
2022-03-27 00:03:34 -04:00
Sage Vaillancourt
158c21f441
Reference count LAMBDAS.
...
Remove more unused code/checks.
Simplify evalList (though it could use more work).
2022-03-26 19:51:52 -04:00
Sage Vaillancourt
5226640fb6
Some stringing cleanup and unused code removal.
2022-03-26 12:54:38 -04:00
Sage Vaillancourt
502b9349fe
Fix some busted tests.
...
Better styling of native test printing.
Add `detail` parameter to runTests().
2022-03-25 16:11:25 -04:00
Sage Vaillancourt
59c6ff50b5
Break printColored() into own function.
...
Replace (pch) with (ch).
Fix error memory bug.
Add sugar for (? fil) => (? "fil").
Inline some of (fil).
Simplify (print) and allow for varargs.
Total up valgrind errors when testing.
2022-03-25 13:33:30 -04:00
Sage Vaillancourt
581dfed359
Combine fn macros.
...
Toying with storing fn types in the code.
2022-03-24 23:58:54 -04:00
Sage Vaillancourt
62e430af69
Adjust test formatting.
...
Replace plfunc.h comments with simple type hints.
2022-03-24 23:32:51 -04:00
Sage Vaillancourt
3398729ab8
Track length of stringObj().
...
Use this to simplify catObjects().
2022-03-24 23:07:34 -04:00
Sage Vaillancourt
68a7a55fc0
Continue FUNC transition.
...
Removing some list-func features, at least for now. e.g. (+ 5 (1 2 3)).
Disable related tests.
Improve (reduce) syntax.
2022-03-24 21:50:18 -04:00
Sage Vaillancourt
0a649095ab
Start switch to array-based functions.
...
No more mandatory two-params, though several things are still busted.
2022-03-24 16:59:59 -04:00
Sage Vaillancourt
e00d706522
Add function to read a file into a string object.
...
Move webby.pl into dedicate examples/web/ dir.
Pull out styles.css into its own file.
Fix small parseEval leak.
2022-03-24 16:59:58 -04:00
Sage Vaillancourt
06389ac5fc
Manual specification of color-highlighting order.
2022-03-24 16:59:57 -04:00
Sage Vaillancourt
6c7132aa46
Exit code of `./pl --run-tests` is the number of failed tests.
2022-03-23 01:02:27 -04:00
Sage Vaillancourt
d743970b1a
Tweak (eval) to accept SLIST arguments.
...
Tweak implicit-cat detection.
Explicit empty-string notation in test display.
A couple more tests.
2022-03-23 01:00:11 -04:00
Sage Vaillancourt
bf2b9504a6
Better handle deeply nested help highlighting.
2022-03-22 12:01:24 -04:00
Sage Vaillancourt
86f3f4b32c
Do some simple depth highlighting in help text.
2022-03-22 11:54:26 -04:00
Sage Vaillancourt
5a622736d3
Handle more testing stuff statically.
...
Remove fnt and just have centralized fn.
Longer printObj temp string.
`?` now shows tests.
Add more internal testing.
2022-03-22 11:45:02 -04:00
Sage Vaillancourt
097cbf6a5c
Start some internal testing frameworking.
2022-03-21 12:33:57 -04:00
Sage Vaillancourt
3bf65577c0
Add help text for STANDALONE.
...
Pull most user functions into the new plfunc.
Could integrate some tests directly into pl with --run-tests
2022-03-20 03:50:43 -04:00
Sage Vaillancourt
30e8c87e66
General code clean-up.
2022-03-19 22:25:20 -04:00
Sage Vaillancourt
4733e1172e
Fix uncaught mismatched paren error.
...
Add test against that error behavior.
Remove bits of unused code from web.c and tests.sh
2022-03-19 21:53:18 -04:00
Sage Vaillancourt
c9be701b19
Fix no-param lambda environment bug.
...
Put allocation cap behind an ifdef
2022-03-19 21:28:17 -04:00
Sage Vaillancourt
9da4649a27
Several small additions.
...
Add basic allocation tracking.
Add extra error context
- more useful for debugging the language than programs written in it
Let reduce work on a single non-list item. May be removed.
Add more testing.
Add test filtering.
Fix triple-quotes.
2022-03-18 16:12:39 -04:00
Sage Vaillancourt
ee8eaf2d28
Fix web struct handling.
...
Typedef to handle different versions of libmicrohttpd.
Add getStructIndex().
Fix small print() mem leak.
2022-03-18 11:23:19 -04:00
Sage Vaillancourt
b4584fa377
Start work on adding queryParams, etc.
2022-03-17 16:59:08 -04:00
Sage Vaillancourt
13a7ad97b5
Correct known memory leaks.
2022-03-17 13:23:19 -04:00
Sage Vaillancourt
011ed937fe
Some memory fixes.
...
Also removed unnecessary comments.
2022-03-16 23:31:14 -04:00
Sage Vaillancourt
bbb2cb471e
Improve testing.
...
Remove explicit endBlock function.
Test some of the new features.
2022-03-16 16:57:37 -04:00
Sage Vaillancourt
711719289f
Several changes.
...
Add `reduce` and `islist`.
- Reduce is broken with lambdas for some reason.
Remove `switch` from lib (breaks `penv`).
More detailed lambda to-stringing.
A bit of fixing for lambdas that return lambdas.
Re-org Object fields for simpler visual debugging.
Let `cat` work with one argument.
Add prompt option for `inp`.
Some more refinement of the webby.pl example.
2022-03-16 16:50:55 -04:00
Sage Vaillancourt
7faf2ebbb3
Add POST method.
...
Rename `addroute` to `get`.
2022-03-15 23:22:28 -04:00
Sage Vaillancourt
4decbbbe5c
Use readline history.
2022-03-15 22:47:46 -04:00
Sage Vaillancourt
f37969418d
Add simple web server implementation.
...
Adjust global Environment implementation.
Example `webby.pl` is now a simple server program.
Only limit stringNObj outside of STANDALONE implementations.
Larger catObjects sizes.
Parsing files ignores semicolons inside of quotes.
2022-03-15 21:48:04 -04:00
Sage Vaillancourt
b390e272a7
Remove Makefile testing code.
...
Revert disabled printd() to a semicolon.
2022-03-15 16:53:34 -04:00
Sage Vaillancourt
2cc97288bf
Add hard-coded readline REPL.
...
...the library issue was not Ubuntu's fault.
2022-03-15 16:51:23 -04:00
Sage Vaillancourt
a59ce1646f
More comprehensive webby.pl
...
Allow for longer strings, but there's still another limiting element somewhere.
2022-03-15 16:03:23 -04:00
Sage Vaillancourt
1d5621923c
Further flesh-out structs.
...
Temporarily disable http due to buggy Ubuntu libmicrohttpd.
Add a way to access their fields with `'s`.
- Uses some fairly hacky parseAtom additions. Needs to be refined.
Add structCapacity to Environment.
Add global Environment pointer.
Use structDef indexes instead of direct pointers.
- Easier to increase capacity this way
strcpy struct field names
2022-03-15 15:27:02 -04:00
Sage Vaillancourt
11f39bf136
Add simple webserver functionality.
2022-03-14 23:46:20 -04:00
Sage Vaillancourt
6c8ff04711
Extremely barebones struct object implementation.
2022-03-14 16:52:08 -04:00
Sage Vaillancourt
e2c977e95a
Finally some consistent styling.
...
Centralized printf/printd defines in object.h
Removed null/isList checking from FOR_POINTER_IN_LIST
2022-01-07 16:55:03 -05:00
Sage Vaillancourt
8d22bf575c
Add history and ok/err functionality to REPL.
2021-12-15 14:40:49 -05:00
Sage Vaillancourt
f3a69989fa
Better switch functionality.
2021-12-15 14:39:13 -05:00
Sage Vaillancourt
55d39431b1
Add TYPE_SLIST.
...
Not yet stable, but allows manipulation of lists without immediate
evaluation.
2021-12-15 14:38:52 -05:00
Sage Vaillancourt
5261880ebb
Fix test quoting.
2021-12-15 14:27:01 -05:00
Sage Vaillancourt
d73247a471
Fix deleteEnv null-pointer bug.
2021-12-15 14:25:47 -05:00
Sage Vaillancourt
c0ad4481bd
Fix tokens.c missing-error-code bug.
2021-12-15 14:25:09 -05:00
Sage Vaillancourt
d36f1bf162
Remove single-quote support for strings.
...
Add triple-quote support.
Switch to structs for handling errors.
2021-12-13 10:47:35 -05:00
Sage Vaillancourt
49bf4aa1a2
Add system calls and some char processing.
...
Color REPL error output.
Add 'clear' shorthand to REPL.
Add basic switch to lib.
2021-12-10 16:38:44 -05:00
Sage Vaillancourt
08432275c8
Correct and re-enable environment tests
2021-07-22 15:51:42 -04:00
=
ea04af7b6b
Remove unused BOUNDS type from PebbleObject
2021-07-22 17:08:53 +01:00
=
787aec6f95
Remove in-memory duplication of pebbles' code text
2021-07-22 14:34:26 +01:00
=
2cbe610b95
Correct FORCE_TEXT
2021-07-21 20:48:41 +01:00
=
58f73bc0f8
Simpler SIMPLE_ERRORS and new LOW_MEM FORCE_TEXT
2021-07-21 19:49:29 +01:00
=
3d8e2d30d4
Add LOW_MEM and SIMPLE_ERRORS flags for aplite.
...
LOW_MEM drops some functionality (like `defe`) for very low memory devices like
aplite. SIMPLE_ERRORS is enabled when compiling with LOW_MEM, and overrides the
new error-with-context functionality with older, less intensive methods.
Also marked more code for standalone compilation only.
2021-07-21 19:31:40 +01:00
=
c142730837
Errors can have context to make them more useful.
...
External:
Error changes.
User windows will show string reps of all object types
Internal:
Some re-org and renames in calc.
Add stringNObj for more controlled string-receiving.
Note: currently aplite has a hard time with larger scripts, possibly because of
recent changes. Not sure how much can be done about it, but I'm investigating.
2021-07-21 16:26:04 +01:00
=
06ab491b1e
Give result prefix its own definition
2021-07-16 01:33:17 +01:00
=
e58e5aeaa9
Some renames and general cleanup.
...
Added spaces after `cat` `map`, etc.
2021-07-16 01:20:36 +01:00
=
bdd8c3fae3
Add extra-small font for large amounts of text
2021-07-16 00:43:46 +01:00
=
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
Sage Vaillancourt
9486854267
Basic file execution
2020-10-29 11:18:06 -04:00
Sage Vaillancourt
94555e4497
Adding to env checks outer env for existing Object
2020-10-29 10:26:44 -04:00
Sage Vaillancourt
cb87fbdae6
Print missed symbol's name
2020-10-29 10:00:25 -04:00
Sage Vaillancourt
ef8e2cbc79
Remove wrong makefile listing
2020-10-29 09:11:34 -04:00
Sage Vaillancourt
130da5a70e
Merge branch 'master' of https://gitlab.com/sagev9000/pebblisp
2020-10-29 09:06:28 -04:00
Sage Vaillancourt
46516461eb
Add 'install' to Makefile
2020-10-29 09:04:32 -04:00
Sage Vaillancourt
7b649fdf16
Add `isnum` and some tests
2020-10-28 18:09:57 -04:00
=
ca51937926
Update README for recent changes. Remove aliases.
2020-08-09 23:37:28 +01:00
=
68e062e2e0
Add TYPE_OTHER, subscriptions, and PebbleObjects
...
Move most file-local variables from calc.h to calc.c (so calc.h can be included)
Quick hack to get simple TYPE_LAMBDA evaluated
Add pebcom files for time/vibe/eventually battery etc. functions
Add TYPE_OTHER, so that pebble-specific (and potentially other) objects can be used in PebbLisp
Created PebbleObject/PebbleType to work as a sort of tagged pointer, to be used as a TYPE_OTHER object
Add some functions for creating/editing windows and textlayers from within PebbLisp
Added subscribe(), enabling lambdas to be run at set time intervals
2020-08-09 20:03:02 +01:00
=
3f9d24c617
Fix signed/unsigned comparison
2020-08-04 22:04:11 +01:00
=
d87322b6a5
Some env.c refactoring and clean-up
2020-08-04 20:26:47 +01:00
=
b92768c5ec
Add script-calling. Tweak font size thresholds
...
Other clean-up
2020-08-04 18:30:40 +01:00
=
5644a46c3c
Add OTHER type. Auto-open script 0 on code-send
2020-08-03 16:21:04 +01:00
=
f318eb6b49
User-created windows close with back button
2020-08-03 14:17:49 +01:00
=
c0f7213110
Can now receive code snippets from a phone!
...
Font adjustment tries (cheaply) to account for newlines
2020-08-02 21:53:30 +01:00
=
a5ecb1b3aa
Added TODO. Text size adjusts with code length
...
Can handle hex and binary. Other cleanup
All tests pass
2020-08-02 21:16:26 +01:00
=
796a4cdc91
Added some expected-error tests
2020-06-12 23:50:36 +01:00
=
81d5a545cf
Some new list functions and better error handling
...
New list functions include (append) (at) (rest) and (reverse). Single quotes now supported for strings.
2020-05-28 15:28:28 +01:00
=
d041e7c5bb
Switch to new testing style
...
Do blocks of tests, and only report individual tests on error, to save space. Add more tests, including some for upcoming list functions
2020-05-28 15:25:36 +01:00
=
f0a8f6ca43
Start using switches to warn on unhandled types
2020-05-23 18:01:15 +01:00
=
44c9c7a8a1
Use malloc'd strings. Add filter function
2020-05-22 06:16:45 +01:00
=
ba2cf83759
Disable tests on `make debug`
2020-05-22 06:11:35 +01:00
=
20f1985e1d
Semicolons treated as whitespace between tokens
2020-05-22 06:06:34 +01:00
=
bf1ce6e6f6
Cleaned and reorganized and renamed stuff
2020-05-22 06:04:00 +01:00
=
199eef7681
Fix saving on Pebble. Break funcs into '...' menu
...
Bump to 0.2
2020-05-21 17:57:24 +01:00
=
3dee4eb8dc
Added SKIP_FIRST() macro for list iteration
2020-05-20 02:26:56 +01:00
=
7ad541eb02
Variableize Makefile and adjust pebble tokens
...
Also made repl() a void function
2020-05-20 01:37:15 +01:00
=
8bdf42f6fd
Revert "Add basic struct notion and tests."
...
This reverts commit 95762976c5
.
Turns out these structs are not implemented well.
2020-05-18 02:22:39 +01:00
=
95762976c5
Add basic struct notion and tests.
...
Don't auto-run tests in debug mode. Some new tests fail for list-related reasons (some work in the REPL).
2020-05-18 00:00:19 +01:00
=
80967b9275
Broke lib-type code into array. New numparse errs
2020-05-16 19:31:14 +01:00
=
c59789120c
Valgrind should only print errors in tests
2020-05-16 16:12:12 +01:00
=
c97cbe850c
Ensure plain lists have elements evaluated
...
Add relevant tests. Add new doc comments. Some code shifting.
Tests pass. Valgrind is clean.
2020-05-16 15:46:19 +01:00
=
efb151d0ef
All known memory leaks handled!
...
Watch the commented `if` -127,7 +137,10 @ Object eval for weird behavior
2020-05-16 04:22:08 +01:00
=
f488e29c54
Implement liberal string copying and destruction
2020-05-15 21:28:16 +01:00
=
82f1f03d7b
Clean up makefile and tests
2020-05-15 21:27:45 +01:00
=
58705b4aa9
Cat with `+`; Related tests. Reordered pebblisp.c
2020-05-15 05:43:08 +01:00
=
4c228f8fb1
Got Pebble compilation working again
2020-05-15 04:57:51 +01:00
=
1c82c6f726
Fixed some parsing (tests pass!). Some clean up.
2020-05-15 04:51:59 +01:00