.TypeExpr string TypeExpr maybe [ TypeExpr string ] TypeExpr map [ TypeExpr string, TypeExpr int ] Module arith { Use demo_lib { value } Type op_id { Sum { Constructor Plus Constructor Minus Constructor Star } } Type op_array { Product { Field 'ops' TypeExpr array [ TypeExpr op_id ] } } Type assign { Product { Field 'name' TypeExpr string Field 'flags' TypeExpr array [ TypeExpr string ] } } Type cflow { Sum { Constructor Break Constructor Continue Constructor Return { Field 'status' TypeExpr int } } } Type source_location { Product { Field 'path' TypeExpr string Field 'line' TypeExpr int Field 'col' TypeExpr int Field 'length' TypeExpr int } } Type word { Product { Field 'value' TypeExpr string } } Type bool_expr { Sum { Constructor Binary { Field 'left' TypeExpr word Field 'right' TypeExpr word } Constructor Unary { Field 'child' TypeExpr word } Constructor LogicalNot { Field 'b' TypeExpr bool_expr } Constructor LogicalBinary { Field 'op' TypeExpr op_id Field 'left' TypeExpr bool_expr Field 'right' TypeExpr bool_expr } } } Type Token { Product { Field 's' TypeExpr string Field 'b' TypeExpr bool } } Type cflow2 { Sum { Constructor Break Constructor Continue Constructor Return { Field 'status' TypeExpr int } } } Type other { Product { Field 't' TypeExpr Token } } Type maps { Product { Field 'ss' TypeExpr map [ TypeExpr string, TypeExpr string ] Field 'ib' TypeExpr map [ TypeExpr int, TypeExpr bool ] Field 'tokens' TypeExpr map [ TypeExpr string, TypeExpr Token ] } } Type flag_type { Sum { Constructor Bool Constructor Int Constructor Float Constructor Str Constructor Enum { Field 'alts' TypeExpr array [ TypeExpr string ] } } } Type SetToArg_ { Product { Field 'name' TypeExpr string Field 'flag_type' TypeExpr flag_type Field 'quit_parsing_flags' TypeExpr bool } } } Module arith { Use demo_lib { value } Type op_id { Sum { Constructor Plus Constructor Minus Constructor Star } } Type op_array { Product { Field 'ops' TypeExpr array [ TypeExpr op_id ] } } Type assign { Product { Field 'name' TypeExpr string Field 'flags' TypeExpr array [ TypeExpr string ] } } Type cflow { Sum { Constructor Break Constructor Continue Constructor Return { Field 'status' TypeExpr int } } } Type source_location { Product { Field 'path' TypeExpr string Field 'line' TypeExpr int Field 'col' TypeExpr int Field 'length' TypeExpr int } } Type word { Product { Field 'value' TypeExpr string } } Type bool_expr { Sum { Constructor Binary { Field 'left' TypeExpr word Field 'right' TypeExpr word } Constructor Unary { Field 'child' TypeExpr word } Constructor LogicalNot { Field 'b' TypeExpr bool_expr } Constructor LogicalBinary { Field 'op' TypeExpr op_id Field 'left' TypeExpr bool_expr Field 'right' TypeExpr bool_expr } } } Type Token { Product { Field 's' TypeExpr string Field 'b' TypeExpr bool } } Type cflow2 { Sum { Constructor Break Constructor Continue Constructor Return { Field 'status' TypeExpr int } } } Type other { Product { Field 't' TypeExpr Token } } Type maps { Product { Field 'ss' TypeExpr map [ TypeExpr string, TypeExpr string ] Field 'ib' TypeExpr map [ TypeExpr int, TypeExpr bool ] Field 'tokens' TypeExpr map [ TypeExpr string, TypeExpr ....... ---------------------------------------------------------------------- Ran 8 tests in 0.007s OK Token ] } } Type flag_type { Sum { Constructor Bool Constructor Int Constructor Float Constructor Str Constructor Enum { Field 'alts' TypeExpr array [ TypeExpr string ] } } } Type SetToArg_ { Product { Field 'name' TypeExpr string Field 'flag_type' TypeExpr flag_type Field 'quit_parsing_flags' TypeExpr bool } } } Module foo { Type point { Product { Field 'x' TypeExpr maybe [ TypeExpr int ] Field 'y' TypeExpr array [ TypeExpr int ] } } Type action { Sum { Constructor Foo Constructor Bar { Field 'z' TypeExpr point } } } Type foo { Product { Field 'span_ids' TypeExpr array [ TypeExpr int ] } } Type bar { Product { Field 'options' TypeExpr map [ TypeExpr string, TypeExpr int ] } } Type does_not_resolve { Product { Field 'zz' TypeExpr typo } } } Syntax error on line 1: Expected token Name, got ) Syntax error on line 1: Expected token LBracket, got foo Syntax error on line 1: Expected token Name, got [ Syntax error on line 1: Expected token Name, got ] Syntax error on line 1: Expected token Comma, got ] Syntax error on line 1: Expected token Name, got ] Module foo { Type point { Product { Field 'x' TypeExpr int Field 'y' TypeExpr int } } Type place { Sum { Constructor None Constructor Two { Field 'a' TypeExpr point Field 'b' TypeExpr point } } } Type options { Product { Field 'names' TypeExpr map [ TypeExpr string, TypeExpr int ] } } } Syntax error on line : Couldn't find type 'typo' Module shared_variant { Type prod_with_attrs { Product { Field 'a' TypeExpr string Field 'b' TypeExpr string (attributes) Field 'spid' TypeExpr int } } Type double_quoted { Product { Field 'left' TypeExpr int Field 'tokens' TypeExpr array [ TypeExpr string ] } } Type expr { Sum { Constructor Binary { Field 'left' TypeExpr expr Field 'right' TypeExpr expr } Constructor DoubleQuoted %double_quoted (attributes) Field 'left_spid' TypeExpr int Field 'right_spid' TypeExpr int } } Type word_part { Sum { Constructor Literal { Field 's' TypeExpr string } Constructor DoubleQuoted %double_quoted } } Type cflow { Sum { Constructor Break Constructor Continue Constructor Return { Field 'val' TypeExpr int } } } } (double_quoted left:5 tokens:[foo bar]) (expr.Binary left: (double_quoted left:5 tokens:[foo bar]) right: (double_quoted left:5 tokens:[foo bar]) )