Commit Graph

102 Commits

Author SHA1 Message Date
Simon Forman aea619953d Model expr as stack-of-stacks, minor cleanup. 2022-09-11 08:57:45 -07:00
Simon Forman 16e6c77fa2 Don't bother to return the expression.
We mutate it instead of replacing it with new versions.
2022-09-10 17:42:38 -07:00
Simon Forman 4156da3511 Cleaner iteration of expression.
It's a destructive operation.  It breaks functional purity (but it could
be made functional by using a stack instead of a list for the stack.)

There's no point to returning the expression object now because it's
being mutated by the prepend() method (rather than being replaced by new
forms.)
2022-09-10 17:37:07 -07:00
Simon Forman 15c143e3d1 over
This slipped through the cracks, eh?  Should add a test to joytest.
2022-09-10 17:31:56 -07:00
Simon Forman 1032fc8e76 No point in a separate _parse() function. 2022-09-10 17:22:37 -07:00
Simon Forman 4fbe2ed4a0 Simpler tokenizer.
Once the syntax was simple enough the re.Scanner became overkill.

From
http://norvig.com/lispy.html
by way of
https://github.com/ckkashyap/s2c
2022-09-10 17:08:46 -07:00
Simon Forman 2ad303c247 A bit more docs. 2022-09-09 11:58:35 -07:00
Simon Forman f2791c02c3 Move ParseError to parser section; add a few type guards. 2022-09-08 20:59:12 -07:00
Simon Forman f08db94db1 Minor cleanup. 2022-09-08 14:25:02 -07:00
Simon Forman 359131f7b1 Expression objects.
This should be more efficient than concat().
2022-09-08 11:31:09 -07:00
Simon Forman eecc983b99 blacken 2022-09-08 10:37:46 -07:00
Simon Forman d7f047cee6 move stack code up under interp & minor edits 2022-09-08 09:06:26 -07:00
Simon Forman 20c4b90298 make type checks into Joy functions 2022-09-08 08:46:34 -07:00
Simon Forman ebdb8da03d move type checks and exceptions to bottom 2022-09-08 08:27:47 -07:00
Simon Forman ac326590db minor cleanup 2022-09-07 23:43:50 -07:00
Simon Forman e13a7b9f5c Remove debug session. 2022-09-07 22:23:23 -07:00
Simon Forman 69cb7febf6 That doesn't go there. 2022-09-07 21:15:09 -07:00
Simon Forman 9bb31cbc8a Minor cleanup. 2022-09-07 21:01:07 -07:00
Simon Forman 2c0a0aafcc halt and quit
halt captures the rest of the pending expression and stops evaluating,
but the interpreter loop keeps running.

quit ends the interpreter session and quits the Thun program.
2022-09-07 20:42:48 -07:00
Simon Forman 08f977324f Passes (updated) tests.
https://git.sr.ht/~sforman/joytest
2022-09-07 20:33:13 -07:00
Simon Forman 7594fb887f Harden up the types. 2022-09-07 19:39:00 -07:00
Simon Forman d7b445fdd4 Quiet mode for testing. Misc cleanup. 2022-09-07 17:27:36 -07:00
Simon Forman 660fdb0bef Just put ≡ inline. 2022-09-07 14:46:26 -07:00
Simon Forman 88f3cc4bbe Blacken the code. 2022-09-07 14:21:33 -07:00
Simon Forman 4f48ffbb5f Type-guard the ops. 2022-09-07 14:18:55 -07:00
Simon Forman 67fd88f68a Words and Help; use ≡ for definitions.
By using ≡ for definitions I can put docs in the DEFS string and easily
detect definitions by having them be each on their own line.
2022-09-07 13:13:46 -07:00
Simon Forman 29e6f160c6 It's a script. 2022-09-07 11:57:57 -07:00
Simon Forman 95366dde07 More docstrings. 2022-09-07 11:54:29 -07:00
Simon Forman 237f9bcfce Docstrings. 2022-09-07 11:46:59 -07:00
Simon Forman 51664c5856 Pylint is kind useless on this one. 2022-09-07 11:18:08 -07:00
Simon Forman acd0424287 Boolean literals. 2022-09-07 11:13:12 -07:00
Simon Forman 9fbcab6896 Docs (and strip trailing blanks.) 2022-09-07 10:42:20 -07:00
Simon Forman be13b72d93 Blacken the code (simplejoy.py)
I don't like it entirely but that's the point: nevermind your taste,
just use a simple and universal (Ha!) standard format(ter) and get on
with your life.
2022-09-07 09:41:08 -07:00
Simon Forman d6818620e3 Misc cruft. 2022-09-07 09:28:30 -07:00
Simon Forman b386549226 Simple Joy 2022-09-07 09:23:02 -07:00
Simon Forman 4a5716d8b2 Rebuild HTML docs. 2022-08-16 15:26:07 -07:00
Simon Forman 3883cac99a Minor edits. 2022-08-15 16:20:59 -07:00
Simon Forman 2fb27971f1 Two wrappers
One for math ops, the other for Boolean.

Fixes: https://todo.sr.ht/~sforman/thun-der/13
2022-04-05 10:02:01 -07:00
Simon Forman a0374c5734 Start a per-project README for Python. 2022-04-04 08:01:51 -07:00
Simon Forman 1da997fbbf Expression? 2022-04-04 07:58:22 -07:00
Simon Forman 79fbe15f51 Make divmod work like the docs say it does. 2022-03-25 10:56:15 -07:00
Simon Forman 9057e3b347 Most of the C's. 2022-03-24 12:33:20 -07:00
Simon Forman 4827aa467e Minor cleanup. 2022-03-22 21:24:07 -07:00
Simon Forman ba6d09f956 Remove parse, no strings in base library.
References: https://todo.sr.ht/~sforman/Xerblin/10
2022-03-22 07:59:11 -07:00
Simon Forman 2cf49a2ad2 Bump version to tickle PyPI.
Tickle PyPI to make JOY_BOOL_LITERALS available to Xerblin.

Make JOY_BOOL_LITERALS available to Xerblin so ReadTheDocs can build the
Xerblin docs.
2022-03-09 17:40:57 -08:00
Simon Forman b190f8eca8 Export JOY_BOOL_LITERALS 2022-03-09 14:53:16 -08:00
Simon Forman 4d0754ffb9 long_description_content_type
shut up twine warning.

Hey PyPA where is the list of valid content types? Is it just MIME
types?
2022-03-09 13:15:49 -08:00
Simon Forman 4218d69abc Bump version to 0.5.0 2022-03-09 12:45:10 -08:00
Simon Forman 87fe1d0b3c Snippets support.
Parse, print.
2022-03-01 19:13:44 -08:00
Simon Forman 142d6e53b0 Let's try out the "snippets" idea.
Represent strings (byte strings) as three-tuples of (git sha hash,
offset, length) immutable datastructures.
2022-03-01 14:13:07 -08:00
Simon Forman 4ac8fd5f4c Sphinx confused by `•`.
When building the HTML docs with Sphinx v4.3.0 the bullet symbol in
backticks quotes causes this warning message:

    .../Joypy/implementations/Python/joy/utils/pretty_print.py:docstring of joy.utils.pretty_print:15: WARNING: Inline interpreted text or phrase reference start-string without end-string.
2022-02-19 07:39:07 -08:00
Simon Forman d42a8dfc0c Move Python impl to impls dir. 2022-01-24 19:02:47 -08:00