Open hcchengithub opened 7 years ago
Just uploaded to PyPI, the below example installs peforth and run
c:\Users\hcche\Downloads>pip install peforth
Collecting peforth
Downloading peforth-1.2-py3-none-any.whl (48kB)
100% | | 51kB 312kB/s
Installing collected packages: peforth
Successfully installed peforth-1.2
c:\Users\hcche\Downloads>python -m peforth
p e f o r t h v1.02
source code http://github.com/hcchengithub/peforth
Type 'peforth.ok()' enters forth interpreter, 'exit' to come back.
OK words
0 code end-code \ // <selftest> </selftest> bye /// immediate stop
compyle trim indent -indent <py> </py> </pyV> words . cr help
interpret-only compile-only literal reveal privacy (create) : ; ( BL
word ' , [compile] py: py> 0branch here! here swap ! @ ? >r r> r@ drop
dup over 0< + * - / 1+ 2+ 1- 2- compile if then compiling char CR last
version execute see-cfa cls private nonprivate \s (space) exit ret
rescan-word-hash (') branch bool and or not (forget) AND OR NOT XOR
true false "" [] {} none >> << 0= 0> 0<> 0<= 0>= = == > < != >= <= abs
max min doVar doNext depth pick roll space [ ] colon-word create (marker)
marker next abort alias <> public nip rot -rot 2drop 2dup invert negate
within ['] allot for begin until again ahead never repeat aft else while
?stop ?dup variable +! chars spaces .( ." .' s" s' s` does> count accept
accept2 <accept> nop </accept> refill [else] [if] [then] :: :>
"msg"abort abort" "msg"?abort ?abort" '<text> (<text>) <text> </text>
<comment> </comment> constant value to cut -word rewind ?rewind tib. >t
t@ t> [begin] [again] [until] [for] [next] int float drops dropall
char>ASCII ASCII>char ASCII .s (*debug*) *debug* readTextFile writeTextFile
tib.insert sinclude include type dir keys obj>keys obj2dict stringify
toString .literal .function (dump) dump dump2ret d (see) see notpass passed
slice description expected_rstack expected_stack test-result [all-pass]
*** ---
OK
type 'help' to view all words' with help. (that's long!)
Introduction Example-1 Hello world! Example-2 inline python Example-3 project-k forth kernel Example-4 Examine a Machine-Learning exercise Example-5 View MNIST handwritten digit images
pip install peforth
to install peforth. Simply import peforth
run peforth.ok()
peforth.ok('OK ', loc=locals(), cmd='constant breakpoint_info')
where FORTH constant breakpoint_info is now a tuple of (locals_dict, globals_dict, prompt_str) so you can access everything of your code at the breakpoint.
peforth for python http://github.com/hcchengithub/peforth See wiki of the project for example. I build peforth for studying Machine Learning courses.