calls a grammar rule with the inputsymbols of a list....
Move to
Next Prev
Up Top
See also
expand_term/2
phrase/2
IF Computer > MINERVA > Manual > Reference > Predicates > Grammar rules > phrase/2

phrase/2

calls a grammar rule with the inputsymbols of a list.

phrase(+Term, +List)

phrase/2 calls a grammar rule Term with the inputsymbols listed in List.

Arguments

Term                   term
List                   list of symbols

Examples

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]).

Succeeds and prints "result = 4".

Standard

This predicate is not part of the ISO-Prolog Standard.

See also

expand_term/2.

read on...
MINERVA
ifcomputer logo
f
Expert Services on the Web
Language
English
Japanese
Server
USA
Japan
Site Access
Local Index
Local Contents
Site Contents
Site Index
Printer Friendly
For imode
For PDA
Search
document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/grammar_rules/phrase/home_en.html
published 2008/7/21 update 1997/6/22 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 info@ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
scroll to top managed with ubiCMS