-
Notifications
You must be signed in to change notification settings - Fork 2
SystemOperators
#Introduction#
Operators are very important and powerful feature of Prolog and the Parser supports it. There is the predefined standard operator list which will be used for parsing and you should keep it in your mind. Details
There are three kinds of operators used by the parser:
- Meta-operators
- System operators
- Custom operators
#Meta-operators#
As meta-operators I mean special one-character operators (may be they are not operators in all prolog versions but it is useful to make them as operators to parse prolog files) (,),[,],|,.
#System operators#
The System operators are standard prolog operators which will be used for parsing and you can see their definition within the PrologParser? class, and now they are defined with below parameters (if describe them by the standard prolog way):
- :- op (1200, xfx, [':-','-->']).
- :- op (1200, fx, ['?-',':-']).
- :- op (1100, xfy, [';']).
- :- op (1050, xfy, ['->']).
- :- op (1000, xfy, [',']).
- :- op (900, fy, ['+']).
- :- op (700, xfx, ['=','=','==','==','@<','@=<','@>','@>=','=..','is','=:=','==','<','=<','>=']).
- :- op (500, yfx, ['+','-','/','/']).
- :- op (400, yfx, ['*','/','//','<<','>>','rem','mod']).
- :- op (200, xfx, ['**']).
- :- op (200, xfy, ['^']).
- :- op (200, fy, ['-','']).
#Custom operators#
The Custom operators are operators defined by a user and the parser asks for them through the ParserContext? interface which you should implement in your class and transfer to the parser before a parsing process. You can see examples at tests.