Syntax

LA home
Computing
Logic
 Prolog
  Intro.
  Examples
  Syntax
  Interp.
  Syntax
<rule> ::= <atom> [ <=  <literals> ] .
<rules> ::= <rule> [ <rules> ]
<query> ::= ? <literals> .
<literal> ::= <atom> | not <atom>
<literals> ::= <literal> [ and <literals> ]
<atom> ::= <predicate_ident> [ ( <terms> ) ]
<term> ::= <ident> [ ( <terms> ) ] | <constant> | <Variable>
<terms> ::= <term> [ , <terms> ]
<Variable> ::= X | Child | P | GP | ...
<constant> ::= <ident> | 0 | 1 | ...
<predicate_ident> ::= <ident>
<ident> ::= f | even | successor | charles | ...
<Program> ::= <rules> <query>
-- Small Prolog Syntax --
Key:
lhs ::= rhs   -- lhs can be replaced by rhs, or lhs is rhs,
[ a ]   -- optional a,
a | b   -- either a or else b.
 
Alternatives:
?- for ?
:- for <=
for and
www #ad:

↑ © L. Allison, www.allisons.org/ll/   (or as otherwise indicated).
Created with "vi (Linux)",  charset=iso-8859-1,   fetched Friday, 29-Mar-2024 12:53:13 UTC.

Free: Linux, Ubuntu operating-sys, OpenOffice office-suite, The GIMP ~photoshop, Firefox web-browser, FlashBlock flash on/off.