2 Commits da06fcc795 ... 49d0214234

Author SHA1 Message Date
  mizusato 49d0214234 fix syntax 2 years ago
  mizusato 0e09d67d86 adjust todos 2 years ago

+ 0 - 5
TODO

@@ -2,10 +2,6 @@ TODO
 
 ## Important
 
-type Tree[Leaf] record { data Map[TreeKey,TreeBranch[Leaf]] }  // for cs editing
-type TreeKey record { data String }
-type TreeBranch[Leaf] union { List[Tree[Leaf]] | Tree[Leaf] | Leaf }
-
 TYPE SYSTEM REFACTOR: (test/ref/ref.km)
 - no subtyping (thus no variance)
 - lift record type def to the same level as enum type def
@@ -15,7 +11,6 @@ TYPE SYSTEM REFACTOR: (test/ref/ref.km)
 - update vd go-struct related code (including EnumDummyInterfaceMethod)
 - implicit contexts integrated in arguments (thus have default values)
 type Unknown native
-type Error implements(Exception) native
 type Bool union { const No, Yes }  // no as zero
 type Maybe[T] union { T, None }
 type None record {}

+ 1 - 1
interpreter/lang/textual/ast/ast.go

@@ -65,7 +65,7 @@ var nodeRegistry = [...] interface{} {
 	PipeCast {},
 	PipeGet {},
 	PipeInterior {},
-	Infix {},
+	InfixTerm {},
 	Lambda {},
 	If {},
 	ElIf {},

+ 3 - 3
interpreter/lang/textual/ast/expr.go

@@ -76,9 +76,9 @@ type PipeInterior struct {
 }
 
 
-func (Infix) impl(Term) {}
-type Infix struct {
-	Node             `part:"infix"`
+func (InfixTerm) impl(Term) {}
+type InfixTerm struct {
+	Node             `part:"infix_term"`
 	Operator  Ref    `part:"operator.ref"`
 	Left      Expr   `part:"infix_left.expr"`
 	Right     Expr   `part:"infix_right.expr"`

+ 2 - 2
interpreter/lang/textual/ast/stmt.go

@@ -28,8 +28,8 @@ type DeclOperator struct {
 	Node                           `part:"decl_op"`
 	Docs       [] Doc              `list:"docs.doc+"`
 	Public     bool                `option:"public.@public"`
-	Infix      bool                `option:"op_kind.@infix"`
-	Variadic   bool                `option:"op_kind.@variadic"`
+	Infix      bool                `option:"infix.@infix"`
+	Variadic   bool                `option:"variadic.@variadic"`
 	Name       Identifier          `part:"name"`
 	Signature  OperatorSignature   `part:"sig"`
 	Body       VariousBody         `part:"body"`

+ 5 - 4
interpreter/lang/textual/syntax/definition.go

@@ -138,9 +138,10 @@ var __SyntaxDefinition = [...] string {
              "union_item_def_const = @const union_const_def+,! ",
                "union_const_def = docs name",
              "union_item_use_type = type",
-    "decl_op = docs public @operator op_kind name! sig! body!",
+    "decl_op = docs public @operator infix variadic name! sig! body!",
       "public? = @public",
-      "op_kind? = @infix | @variadic",
+      "infix? = @infix",
+      "variadic? = @variadic",
       "sig = type_params inputs! implicit output!",
         "inputs = record_def",
         "implicit? = inputs",
@@ -172,9 +173,9 @@ var __SyntaxDefinition = [...] string {
         "pipe_cast = . cast",
         "pipe_get = . name",
         "pipe_interior = . ( ref_base! )!",
-    "term = infix | lambda | if | when | block | ref_term " +
+    "term = infix_term | lambda | if | when | block | ref_term " +
         "| char | int | float | string ",
-      "infix = ( infix_left operator! infix_right! )!",
+      "infix_term = ( infix_left operator! infix_right! )!",
         "infix_left = expr",
         "operator = ref",
         "infix_right = expr",