ast: improved the implementation of syntactic_ast
All checks were successful
ci/woodpecker/push/build Pipeline was successful

debug: added debug functions for the syntactic_ast module
Modified the compiler executable to test a little bit.

todo: Some nodes of the syntactic ast are not yet emitted,
This commit is contained in:
2026-01-03 18:30:47 +03:00
parent cb94372f29
commit 6d95977324
3 changed files with 122 additions and 31 deletions

View File

@@ -0,0 +1,37 @@
type symbol = string
(* These are just used for the GADT *)
type expression
type definition
type clause (* for cond *)
type binding (* for let *)
type lambda_list
type _ t =
| LitInt : int -> expression t
| LitDouble : float -> expression t
| LitString : string -> expression t
| LitNil : expression t
| QuotedList : expression t list * expression t option -> expression t
| LambdaList : symbol list * symbol option -> lambda_list t
| Lambda : lambda_list t * definition t list * expression t list -> expression t
| Define : symbol * expression t -> definition t
| LetBinding : symbol * expression t -> binding t
| Let : binding t list * expression t list -> expression t
| CondClause : expression t * expression t -> clause t
| Cond : clause t list -> expression t
| Var : symbol -> expression t
| Apply : expression t * expression t list -> expression t
type top_level =
| Def of definition t
| Exp of expression t
val make : Parser.Ast.lisp_ast -> (top_level, string) result
val print_def : definition t -> string
val print_expr : expression t -> string
val print : top_level -> string