• R/O
  • HTTP
  • SSH
  • HTTPS

Thun: Commit

Interpreter and library.


Commit MetaInfo

Révision68f6e210e5bb04231be667eea60d82769f3e0669 (tree)
l'heure2022-04-05 01:09:01
AuteurSimon Forman <sforman@hush...>
CommiterSimon Forman

Message de Log

Minor cleanup.

Change Summary

Modification

--- a/README
+++ b/README
@@ -4,8 +4,6 @@ A Dialect of Joy.
44
55 v0.4.2
66
7-§.1 Introduction
8-
97 Joy is a programming language created by Manfred von Thun that is easy to
108 use and understand and has many other nice properties. This project
119 implements interpreters for a dialect that attempts to stay very close to
@@ -21,40 +19,44 @@ Joy and its deeper facets as well as how to program in it and several
2119 interesting aspects. It's quite a treasure trove.
2220
2321
24-§.2 Installation
25-
26-From PyPI in the usual way, e.g.:
27-
28- pip install Thun
29-
30-Or if you have downloaded the source, from the top directory:
31-
32- python ./setup.py install
33-
34-Or you can run the package directly from the top directory.
35-
36-To start a crude REPL:
37-
38- python -m joy
22+Directory structure
3923
40-There is a "quiet" mode for e.g. using joy from a shell script:
24+ Thun
25+ |-- LICENSE - GPLv3
26+ |-- README - this file
27+ |
28+ |-- archive
29+ | |-- Joy-Programming.zip
30+ | `-- README
31+ |
32+ |-- docs
33+ | |-- notebooks - Jupyter Notebooks and supporting modules
34+ | |-- reference - Docs for each function.
35+ | |-- sphinx_docs - Generate https://joypy.osdn.io/ site.
36+ | `-- README - Table of Contents
37+ |
38+ `-- implementations
39+ |-- Nim - interpreter
40+ |-- Prolog - interpreter
41+ | type inference
42+ | work-in-progress compiler
43+ |-- Python - interpreter
44+ |-- Rust - work-in-progress interpreter
45+ `-- defs.txt - common Joy definitions for all interpreters
4146
42- python -m joy -q
4347
44-This supresses the initial banner output and the prompt text.
48+Documentation
4549
50+Jupyter Notebooks
4651
47-§.3 Documentation
52+The docs/notebooks dir contains Jupyter notebooks, ... TODO
4853
49-§.3.1 Jupyter Notebooks
54+Sphinx Docs
5055
51-The docs/ folder contains Jupyter notebooks, ... TODO
56+Some of the documentation is in the form of ReST files in
57+docs/sphinx_docs dir.
5258
53-§.3.2 Sphinx Docs
54-
55-Some of the documentation is in the form of ReST files
56-
57-§.3.3 Building the Docs
59+Building the Docs
5860
5961 Building the documentation is a little tricky at the moment. It involves
6062 a makefile that uses nbconvert to generate ReST files from some of the
@@ -67,7 +69,7 @@ Get the dependencies for (re)building the docs:
6769 make docs
6870
6971
70-§.4 Basics of Joy
72+Basics of Joy
7173
7274 Joy is stack-based. There is a main stack that holds data items:
7375 integers, floats, strings, functions, and sequences or quotes which hold
@@ -81,22 +83,8 @@ by iterating through the terms in the expression, putting all literals
8183 onto the main stack and executing functions as they are encountered.
8284 Functions receive the current stack and return the next stack.
8385
84-§.4.1 Python Semantics
85-
86-In general, where otherwise unspecified, the semantics of Thun are that
87-of the underlying Python. That means, for example, that integers are
88-unbounded (whatever your machine can handle), strings cannot be added to
89-integers but can be multiplied, Boolean True and False are effectively
90-identical to ints 1 and 0, empty sequences are considered False, etc.
91-
92-Nothing is done about Python exceptions currently, although it would be
93-possible to capture the stack and expression just before the exception
94-and build a robust and flexible error handler. Because they are both
95-just datastructures, you could immediately retry them under a debugger,
96-or edit either or both of the stack and expression. All state is in one
97-or the other.
9886
99-§.4.2 Literals and Simple Functions
87+Literals and Simple Functions
10088
10189 joy? 1 2 3
10290 . 1 2 3
@@ -123,7 +111,7 @@ or the other.
123111 joy?
124112
125113
126-§.4.3 Combinators
114+Combinators
127115
128116 The main loop is very simple as most of the action happens through what
129117 are called "combinators": functions which accept quoted programs on the
@@ -153,41 +141,6 @@ TODO:
153141 §.4.6 Refactoring
154142
155143
156-§.5 This Implementation
157-
158-Run with:
159-
160- python -m joy
161-
162-Thun
163- |-- COPYING - license
164- |-- README - this file
165- |
166- |-- archive - info on Joy
167- | |-- Joy-Programming.zip
168- | `-- README
169- |
170- |-- docs - Various Examples and Demos
171- | |-- * - Jupyter Notebooks on Thun and supporting modules
172- | `-- README - Table of Contents
173- |
174- |-- joy
175- | |-- joy.py - main loop, REPL
176- | |-- library.py - Functions, Combinators, Definitions
177- | |-- parser.py - convert text to Joy datastructures
178- | |
179- | `-- utils
180- | |-- pretty_print.py - convert Joy datastructures to text
181- | `-- stack.py - work with stacks
182- |
183- |-- thun - Experimental Prolog Code
184- | |-- compiler.pl - A start on a compiler for Prof. Wirth's RISC CPU
185- | `-- thun.pl - An interpreter in the Logical Paradigm, compiler.
186- |
187- `-- setup.py
188-
189-
190-
191144 §.6 References & Further Reading
192145
193146
Afficher sur ancien navigateur de dépôt.