changeset d9cc9c6acc57 in joypy/Joypy details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=d9cc9c6acc57 user: Simon Forman <sform****@hushm*****> date: Tue May 19 14:27:18 2020 -0700 description: Yes, tabs. changeset 7e25e2e7ae17 in joypy/Joypy details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=7e25e2e7ae17 user: Simon Forman <sform****@hushm*****> date: Tue May 19 14:50:10 2020 -0700 description: Minor cleanup. changeset 3b453f3f1a53 in joypy/Joypy details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=3b453f3f1a53 user: Simon Forman <sform****@hushm*****> date: Tue May 19 15:13:38 2020 -0700 description: Make the GUI its own thing. changeset 239cf1409d4f in joypy/Joypy details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=239cf1409d4f user: Simon Forman <sform****@hushm*****> date: Tue May 19 15:34:20 2020 -0700 description: Remove the Joy code. It's now a dependency that you have to get from e.g. PyPI. diffstat: .hgignore | 1 + MANIFEST | 41 - Makefile | 20 +- README | 201 +- archive/Joy-Programming.zip | Bin archive/README | 4 - docs/VUI-docs/Makefile | 19 + docs/VUI-docs/build/doctrees/core.doctree | Bin docs/VUI-docs/build/doctrees/display.doctree | Bin docs/VUI-docs/build/doctrees/environment.pickle | Bin docs/VUI-docs/build/doctrees/index.doctree | Bin docs/VUI-docs/build/doctrees/main.doctree | Bin docs/VUI-docs/build/doctrees/persist_task.doctree | Bin docs/VUI-docs/build/doctrees/stack_viewer.doctree | Bin docs/VUI-docs/build/doctrees/text_viewer.doctree | Bin docs/VUI-docs/build/doctrees/viewer.doctree | Bin docs/VUI-docs/build/html/.buildinfo | 4 + docs/VUI-docs/build/html/_images/Joy-VUI-screenshot.PNG | Bin docs/VUI-docs/build/html/_images/packages_Vui.png | Bin docs/VUI-docs/build/html/_modules/index.html | 105 + docs/VUI-docs/build/html/_modules/joy/vui/core.html | 380 + docs/VUI-docs/build/html/_modules/joy/vui/display.html | 604 + docs/VUI-docs/build/html/_modules/joy/vui/main.html | 274 + docs/VUI-docs/build/html/_modules/joy/vui/persist_task.html | 372 + docs/VUI-docs/build/html/_modules/joy/vui/stack_viewer.html | 175 + docs/VUI-docs/build/html/_modules/joy/vui/text_viewer.html | 799 + docs/VUI-docs/build/html/_modules/joy/vui/viewer.html | 345 + docs/VUI-docs/build/html/_sources/core.rst.txt | 3 + docs/VUI-docs/build/html/_sources/display.rst.txt | 3 + docs/VUI-docs/build/html/_sources/index.rst.txt | 175 + docs/VUI-docs/build/html/_sources/main.rst.txt | 3 + docs/VUI-docs/build/html/_sources/persist_task.rst.txt | 3 + docs/VUI-docs/build/html/_sources/stack_viewer.rst.txt | 3 + docs/VUI-docs/build/html/_sources/text_viewer.rst.txt | 3 + docs/VUI-docs/build/html/_sources/viewer.rst.txt | 3 + docs/VUI-docs/build/html/_static/Joy-VUI-screenshot.PNG | Bin docs/VUI-docs/build/html/_static/ajax-loader.gif | Bin docs/VUI-docs/build/html/_static/alabaster.css | 693 + docs/VUI-docs/build/html/_static/basic.css | 676 + docs/VUI-docs/build/html/_static/comment-bright.png | Bin docs/VUI-docs/build/html/_static/comment-close.png | Bin docs/VUI-docs/build/html/_static/comment.png | Bin docs/VUI-docs/build/html/_static/custom.css | 1 + docs/VUI-docs/build/html/_static/doctools.js | 315 + docs/VUI-docs/build/html/_static/documentation_options.js | 10 + docs/VUI-docs/build/html/_static/down-pressed.png | Bin docs/VUI-docs/build/html/_static/down.png | Bin docs/VUI-docs/build/html/_static/file.png | Bin docs/VUI-docs/build/html/_static/jquery-3.2.1.js | 10253 ++++++++++ docs/VUI-docs/build/html/_static/jquery.js | 4 + docs/VUI-docs/build/html/_static/language_data.js | 297 + docs/VUI-docs/build/html/_static/minus.png | Bin docs/VUI-docs/build/html/_static/packages_Vui.png | Bin docs/VUI-docs/build/html/_static/plus.png | Bin docs/VUI-docs/build/html/_static/pygments.css | 65 + docs/VUI-docs/build/html/_static/searchtools.js | 481 + docs/VUI-docs/build/html/_static/underscore-1.3.1.js | 999 + docs/VUI-docs/build/html/_static/underscore.js | 31 + docs/VUI-docs/build/html/_static/up-pressed.png | Bin docs/VUI-docs/build/html/_static/up.png | Bin docs/VUI-docs/build/html/_static/websupport.js | 808 + docs/VUI-docs/build/html/core.html | 234 + docs/VUI-docs/build/html/display.html | 286 + docs/VUI-docs/build/html/genindex.html | 463 + docs/VUI-docs/build/html/index.html | 242 + docs/VUI-docs/build/html/main.html | 180 + docs/VUI-docs/build/html/objects.inv | Bin docs/VUI-docs/build/html/persist_task.html | 222 + docs/VUI-docs/build/html/py-modindex.html | 153 + docs/VUI-docs/build/html/search.html | 116 + docs/VUI-docs/build/html/searchindex.js | 1 + docs/VUI-docs/build/html/stack_viewer.html | 114 + docs/VUI-docs/build/html/text_viewer.html | 124 + docs/VUI-docs/build/html/viewer.html | 150 + docs/VUI-docs/make.bat | 35 + docs/VUI-docs/source/_static/Joy-VUI-screenshot.PNG | Bin docs/VUI-docs/source/_static/packages_Vui.png | Bin docs/VUI-docs/source/conf.py | 179 + docs/VUI-docs/source/core.rst | 3 + docs/VUI-docs/source/display.rst | 3 + docs/VUI-docs/source/index.rst | 175 + docs/VUI-docs/source/main.rst | 3 + docs/VUI-docs/source/persist_task.rst | 3 + docs/VUI-docs/source/stack_viewer.rst | 3 + docs/VUI-docs/source/text_viewer.rst | 3 + docs/VUI-docs/source/viewer.rst | 3 + docs/sphinx_docs/_build/html/_modules/joy/library.html | 394 +- docs/sphinx_docs/_build/html/_modules/joy/parser.html | 2 +- docs/sphinx_docs/_build/html/genindex.html | 107 +- docs/sphinx_docs/_build/html/library.html | 78 +- docs/sphinx_docs/_build/html/objects.inv | Bin docs/sphinx_docs/_build/html/py-modindex.html | 5 + docs/sphinx_docs/_build/html/searchindex.js | 2 +- docs/sphinx_docs/_build/html/types.html | 208 + docs/sphinx_docs/types.rst | 10 +- i3.json | 88 + joy/__main__.py | 34 - joy/joy.py | 111 - joy/library.py | 1423 - joy/parser.py | 124 - joy/utils/generated_library.py | 389 - joy/utils/pretty_print.py | 128 - joy/utils/stack.py | 197 - setup.py | 30 +- start-with-i3.sh | 1 + start.bat | 1 + startREPL.bat | 1 - startVUI.bat | 1 + xerblin/gui/__main__.py | 24 + xerblin/gui/controllerlistbox.py | 156 + xerblin/gui/default_joy_home/definitions.txt | 49 + xerblin/gui/default_joy_home/log.txt | 4 + xerblin/gui/default_joy_home/scratch.txt | 59 + xerblin/gui/default_joy_home/stack.pickle | 1 + xerblin/gui/default_joy_home/thun.config | 15 + xerblin/gui/init_joy_home.py | 106 + xerblin/gui/main.py | 198 + xerblin/gui/mousebindings.py | 211 + xerblin/gui/textwidget.py | 474 + xerblin/gui/utils.py | 98 + xerblin/gui/world.py | 173 + xerblin/vui/Iosevka12.BMP | Bin xerblin/vui/README.txt | 163 + xerblin/vui/__main__.py | 24 + xerblin/vui/core.py | 282 + xerblin/vui/debug_main.py | 19 + xerblin/vui/default_joy_home/definitions.txt | 17 + xerblin/vui/default_joy_home/library.py | 206 + xerblin/vui/default_joy_home/log.txt | 1 + xerblin/vui/default_joy_home/menu.txt | 51 + xerblin/vui/default_joy_home/scratch.txt | 85 + xerblin/vui/default_joy_home/stack.pickle | 1 + xerblin/vui/display.py | 510 + xerblin/vui/font_data.py | 189 + xerblin/vui/init_joy_home.py | 278 + xerblin/vui/main.py | 179 + xerblin/vui/persist_task.py | 274 + xerblin/vui/stack_viewer.py | 75 + xerblin/vui/text_viewer.py | 704 + xerblin/vui/viewer.py | 249 + 140 files changed, 26304 insertions(+), 2773 deletions(-) diffs (truncated from 30334 to 300 lines): diff -r 18c912c5352d -r 239cf1409d4f .hgignore --- a/.hgignore Tue May 19 14:09:00 2020 -0700 +++ b/.hgignore Tue May 19 15:34:20 2020 -0700 @@ -5,6 +5,7 @@ .vscode docs/.ipynb_checkpoints test/* +gnu-prolog/thun venv build Thun.egg-info diff -r 18c912c5352d -r 239cf1409d4f MANIFEST --- a/MANIFEST Tue May 19 14:09:00 2020 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -# file GENERATED by distutils, do NOT edit -COPYING -README -setup.py -archive\Joy-Programming.zip -archive\README -joy\__init__.py -joy\__main__.py -joy\joy.py -joy\library.py -joy\parser.py -joy\gui\__init__.py -joy\gui\__main__.py -joy\gui\init_joy_home.py -joy\gui\main.py -joy\gui\mousebindings.py -joy\gui\textwidget.py -joy\gui\utils.py -joy\gui\world.py -joy\utils\__init__.py -joy\utils\brutal_hackery.py -joy\utils\compiler.py -joy\utils\generated_library.py -joy\utils\infinite_stack.py -joy\utils\pretty_print.py -joy\utils\stack.py -joy\utils\types.py -joy\vui\__init__.py -joy\vui\__main__.py -joy\vui\core.py -joy\vui\debug_main.py -joy\vui\display.py -joy\vui\font_data.py -joy\vui\init_joy_home.py -joy\vui\main.py -joy\vui\persist_task.py -joy\vui\stack_viewer.py -joy\vui\text_viewer.py -joy\vui\viewer.py -joy\vui\default_joy_home\library.py -test\test_type_inference.py diff -r 18c912c5352d -r 239cf1409d4f Makefile --- a/Makefile Tue May 19 14:09:00 2020 -0700 +++ b/Makefile Tue May 19 15:34:20 2020 -0700 @@ -1,22 +1,19 @@ # My make-fu style is old and tired. I just want to have a few helper commands. TESTDIR = ./test00 -VERSION = 0.4.0 +VERSION = 0.1.0 WEBSERVER = sform****@shell***** -.PHONY: clean sdist test docs upload-docs +.PHONY: clean sdist test clean: - $(RM) -r Thun.egg-info/ dist/ build/ __pycache__/ $(TESTDIR) + $(RM) -r Xerblin.egg-info/ dist/ build/ __pycache__/ $(TESTDIR) find . -name '*.pyc' | xargs $(RM) sdist: python ./setup.py sdist bdist_wheel -joy/utils/generated_library.py: joy/utils/types.py - python -c 'import joy.utils.types ; joy.utils.types.generate_library_code()' > $@ - # In order to support testing the code as installed # create a virtualenv and install the source dist zip there. @@ -24,13 +21,6 @@ $(RM) -r $(TESTDIR) virtualenv --system-site-packages --never-download $(TESTDIR) . $(TESTDIR)/bin/activate && \ - pip install --no-cache-dir --no-index ./dist/Thun-$(VERSION).tar.gz + pip install setuptools && \ + pip install --no-cache-dir --no-index ./dist/Xerblin-$(VERSION).tar.gz echo "Type: source $(TESTDIR)/bin/activate" - - -docs: - cd ./docs && make && make mov && cd ./sphinx_docs && make html - -upload-docs: docs - ssh $(WEBSERVER) /home/users/s/sf/sforman/backup-and-remove-htdocs - rsync -rv --progress ./docs/sphinx_docs/_build/html/ $(WEBSERVER):/home/groups/j/jo/joypy/htdocs/ diff -r 18c912c5352d -r 239cf1409d4f README --- a/README Tue May 19 14:09:00 2020 -0700 +++ b/README Tue May 19 15:34:20 2020 -0700 @@ -1,16 +1,16 @@ - Thun +Xerblin - Dialects of Joy in Python and Prolog. +IDE/GUI for Joy. - v0.3.0 +v0.1.0 -------------------------------------------------- -Copyright © 2014-2020 Simon Forman +Copyright © 2020 Simon Forman This file is part of Thun @@ -33,202 +33,9 @@ §.1 Introduction -Joy is a programming language created by Manfred von Thun that is easy to -use and understand and has many other nice properties. This project -implements Python and Prolog interpreters for dialects that attempts to -stay very close to the spirit of Joy but does not precisely match the -behaviour of the original version written in C. - -The best source (no pun intended) for learning about Joy is the -information made available at the website of La Trobe University (see the -references section below for the URL) which contains source code for the -original C interpreter, Joy language source code for various functions, -and a great deal of fascinating material mostly written by Von Thun on -Joy and its deeper facets as well as how to program in it and several -interesting aspects. It's quite a treasure trove. - §.2 Installation -From PyPI in the usual way, e.g.: - - pip install Thun - -Or if you have downloaded the source, from the top directory: - python ./setup.py install Or you can run the package directly from the top directory. - -To start a crude REPL: - - python -m joy - - -§.3 Documentation - -§.3.1 Jupyter Notebooks - -The docs/ folder contains Jupyter notebooks, ... TODO - -§.3.2 Sphinx Docs - -Some of the documentation is in the form of ReST files - -§.3.3 Building the Docs - -Building the documentation is a little tricky at the moment. It involves -a makefile that uses nbconvert to generate ReST files from some of the -notebooks, copies those to the sphinx source dir, then builds the HTML -output using sphinx. - -Get the dependencies for (re)building the docs: - - pip install Thun[build-docs] - make docs - - -§.4 Basics of Joy - -Joy is stack-based. There is a main stack that holds data items: -integers, floats, strings, functions, and sequences or quotes which hold -data items themselves. - - 23 1.8 'a string' "another" dup [21 18 /] [1 [2 [3]]] - -A Joy expression is just a sequence (a.k.a. "list") of items. Sequences -intended as programs are called "quoted programs". Evaluation proceeds -by iterating through the terms in the expression, putting all literals -onto the main stack and executing functions as they are encountered. -Functions receive the current stack and return the next stack. - -§.4.1 Python Semantics - -In general, where otherwise unspecified, the semantics of Thun are that -of the underlying Python. That means, for example, that integers are -unbounded (whatever your machine can handle), strings cannot be added to -integers but can be multiplied, Boolean True and False are effectively -identical to ints 1 and 0, empty sequences are considered False, etc. - -Nothing is done about Python exceptions currently, although it would be -possible to capture the stack and expression just before the exception -and build a robust and flexible error handler. Because they are both -just datastructures, you could immediately retry them under a debugger, -or edit either or both of the stack and expression. All state is in one -or the other. - -§.4.2 Literals and Simple Functions - - joy? 1 2 3 - . 1 2 3 - 1 . 2 3 - 1 2 . 3 - 1 2 3 . - - 1 2 3 <-top - - joy? + + - 1 2 3 . + + - 1 5 . + - 6 . - - 6 <-top - - joy? 7 * - 6 . 7 * - 6 7 . * - 42 . - - 42 <-top - - joy? - - -§.4.3 Combinators - -The main loop is very simple as most of the action happens through what -are called "combinators": functions which accept quoted programs on the -stack and run them in various ways. These combinators factor specific -patterns that provide the effect of control-flow in other languages (such -as ifte which is like if..then..else..) Combinators receive the current -expession in addition to the stack and return the next expression. They -work by changing the pending expression the interpreter is about to -execute. The combinators could work by making recursive calls to the -interpreter and all intermediate state would be held in the call stack of -the implementation language, in this joy implementation they work instead -by changing the pending expression and intermediate state is put there. - - joy? 23 [0 >] [dup --] while - - ... - - -> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 - - -TODO: - -§.4.4 Definitions and More Elaborate Functions - -§.4.5 Programming and Metaprogramming - -§.4.6 Refactoring - - -§.5 This Implementation - -Run with: - - python -m joy - -Thun - |-- COPYING - license - |-- README - this file - | - |-- archive - info on Joy - | |-- Joy-Programming.zip - | `-- README - | - |-- docs - Various Examples and Demos - | |-- * - Jupyter Notebooks on Thun and supporting modules - | `-- README - Table of Contents - | - |-- joy - | |-- joy.py - main loop, REPL - | |-- library.py - Functions, Combinators, Definitions - | |-- parser.py - convert text to Joy datastructures - | | - | `-- utils - | |-- pretty_print.py - convert Joy datastructures to text - | `-- stack.py - work with stacks - | - |-- thun - Experimental Prolog Code - | |-- compiler.pl - A start on a compiler for Prof. Wirth's RISC CPU - | `-- thun.pl - An interpreter in the Logical Paradigm, compiler.