wfs-operator-experiment/HMKNF.g4

26 lines
503 B
Plaintext
Raw Normal View History

2023-01-11 14:04:22 -07:00
grammar HMKNF;
WS: [ \n\t\r]+ -> skip;
kb: (lrule | orule)*;
lrule: ((head body) | head | body) '.';
head: IDENTIFIER (',' IDENTIFIER)*;
body: ':-' (katom (',' katom)*)?;
orule: oformula '.';
oformula:
'(' oformula ')' # parenth
| oatom # literal
| oformula '->' oformula # imp
| oformula '|' oformula # disj
| oformula '&' oformula # conj;
katom: patom | natom;
oatom: patom | fatom;
patom: IDENTIFIER;
natom: 'not' IDENTIFIER;
fatom: '-' IDENTIFIER;
IDENTIFIER: [a-z][A-Za-z0-9]*;