Source file src/cmd/compile/internal/contraire/ast.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package contraire
     6  
     7  type prog struct{ decls []decl }
     8  
     9  // ============================== Decls ===============================
    10  
    11  type decl interface{ decl() }
    12  
    13  type constDecl struct {
    14  	name string
    15  	expr constExpr
    16  }
    17  
    18  type typeDecl struct {
    19  	name string
    20  	expr typeExpr
    21  }
    22  
    23  func (*constDecl) decl() {}
    24  func (*typeDecl) decl()  {}
    25  
    26  // ============================== Consts ==============================
    27  
    28  type constExpr interface{ constExpr() }
    29  
    30  type constName struct{ name string }
    31  type constLtrl struct{}
    32  
    33  func (*constName) constExpr() {}
    34  func (*constLtrl) constExpr() {}
    35  
    36  // ============================== Types ===============================
    37  
    38  type typeExpr interface{ typeExpr() }
    39  
    40  type typeName struct{ name string }
    41  type typeBasic struct{}
    42  type typePointer struct{ expr typeExpr }
    43  
    44  func (*typeName) typeExpr()    {}
    45  func (*typeBasic) typeExpr()   {}
    46  func (*typePointer) typeExpr() {}
    47  

View as plain text