feat: Add transformation to Python and a menu item to call it
This commit is contained in:
parent
9985fe1dde
commit
cd5f02603b
6 changed files with 44 additions and 1 deletions
25
trans/python.str
Normal file
25
trans/python.str
Normal 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
|
|
@ -6,6 +6,7 @@ imports
|
|||
pp
|
||||
outline
|
||||
analysis
|
||||
python
|
||||
|
||||
rules // Debugging
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue