リストの入力記号で文法規則をコールする。...
移動
次へ 前へ
上へ 最上
参考
expand_term/2
phrase/2
イフコンピュータ > MINERVA > マニュアル > レファレンス > 述語 > 文法規則 > phrase/2

phrase/2

リストの入力記号で文法規則をコールする。

phrase(+項, +リスト)

phrase/2 は、リストにリストされた入力記号で文法規則 をコールする。

引数

項                   項
リスト               記号のリスト

polish(Stack, Result) --> 
     [X], {integer(X)}, polish([X|Stack], Result).
polish([Y,X|Stack], Result) --> 
     [(+)], {Z is X+Y}, polish([Z|Stack], Result).
polish([Y,X|Stack], Result) --> 
     [(-)], {Z is X-Y}, polish([Z|Stack], Result).
polish([Z], Z) --> 
     [].

main(X) :- phrase(polish([], Result), [2,3,(+),1,(-)]), println(['result = ', Result]).

成功して、"result = 4"を出す。

標準

この述語は、ISO-Prolog 標準には含まれない。

関連

expand_term/2.

続く..
MINERVA
ifcomputer logo
f
Expert Services on the Web
言語
English
Japanese
サーバー
USA
Japan
サイトマップ
索引
目次
全体目次
全体索引
印刷向き
imode
PDA
探索
document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/grammar_rules/phrase/home_jp.html
published 2008/7/7 update 1997/6/22 (c) 1996-2006 IF Computer Japan
IF Computer 〒113-0022 Tel 03-5814-3352 ifcj@ifcomputer.co.jp
Customer Support 東京都文京区千駄木5-28-2   http://www.ifcomputer.co.jp
冒頭へ managed with ubiCMS