• Keine Ergebnisse gefunden

Meta–Interpreter 1:

N/A
N/A
Protected

Academic year: 2021

Aktie "Meta–Interpreter 1:"

Copied!
4
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Meta–Interpreter 1:

prove(true) :- !.

prove((Goal1, Goal2)) :- !, prove(Goal1), prove(Goal2).

prove(Goal) :- clause(Goal, Body), prove(Body).

Meta–Interpreter 2:

prove(true) :- !.

prove((Goal1, Goal2)) :- !, prove(Goal2), prove(Goal1).

prove(Goal) :- clause(Goal, Body), prove(Body).

Meta–Interpreter 3:

prove(true,0) :- !.

prove((Goal1,Goal2),N) :- !, prove(Goal1,N1), prove(Goal2,N2), N is N1+N2.

prove(Goal,N) :- clause(Goal, Body), prove(Body,N1),

N is N1+1.

(2)

Klassisches append:

append([],Ys,Ys).

append([X|Xs],Ys,[X|Zs]) :- append(Xs,Ys,Zs).

app mit Differenzlisten:

app(Xs - Ys, Ys - Zs, Xs - Zs).

(3)

Beispielgrammatik G = (N, T, S, P )

• N = { Satz, Nominalphrase, Verbalphrase, Artikel, Nomen, Verb }

• T = { a, the, cat, mouse, scares, hates }

• S = Satz

• P besteht aus folgenden Regeln:

Satz → Nominalphrase Verbalphrase Nominalphrase → Artikel Nomen

Verbalphrase → Verb

Verbalphrase → Verb Nominalphrase Artikel → a

Artikel → the Nomen → cat Nomen → mouse

Verb → scares Verb → hates

L(G) enth¨alt: a cat scares the mouse, the mouse hates the cat,

L(G) enth¨alt: a mouse scares a mouse, a mouse hates

(4)

Beispielgrammatik in Prolog

satz --> nominalphrase, verbalphrase.

nominalphrase --> artikel, nomen.

verbalphrase --> verb.

verbalphrase --> verb, nominalphrase.

artikel --> [a].

artikel --> [the].

nomen --> [cat].

nomen --> [mouse].

verb --> [scares].

verb --> [hates].

Uberf¨ ¨ uhrung in Prolog–Klauseln

satz(S, R) :- nominalphrase(S, VP), verbalphrase(VP, R) nominalphrase(NP, R) :- artikel(NP, N), nomen(N, R).

verbalphrase(VP, R) :- verb(VP, R).

verbalphrase(VP, R) :- verb(VP, NP), nominalphrase(NP, R).

artikel([a | R], R).

artikel([the | R], R).

nomen([cat | R], R).

nomen([mouse | R], R).

verb([scares | R], R).

verb([hates | R], R).

Referenzen

ÄHNLICHE DOKUMENTE

negatively, (i~e. not requesting the features they allow,) will save many bytes of processor memory which will be returned to the user in the form of available

Die Figur kann auch als Rollen- oder Kugellager gedeutet werden. a) Wie schnell drehen sich die rosa Kreise um die eigene Achse? Im System Son- ne-Erde entspricht dies

• Wieviel Hilfe muss die Programmiererin und/oder die Verifiziererin geben ?.. John McCarthy, Stanford.. Robin Milner, Edinburgh.. Xavier Leroy, INRIA, Paris.. 4.2

If the keyword is the name of a region interpretation procedure (e.g. "cell"), then the text string is simultaneously declaring the region procedure to be used for

• Definiert für eine Sprache eine Repräsentation der Grammatik sowie einen.. Interpreter, der die Repräsentation nutzt, um Sätze in der Sprache zu

(These operators work independently of SUBMIT.) For fast execution of a one line, one parameter command file or a command file without parameters, the period (.)

BASIC PROGRAM, EXECUTION - Entering a RUN command, after a BASIC program has been entered into the microcomputer, will cause the current program to begin

The occupation number of a magnetically trapped Bose-Einstein condensate is limited for atoms with attractive interactions.. It has been predicted that, as this limit is approached,