make blocks

This commit is contained in:
Peter
2023-12-19 14:15:26 +01:00
parent c7bf88c33a
commit 1b4d8d622d
7 changed files with 38 additions and 58 deletions

View File

@@ -15,5 +15,5 @@ imports
rules
to-funcons:
|[ start[: (:Stmt*:) :] ]| ->
|[ initialise-binding execute[: {(:Stmt*:)} :] ]|
|[ initialise-binding execute-block[: {(:Stmt*:)} :] ]|

View File

@@ -17,9 +17,8 @@ rules
to-funcons:
|[ execute[: {(:Stmt*:)} :] ]| ->
|[ scope (collateral (collect-declared-vars[: (:Stmt*:) :]),
execute[: (:Stmt*:) :]) ]|
|[ execute[: (:Block:) :] ]| ->
|[ execute-block[: (:Block:) :] ]|
to-funcons:
|[ execute[: print((:Exp:)); :] ]| ->
|[ print eval-exp[: (:Exp:) :] ]|
@@ -42,7 +41,7 @@ to-funcons:
|[ execute[: return; :] ]| ->
|[ return null ]|
to-funcons:
|[ execute[: fun(:Id:)((:Params:)){(:Stmt*:)} :] ]| ->
|[ execute[: fun(:Id:)((:Params:))(:Block:) :] ]| ->
|[ null ]|
to-funcons:
|[ execute[: :] ]| ->
@@ -51,6 +50,10 @@ to-funcons:
|[ execute[: (:Stmt:)(:Stmt+:) :] ]| ->
|[ sequential (execute[: (:Stmt:) :],
execute[: (:Stmt+:) :]) ]|
to-funcons:
|[ execute-block[: {(:Stmt*:)} :] ]| ->
|[ scope (collateral (collect-declared-vars[: (:Stmt*:) :]),
execute[: (:Stmt*:) :]) ]|
// # Handling parameter declarations