Quackery
所属分类:编程语言基础
开发工具:Python
文件大小:0KB
下载次数:0
上传日期:2022-12-31 22:00:41
上 传 者:
sh-1993
说明: 受Forth和Lisp启发,用于娱乐和教育编程的轻量级开源语言
(a lightweight, open-source language for recreational and educational programming inspired by Forth and Lisp)
文件列表:
READ ME FIRST.txt (1469, 2023-10-22)
The Book of Quackery for print.pdf (2025956, 2023-10-22)
The Book of Quackery.pdf (2018740, 2023-10-22)
bigrat.qky (5490, 2023-10-22)
extensions.qky (1195, 2023-10-22)
quackery.py (49049, 2023-10-22)
sundry/ (0, 2023-10-22)
sundry/cards.qky (4000, 2023-10-22)
sundry/demo.qky (5681, 2023-10-22)
sundry/fsm.qky (1455, 2023-10-22)
sundry/heapsort.qky (2000, 2023-10-22)
turtleduck.qky (2586, 2023-10-22)
# Quackery
Quackery is a lightweight, open-source language for recreational and
educational programming, inspired by Forth and Lisp.
Sample Quackery Shell dialogue; defining and testing an insertion sort.
/O> [ [] swap witheach
... [ swap 2dup
... findwith [ over > ] [ ]
... nip stuff ] ] is i-sort ( [ --> [ )
...
Stack empty.
/O> [] 10 times [ i join ]
... shuffle dup echo
... say " --> "
... i-sort echo
...
[ 6 7 5 8 3 4 2 1 0 9 ] --> [ 0 1 2 3 4 5 6 7 8 9 ]
Stack empty.
/O>
The Quackery language is an extensible assembler for a Quackery
Engine. The Quackery Engine has a memory model based on dynamic arrays
and bignums, so presumes comprehensive hardware support for these
features.
Program execution consists of the Quackery Processor traversing
directed tree-like graphs built from dynamic arrays ("Nests" in the
Quackery nomenclature) containing Operators (op-codes), Numbers
(pointers to bignums) and pointers to Nests. The Quackery processor is
stack-based rather than register-based.
Programming in Quackery consists of extending the predefined graphs
that constitute the Quackery environment.
This implementation of a virtual Quackery Engine uses Python lists as
Nests, Python functions as Operators and Python ints as Numbers.
The Quackery processor and a basic Quackery compiler are coded in
Python 3, and the Python Quackery compiler is used to compile the
Quackery environment, which is written in Quackery and includes a more
fully featured (and extensible) Quackery compiler, which is available
to the Quackery programmer.
That the Quackery language has similarities to Forth (also an
extensible assembler for a stack processor), that it leans on Python
for support for dynamic arrays and bignums, and that the majority of
Quackery is written in Quackery all make for a very compact
implementation, under 48k of source code. The downsides are that it is
rather slow by modern standards, and that it is by no means "fully
featured".
In its defence it is possible to understand the entirety of Quackery
in short order, and, once the hurdle of Reverse Polish Notation has
been passed, program development with the interactive environment (the
Quackery Shell) is quick and rewarding. Quackery is intended primarily
for recreational and educational programming, and is a relatively
painless introduction to the concatenative programming paradigm.
近期下载者:
相关文件:
收藏者: