syntactic_ast: Modified letrec forms to also accept a body
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
@@ -29,7 +29,7 @@ type _ t =
|
|||||||
|
|
||||||
| LetBinding : symbol * expression t -> binding t
|
| LetBinding : symbol * expression t -> binding t
|
||||||
| Let : binding t list * body t -> expression t
|
| Let : binding t list * body t -> expression t
|
||||||
| LetRec : binding t list * expression t list -> expression t
|
| LetRec : binding t list * body t -> expression t
|
||||||
|
|
||||||
| CondClause : expression t * expression t -> clause t
|
| CondClause : expression t * expression t -> clause t
|
||||||
| Cond : clause t list -> expression t
|
| Cond : clause t list -> expression t
|
||||||
@@ -224,6 +224,17 @@ and print_expr = function
|
|||||||
(String.concat "\n" (map print_let_binding binds))
|
(String.concat "\n" (map print_let_binding binds))
|
||||||
(print_defs defs)
|
(print_defs defs)
|
||||||
(print_exprs exprs)
|
(print_exprs exprs)
|
||||||
|
| LetRec (binds, Body (defs, exprs)) ->
|
||||||
|
pf "(letrec
|
||||||
|
; BINDINGS
|
||||||
|
%s
|
||||||
|
; BODY
|
||||||
|
%s
|
||||||
|
; EXPRESSIONS
|
||||||
|
%s)"
|
||||||
|
(String.concat "\n" (map print_let_binding binds))
|
||||||
|
(print_defs defs)
|
||||||
|
(print_exprs exprs)
|
||||||
| Var s -> s
|
| Var s -> s
|
||||||
| Apply (f, exprs) ->
|
| Apply (f, exprs) ->
|
||||||
pf "(apply %s %s)"
|
pf "(apply %s %s)"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
type symbol = string
|
type symbol = string
|
||||||
|
|
||||||
(* These are just used for the GADT *)
|
(* These are just used for the GADT *)
|
||||||
type expression
|
type expression
|
||||||
type definition
|
type definition
|
||||||
@@ -22,7 +23,7 @@ type _ t =
|
|||||||
|
|
||||||
| LetBinding : symbol * expression t -> binding t
|
| LetBinding : symbol * expression t -> binding t
|
||||||
| Let : binding t list * body t -> expression t
|
| Let : binding t list * body t -> expression t
|
||||||
| LetRec : binding t list * expression t list -> expression t
|
| LetRec : binding t list * body t -> expression t
|
||||||
|
|
||||||
| CondClause : expression t * expression t -> clause t
|
| CondClause : expression t * expression t -> clause t
|
||||||
| Cond : clause t list -> expression t
|
| Cond : clause t list -> expression t
|
||||||
|
|||||||
Reference in New Issue
Block a user