Skip to content

Commit

Permalink
Update DESIGN.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Felienne authored May 24, 2021
1 parent 397c367 commit 9e7a2e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ Architecture

The global idea of Hedy is that we transpile Hedy code to Python code by adding syntactic elements when they are missing. In the code base, this works in steps:

1. Hedy code is parsed based on the relevant grammar, creating an AST. This is done using the open source Lark parser
1. Hedy code is parsed based on the relevant grammar, creating an AST. This is done using the open source Lark parser.
2. Validity of the code is checked with the IsValid() function
3. If the code is valid, it is transformed into Python with the relevant function.

This logic all resides in hedy.py.

Transpiling
------------

Transpiling Hedy is a stepwise process. Firstly the code is parsed using Lark, resulting in an AST. The AST is then scanned for invalid rules. If these appear in the tree, the Hedy program is invalid and an error message will be generated. Secondly, a lookup table with all variable names occuring in the program is extracted from the AST. Finally, the AST is transformed into Python by adding needed syntax such as brackets.


Design Goals
------------
Expand Down

0 comments on commit 9e7a2e7

Please sign in to comment.