This page is a first try at describing the semantics of Hedy. Because Hedy code is transpiled into Python, we define the semantics of an Hedy program in terms of the semantics of the resulting Python code, or, in case of an error, the resulting HedyException.
Level 1 supports:
print
ask
forward
turn
echo
Hedy | Python |
---|---|
print x | print('x') |
forward | t = turtle.Turtle() t.forward(50) |
turn | t = turtle.Turtle() t.right(90) |
ask x | answer = input('x') |
ask x echo y |
answer = input('x') print('y', answer) |
Hedy | Exception |
---|---|
Incomplete Exception | |
ask | Incomplete Exception |
echo | Incomplete Exception |
(print | ask | forward | turn | echo) (any text)? | Invalid Exception |
any valid line(s) of code not using ask echo x |
Lonely Echo |
_SPACE (print | ask | forward | turn | echo) (any text)? | Invalid space |