spoofax_helloworld/trans/python.str

26 lines
559 B
Plaintext

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