/**
*
* dpANSI KIF grammar
* for pattern matcher.
*
* This is grammar file of:
* patterns for
* Knowledge Interchange Format
* draft proposed American National Standard
* (dpANS KIF)
* NCITS.T2/98-004
*
* This file is a KIF parser source file for SableCC
* (Sable Compiler Compiler by Etienne Gagnon).
*
* Copyright (C) 1998-2001 Mariusz Nowostawski and others.
* All rights reserved. (see doc/LICENSE and doc/AUTHORS)
*
* Contact:
* e-mail: mariusz@rakiura.org
*
*/
Package nzdis.lang.kif.pattern;
Helpers
tab = 9;
cr = 13;
lf = 10;
eol = cr lf | cr | lf |;
white = (' ' | tab | eol)+ ;
upper = ['A'..'Z'];
lower = ['a'..'z'];
digit = ['0'..'9'];
alpha = [
[
[['!' + '$'] + ['%' + '&']]
+
[['*' + '+'] + ['-' + '.']]
]
+
[
[['/' + '<'] + ['@' + '?']]
+
[['>' + '='] + ['_' + '~']]
]
];
special = [[[['"' + '#'] + ['(' + ')']] + [[',' + '\'] + ['^' + '`']]] + '''] ;
normal = [[upper + lower] + [digit + alpha]] ;
word = (normal | '\' [[0 .. 0xffff] - [[10 + 13] + [9 + ' ']]] )+;
l_par = '(';
r_par = ')';
r_ap = ''';
u_arrow = '^';
eq = '=';
ineq = '/=';
at = '@';
q_mark = '?';
col_eq = ':=';
quote = 'qoute';
defobject = 'defobject';
deffunction = 'deffunction';
defrelation = 'defrelation';
deflogical = 'deflogical';
not = 'not';
and = 'and';
or = 'or';
dbl_r_arrow = '=>';
dbl_l_arrow = '<=';
arrow_dbl_arrow = '<=>';
if = 'if';
cond = 'cond';
value = 'value';
listof = 'listof';
holds = 'holds';
forall = 'forall';
exists = 'exists';
col_dbl_r_arrow = ':=>';
col_dbl_l_arrow = ':<=';
col_r_arrow = ':->';
Tokens
line_comment = '/' '/' [[0 .. 0xffff] - [cr + lf]]* eol |
';' [[0 .. 0xffff] - [cr + lf]]* eol ;
multiline_comment = '/' '*' [[0 .. 0xffff] - ['*' + '/']]* '*' '/' ;
string = '"' ([[0 .. 0xffff] - ['"' + '\']] | '\'[0 .. 0xffff])+ '"';
charref = '#' '\' [0 .. 0xffff];
l_par = l_par;
r_par = r_par;
r_ap = r_ap;
u_arrow = u_arrow;
eq = eq;
ineq = ineq;
at = at;
q_mark = q_mark;
col_eq = col_eq;
quote = quote;
defobject = defobject;
deffunction = deffunction;
defrelation = defrelation;
deflogical = deflogical;
not = not;
and = and;
or = or;
dbl_r_arrow = dbl_r_arrow;
dbl_l_arrow = dbl_l_arrow;
arrow_dbl_arrow = arrow_dbl_arrow;
col_dbl_r_arrow = col_dbl_r_arrow;
col_dbl_l_arrow = col_dbl_l_arrow;
col_r_arrow = col_r_arrow;
if = if;
cond = cond;
value = value;
listof = listof;
holds = holds;
forall = forall;
exists = exists;
t_seqvar = '@' word ;
t_indvar = '?' word ;
ref_seqvar = ',@' word ;
ref_indvar = ',?' word ;
p_var = ':' word ;
p_list = '::' word ;
word = word;
white = white;
Ignored Tokens
white, line_comment, multiline_comment;
Productions
query = term ;
term = {constant} constant |
{p_var} p_var |
{expression} expression ;
expression = l_par [left]:term* list? r_par ;
list = p_list term* ;
constant = {indvar} indvar |
{seqvar} seqvar |
{word} word |
{string} string |
{charref} charref |
{seqvar_ref} ref_seqvar |
{indvar_ref} ref_indvar |
{defined} defined ;
indvar = t_indvar;
seqvar = t_seqvar;
defined = {r_ap} r_ap |
{u_arrow} u_arrow |
{eq} eq |
{ineq} ineq |
{at} at |
{q_mark} q_mark |
{col_eq} col_eq |
{quote} quote |
{defobject} defobject |
{deffunction} deffunction |
{defrelation} defrelation |
{deflogical} deflogical |
{not} not |
{and} and |
{or} or |
{dbl_r_arrow} dbl_r_arrow |
{dbl_l_arrow} dbl_l_arrow |
{arrow_dbl_arrow} arrow_dbl_arrow |
{col_dbl_r_arrow} col_dbl_r_arrow |
{col_dbl_l_arrow} col_dbl_l_arrow |
{col_r_arrow} col_r_arrow |
{if} if |
{cond} cond |
{value} value |
{listof} listof |
{holds} holds |
{forall} forall |
{exists} exists ;
/* *********** end of file *********** */
This site has been last updated by the web master
on 2007/6/24.