(Block (StructDef "Person" (args (arg "name" (VarType "Text") nil) (arg "age" (VarType "Int") nil)) (Block (Declare (Var "max_age") nil (Int "122")) (FunctionDef (Var "greet") (args (arg "self" (VarType "Person") nil)) (Block (FunctionCall (Var "say") (Text "hi " (FieldAccess (Var "self") "name"))))))) (EnumDef "Shape" (tags (tag "Point" (args))(tag "Circle" (args (arg "radius" (VarType "Float64") nil)))(tag "Rectangle" (args (arg "width" (VarType "Float64") nil) (arg "height" (VarType "Float64") nil)))) (Block (FunctionDef (Var "is_point") (args (arg "self" (VarType "Shape") nil)) :return (VarType "Bool") (Block (Match (Var "self") (case (Var "Point") (Block (Return (Bool yes)))) :else (Block (Return (Bool no)))))))) (FunctionDef (Var "main") (args) (Block (Declare (Var "alice") nil (RecordLiteral (Var "Person") (Text "Alice") (Int "30"))) (DebugLog (FieldAccess (Var "alice") "age")) (DebugLog (MethodCall (RecordLiteral (FieldAccess (Var "Shape") "Circle") (Num "1.0")) "is_point")))))
|