wfs-operator-experiment/HMKNF.g4

25 lines
513 B
Plaintext
Raw Permalink 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:
2023-01-12 15:32:51 -07:00
'(' oformula ')' # parenth
| oatom # literal
| oformula (operator = ('|' | '&')) oformula # disjOrConj
| oformula '->' oformula # imp;
2023-01-11 14:04:22 -07:00
katom: patom | natom;
oatom: patom | fatom;
patom: IDENTIFIER;
natom: 'not' IDENTIFIER;
fatom: '-' IDENTIFIER;
2023-01-12 15:32:51 -07:00
IDENTIFIER: [a-z'][A-Za-z0-9']*;