Module Analyzer
Semantic analyzer
include Analyzer__.Breakdown
type b_arg=|BFreeLink of string自由リンクは文字列のまま扱う
|BLocalLink of int局所変数は全て一意な整数に変換される
リンク:アトムの引数部分に埋め込まれたアトムは全て分解され,アトムの引数はリンクのみとなる
type b_atom= string * b_arg listアトムはアトム名とリンクのリスト
type b_ind=|BLocalInd of int * b_atom局所リンクによって指されるアトム
|BFreeInd of string * b_atom自由リンクによって指されるアトム
|BRedir of string * string自由リンクのリダイレクト
type lhs= (int * int) list * b_ind list(local_indegs, b_ind list)
type free_indeg_diffs= (string * int) listルール左辺・右辺における自由リンクの入次数の差分
- ただし,indirection アトムからの参照数は数えないものとする
type rhs_graph= (int * b_atom) list * (string * b_atom) list * (string * string) list(local_inds, free_inds, redirs)
type rhs= (int * int) list * rhs_graph(local_indegs, rhs_graph)
type b_rule=|BRule of lhs * free_indeg_diffs * rhs
val breakdown_arg : (int * (int * int) list) -> Analyzer__.Alpha.a_arg -> (int * (int * int) list) * (b_arg * b_ind list)Breakdown argument atoms
val breakdown_args : (int * (int * int) list) -> Analyzer__.Alpha.a_arg list -> (int * (int * int) list) * (b_arg list * b_ind list)val breakdown_ind : (int * (int * int) list) -> Analyzer__.Alpha.a_atom -> (int * (int * int) list) * b_ind listBreakdown argument atoms on right hand side of indirection. Indirection from/to local link is not allowed (should be resolved in the former phase, which is not implemented) and raise an error
Redundant indirection.
val breakdown_inds : (int * (int * int) list) -> Analyzer__.Alpha.a_atom list -> (int * int) list * b_ind listBreakdown argument atoms on right hand side of indirections. Returns
(local_indegs, b_ind list). Takeslink_idwhich has returned from theAlpha.prep.
val check_rule : ((((('a * (string * 'b) list) * string list) * 'c) * 'd list) * (((('a * (string * 'b) list) * string list) * 'e) * 'f list)) -> unitBheck a rule whether meets the conditions
val classify_ind : b_ind -> (int * b_atom, string * b_atom, string * string) Util.either3インダイレクションを分類する
val partition_inds : b_ind list -> (int * b_atom) list * (string * b_atom) list * (string * string) listインダイレクションを分類に基づいて分割する
val free_indeg_diff_of : ('a * int) list -> ('a * int) -> 'a * intval free_indeg_diffs_of : ('a * int) list -> ('a * int) list -> ('a * int) listルール左辺・右辺における自由リンクの入次数の差分を求める
val breakdown : Parse.proc -> ((((int * int) list * (string * int) list) * string list) * b_ind list) * b_rule listAST を一本のリストにする
- リンク条件のチェックも行う
val breakdown_rule : (Parse.proc * Parse.proc) -> b_rule
val sem_graph_of : Parse.proc -> ((int * int) list * ((int * b_atom) list * (string * b_atom) list * (string * string) list)) * b_rule listsemantic analyzer
- returns
semantic graph obtained from the given AST