OCaml 中多态变量类型的语法

syntax of polymorphic variable type in OCaml

我正在查看一个 OCaml 文件,我怀疑它应该是一个多态变量类型(我不了解 OCaml,所以可能非常不了解):

type loc = Loc.t
   and meta_bool =
    [ BTrue
    | BFalse
    | BAnt of string ]
   and rec_flag =
    [ ReRecursive
    | ReNil
    | ReAnt of string ]

但是,根据OCaml的语法

polymorphic-variant-type    
    ::=  [ [ | ] tag-spec  { | tag-spec } ]  
    ∣    [> [ tag-spec ]  { | tag-spec } ]  
    ∣    [< [ | ] tag-spec-full  { | tag-spec-full }  [ > { `tag-name }+ ] ] 

[]里面如果不使用反引号,就不能使用大写标识符。 tag-spec 不能是任何以大写开头的东西。

我查看的是正确的语法规则还是此文件中有其他内容?

在原来的OCaml具体语法中,必须有一个反引号。看起来您的示例使用的是 OCaml revised 语法。