home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************
-
- Turbo Prolog Toolbox
- (C) Copyright 1987 Borland International.
- ***********************************************************/
-
-
- /* remove the comments around the include directive below, in */
- /* order to run XPARS.SCA as a stand alone program. */
-
- /* include "xpars.dom" */
-
- domains
- ttok = t(tok,integer)
- tokl = ttok*
-
- predicates
- tokl(string,tokl)
- maketok(string,tok,string,string)
- str_tok(string,tok)
-
- clauses
- tokl(STR,[t(TOK,0)|TOKL]):-
- fronttoken(STR,STRTOK,STR1),!,
- maketok(STRTOK,TOK,STR1,STR2),
- tokl(STR2,TOKL).
- tokl(_,[]).
-
- str_tok("+",plus):-!.
- str_tok("-",minus):-!.
- str_tok("*",mult):-!.
- str_tok("/",div):-!.
- str_tok("^",power):-!.
-
- maketok(STR,TOK,S,S):-str_tok(STR,TOK),!.
- maketok(INTSTR,int(INTEGER),S,S):-str_int(INTSTR,INTEGER),!.
- maketok(STRING,id(STRING),S,S):-isname(STRING),!.
-