Source file src/cmd/compile/internal/contraire/cfg.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  // config defines the set of probabilities that Contraire will use while
     8  // generating an AST.
     9  type config struct {
    10  	ConstDeclMaxCount int // [1, N]
    11  	TypeDeclMaxCount  int // [1, N]
    12  
    13  	// Each group below must sum to 100.
    14  	PConstName int
    15  	PConstLtrl int
    16  
    17  	PTypeName int
    18  	PTypeLtrl int
    19  
    20  	PTypeBasic   int
    21  	PTypePointer int
    22  }
    23  
    24  // cfg is a reasonable default config.
    25  var cfg = &config{
    26  	ConstDeclMaxCount: 4,
    27  	TypeDeclMaxCount:  4,
    28  
    29  	PConstName: 50,
    30  	PConstLtrl: 50,
    31  
    32  	PTypeName: 50,
    33  	PTypeLtrl: 50,
    34  
    35  	PTypeBasic:   50,
    36  	PTypePointer: 50,
    37  }
    38  

View as plain text