美元 + mly 中的标识符
Dollar + identifier in mly
我在类型检查器的 .mly
中看到 $startpos
和 $endpos
:
recursive_def:
| f = term_variable
ty_args = multiple(formal_type_arguments)
te_args = multiple(term_arguments)
codomain = preceded(COLON,typ)
EQ t = loc(term)
{ let loc = ($startpos(ty_args), $endpos(t)) in
make_recursive_definition f loc ty_args te_args codomain t }
(* one should check that the right-hand side of a recursive definition
is a value, e.g. a function or a data constructor application; this
is not done for the moment. *)
...
pattern:
| d = data_constructor tvars = multiple(formal_type_arguments) LBRACE fields = semi(term_variable) RBRACE
{ SynPatData (($startpos, $endpos), d, tvars, fields) }
...
(* Recording locations. *)
loc(TERM):
| t = TERM
{ SynTeLoc (($startpos, $endpos), t) }
谁能告诉我$
+ identifier
是什么意思?它们是函数还是变量?他们的价值观是如何形成的?
这些是由menhir定义的内部符号。
$startpos start position of the first symbol in the
production’s right-hand side, if there is one;
end position of the most recently parsed symbol, otherwise
$endpos end position of the first symbol in the production’s
right-hand side, if there is one; end position of the
most recently parsed symbol, otherwise
$startpos($i | id) start position of the symbol named $i or id
$endpos($i | id) end position of the symbol named $i or id
我在类型检查器的 .mly
中看到 $startpos
和 $endpos
:
recursive_def:
| f = term_variable
ty_args = multiple(formal_type_arguments)
te_args = multiple(term_arguments)
codomain = preceded(COLON,typ)
EQ t = loc(term)
{ let loc = ($startpos(ty_args), $endpos(t)) in
make_recursive_definition f loc ty_args te_args codomain t }
(* one should check that the right-hand side of a recursive definition
is a value, e.g. a function or a data constructor application; this
is not done for the moment. *)
...
pattern:
| d = data_constructor tvars = multiple(formal_type_arguments) LBRACE fields = semi(term_variable) RBRACE
{ SynPatData (($startpos, $endpos), d, tvars, fields) }
...
(* Recording locations. *)
loc(TERM):
| t = TERM
{ SynTeLoc (($startpos, $endpos), t) }
谁能告诉我$
+ identifier
是什么意思?它们是函数还是变量?他们的价值观是如何形成的?
这些是由menhir定义的内部符号。
$startpos start position of the first symbol in the
production’s right-hand side, if there is one;
end position of the most recently parsed symbol, otherwise
$endpos end position of the first symbol in the production’s
right-hand side, if there is one; end position of the
most recently parsed symbol, otherwise
$startpos($i | id) start position of the symbol named $i or id
$endpos($i | id) end position of the symbol named $i or id