From 0e808f69310deac5c4d635fbcfaaa12a0cc29908 Mon Sep 17 00:00:00 2001 From: crc Date: Wed, 18 Nov 2020 20:07:05 +0000 Subject: [PATCH] add python amalgamate tool FossilOrigin-Name: 4bab5cee7c6af28e3cbdbf32f5ce4dff7880ad5cdc0020a433b4da8eb876f343 --- example/amalgamate-python.retro | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 example/amalgamate-python.retro diff --git a/example/amalgamate-python.retro b/example/amalgamate-python.retro new file mode 100644 index 0000000..1bfaae9 --- /dev/null +++ b/example/amalgamate-python.retro @@ -0,0 +1,30 @@ +# Amalgamate + +The standard RETRO system is built using the Nga VM[1] and an +image file. The Python implementation consists of several files, +but it's nice to have a single file copy for easier deployment. +This tool combines the pieces into a single source file. + +Output will be written to stdout. + +## Code + +Extract and generate the single file source. + +~~~ +{{ + :include-file + #6 + s:chop 'vm/nga-python/ s:prepend here swap file:slurp here s:put ; + + :source:line + dup 'from_" s:begins-with? + [ include-file ] [ s:put nl ] choose ; + +---reveal--- + + :amalgamate + 'vm/nga-python/retro.py [ source:line ] file:for-each-line ; +}} + +amalgamate +~~~