feat: Add transformation to Python and a menu item to call it

This commit is contained in:
Glen Whitney 2020-12-09 20:46:06 -08:00
parent 9985fe1dde
commit cd5f02603b
6 changed files with 44 additions and 1 deletions

25
trans/python.str Normal file
View file

@ -0,0 +1,25 @@
module python
imports
signatures/-
rules
// Generate python code from AST:
to-python:
Program(x, y) -> $[ print( [x'] + ',', [y'] ) ]
where
x' := <to-python> x
; y' := <to-python> y
to-python:
Hello() -> $[ "Greetings" ]
to-python:
World() -> $[ "Earth" ]
// Interface python code generation with editor services and file system
generate-python: (selected, _, _, path, project-path) -> (filename, result)
with filename := <guarantee-extension(|"py")> path
; result := <to-python> selected

View file

@ -6,6 +6,7 @@ imports
pp
outline
analysis
python
rules // Debugging