Wild Life: parser.c File Reference

Wild Life 2.30

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Macros
Functions
parser.c File Reference

parser More...

Go to the source code of this file.

## Functions
int | bad_psi_term (ptr_psi_term t)
| bad_psi_term More...
void | show (long limit)
| show More...
void | push (psi_term tok, long prec, long op)
| push More...
long | pop (ptr_psi_term tok, long *op)
| pop More...
long | look ()
| look More...
long | precedence (psi_term tok, long typ)
| precedence More...
ptr_psi_term | stack_copy_psi_term (psi_term t)
| stack_copy_psi_term More...
ptr_psi_term | heap_copy_psi_term (psi_term t)
| heap_copy_psi_term More...
void | feature_insert (char *keystr, ptr_node *tree, ptr_psi_term psi)
| feature_insert More...
psi_term | list_nil (ptr_definition type)
| list_nil More...
psi_term | parse_list (ptr_definition typ, char e, char s)
| parse_list More...
psi_term | read_psi_term ()
| read_psi_term More...
psi_term | make_life_form (ptr_psi_term tok, ptr_psi_term arg1, ptr_psi_term arg2)
| make_life_form More...
void | crunch (long prec, long limit)
| crunch More...
psi_term | read_life_form (char ch1, char ch2)
| read_life_form More...
psi_term | parse (long *q)
| parse More...

## Detailed Description

parser

Definition in file parser.c.

## Function Documentation

int bad_psi_term | ( | ptr_psi_term | t | ) |

bad_psi_term

Parameters

  t | - ptr_psi_term t

BAD_PSI_TERM(t) This returns true if T is a psi_term which is not allowed to be considered as a constant by the parser.

Example: "A=)+6." would otherwise be parsed as: "=(A,+(')',6))", this was going a bit far.

Definition at line 31 of file parser.c.

References final_dot, final_question, wl_definition::keyword, wl_keyword::symbol, TRUE, and wl_psi_term::type.

32 {
33 char *s,c;
34 long r;
35
36 if(t->type==final_dot || t->type==final_question) /* RM: Jul 9 1993 */
37 return TRUE;
38
39 s=t->type->keyword->symbol;
40 c=s[0];
41 r=(s[1]==0 &&
42 (c=='(' ||
43 c==')' ||
44 c=='[' ||
45 c==']' ||
46 c=='{' ||
47 c=='}'
48 /* || c=='.' || c=='?' RM: Jul 7 1993 */
49 )
50 );
51
52 return r;
53 }
final_question
ptr_definition final_question
symbol in syntax module
Definition: def_glob.h:615
wl_definition::keyword
ptr_keyword keyword
Definition: def_struct.h:147
wl_keyword::symbol
char * symbol
Definition: def_struct.h:118
final_dot
ptr_definition final_dot
symbol in syntax module
Definition: def_glob.h:608
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181

void crunch | ( | long | prec,
|  | long | limit
| ) |  |

crunch

Parameters

  prec | - long prec
  limit | - long limit

CRUNCH(prec,limit) Crunch up = work out the arguments of anything on the stack whose precedence is <= PREC, and replace it with the corresponding psi-term. Do not go any further than LIMIT which is the end of the current expression.

Definition at line 662 of file parser.c.

References error_psi_term, FALSE, fx, look(), make_life_form(), nop, NULL, parse_ok, parser_stack_index, pop(), push(), xf, and xfx.

663 {
664 psi_term t,t1,t2,t3;
665 long op1,op2,op3;
666
667 if(parse_ok && prec>=look() && parser_stack_index>limit) {
668
669 (void)pop(&t1,&op1);
670
671 switch(op1) {
672
673 case nop:
674 (void)pop(&t2,&op2);
675 if(op2==fx)
676 t=make_life_form(&t2,&t1,NULL);
677 else
678 if(op2==xfx) {
679 (void)pop(&t3,&op3);
680 if(op3==nop)
681 t=make_life_form(&t2,&t3,&t1);
682 else {
683 printf("*** Parser: ooops, NOP expected.\n");
684 parse_ok=FALSE;
685 t= *error_psi_term;
686 }
687 }
688 break;
689
690 case xf:
691 (void)pop(&t2,&op2);
692 if(op2==nop)
693 t=make_life_form(&t1,&t2,NULL);
694 else {
695 printf("*** Parser: ugh, NOP expected.\n");
696 t= *error_psi_term;
697 parse_ok=FALSE;
698 }
699 break;
700
701 default:
702 printf("*** Parser: yuck, weirdo operator.\n");
703 }
704
705 push(t,look(),nop);
706
707 crunch(prec,limit);
708 }
709 }
xfx
#define xfx
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1021
fx
#define fx
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1000
wl_psi_term
Definition: def_struct.h:177
look
long look()
look
Definition: parser.c:163
push
void push(psi_term tok, long prec, long op)
push
Definition: parser.c:107
NULL
#define NULL
Definition: def_const.h:533
parse_ok
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
nop
#define nop
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:986
pop
long pop(ptr_psi_term tok, long *op)
pop
Definition: parser.c:132
crunch
void crunch(long prec, long limit)
crunch
Definition: parser.c:662
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
xf
#define xf
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:993
error_psi_term
ptr_psi_term error_psi_term
symbol in bi module
Definition: def_glob.h:118
make_life_form
psi_term make_life_form(ptr_psi_term tok, ptr_psi_term arg1, ptr_psi_term arg2)
make_life_form
Definition: parser.c:571
parser_stack_index
long parser_stack_index
index to parser stack
Definition: def_glob.h:164

void feature_insert | ( | char * | keystr,
|  | ptr_node * | tree,
|  | ptr_psi_term | psi
| ) |  |

feature_insert

Parameters

  keystr | - char *keystr
  tree | - ptr_node *tree
  psi | - ptr_psi_term psi

FEATURE_INSERT(keystr,tree,psi) Insert the psi_term psi into the attribute tree. If the feature already exists, create a call to the unification function.

Definition at line 251 of file parser.c.

References FEATCMP, find(), stack_copy_psi_term(), stack_insert_copystr(), and Syntaxerrorline().

252 {
253 ptr_node loc;
254 ptr_psi_term stk_psi;
255
256 // printf("before find in feature_insert feature=%s\n",keystr);
257 if ((loc=find(FEATCMP,keystr,*tree))) {
258 /* Give an error message if there is a duplicate feature: */
259 Syntaxerrorline("duplicate feature %s\n",keystr);
260 }
261 else {
262 /* If the feature does not exist, insert it. */
263 stk_psi=stack_copy_psi_term(*psi); // 19.8 */
264 stack_insert_copystr(keystr,tree,(GENERIC)stk_psi); /* 10.8 */
265 }
266 }
FEATCMP
#define FEATCMP
indicates to use featcmp for comparison (in trees.c)
Definition: def_const.h:979
wl_psi_term
Definition: def_struct.h:177
GENERIC
unsigned long * GENERIC
unsigned long *GENERIC
Definition: def_struct.h:35
Syntaxerrorline
void Syntaxerrorline(char *format,...)
Syntaxerrorline.
Definition: error.c:557
stack_copy_psi_term
ptr_psi_term stack_copy_psi_term(psi_term t)
stack_copy_psi_term
Definition: parser.c:205
find
ptr_node find(long comp, char *keystr, ptr_node tree)
find
Definition: trees.c:394
wl_node
Definition: def_struct.h:197
stack_insert_copystr
void stack_insert_copystr(char *keystr, ptr_node *tree, GENERIC info)
stack_insert_copystr
Definition: trees.c:301

ptr_psi_term heap_copy_psi_term | ( | psi_term | t | ) |

heap_copy_psi_term

Parameters

  t | - psi_term t

HEAP_COPY_PSI_TERM(tok) Return the address of a copy of TOK on the HEAP.

Definition at line 226 of file parser.c.

References global_time_stamp, and HEAP_ALLOC.

227 {
228 ptr_psi_term p;
229
230 p=HEAP_ALLOC(psi_term);
231 (*p)=t;
232 #ifdef TS
233 p->time_stamp=global_time_stamp; /* 9.6 */
234 #endif
235
236 return p;
237 }
wl_psi_term
Definition: def_struct.h:177
global_time_stamp
unsigned long global_time_stamp
Definition: login.c:28
HEAP_ALLOC
#define HEAP_ALLOC(A)
Definition: def_macro.h:20

psi_term list_nil | ( | ptr_definition | type | ) |

list_nil

Parameters

  type | - ptr_definition type

LIST_NIL(type) Returns the atom NIL to mark the end of a list.

Definition at line 278 of file parser.c.

References wl_psi_term::attr_list, wl_psi_term::coref, disj_nil, disjunction, FALSE, wl_psi_term::flags, nil, NULL, wl_psi_term::resid, wl_psi_term::status, wl_psi_term::type, and wl_psi_term::value_3.

279 {
280 psi_term nihil;
281
282 if(type==disjunction) /* RM: Feb 1 1993 */
283 nihil.type=disj_nil;
284 else
285 nihil.type=nil;
286
287 nihil.status=0;
288 nihil.flags=FALSE; /* 14.9 */
289 nihil.attr_list=NULL;
290 nihil.resid=NULL;
291 nihil.value_3=NULL;
292 nihil.coref=NULL;
293
294 return nihil;
295 }
disjunction
ptr_definition disjunction
symbol in bi module
Definition: def_glob.h:249
wl_psi_term::resid
ptr_residuation resid
Definition: def_struct.h:189
wl_psi_term
Definition: def_struct.h:177
NULL
#define NULL
Definition: def_const.h:533
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
nil
ptr_definition nil
symbol in bi module
Definition: def_glob.h:340
wl_psi_term::value_3
GENERIC value_3
Definition: def_struct.h:186
disj_nil
ptr_definition disj_nil
symbol in syntax module
Definition: def_glob.h:256
wl_psi_term::coref
ptr_psi_term coref
Definition: def_struct.h:188
wl_psi_term::status
long status
Definition: def_struct.h:182
wl_psi_term::flags
long flags
Definition: def_struct.h:185
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187

long look | ( |  | ) |

look

LOOK() This function returns the precedence of the stack top.

Definition at line 163 of file parser.c.

References int_stack, and parser_stack_index.

164 {
165 return int_stack[parser_stack_index];
166 }
parser_stack_index
long parser_stack_index
index to parser stack
Definition: def_glob.h:164
int_stack
long int_stack[PARSER_STACK_SIZE]
Definition: def_glob.h:959

psi_term make_life_form | ( | ptr_psi_term | tok,
|  | ptr_psi_term | arg1,
|  | ptr_psi_term | arg2
| ) |  |

make_life_form

Parameters

  tok | - ptr_psi_term tok
  arg1 | - ptr_psi_term arg1
  arg2 | - ptr_psi_term arg2

MAKE_LIFE_FORM(tok,arg1,arg2) This routine inserts ARG1 and ARG2 as the first and second attributes of psi_term TOK, thus creating the term TOK(1=>arg1,2=>arg2).

If TOK is ':' then a conjunction is created if necessary. Example: a:V:b:5:long => V: <a,b,5,int> (= conjunction list).

Definition at line 571 of file parser.c.

References wl_psi_term::attr_list, wl_psi_term::coref, deref_ptr, equ_tokch, error_psi_term, FEATCMP, heap_alloc(), integer, minus_symbol, NULL, one, push_psi_ptr_value(), REAL, real, wl_psi_term::resid, stack_copy_psi_term(), stack_insert(), Syntaxerrorline(), top, two, wl_psi_term::type, and wl_psi_term::value_3.

572 {
573 ptr_psi_term a1,a2;
574
575 deref_ptr(tok);
576 tok->attr_list=NULL;
577 tok->resid=NULL;
578
579 /* Here beginneth a terrible FIX,
580 I will have to rewrite the tokeniser and the parser to handle
581 POINTERS to psi-terms instead of PSI_TERMS !!!
582 */
583
584 a1=arg1;
585 a2=arg2;
586
587 if (a1)
588 deref_ptr(a1);
589 if (a2)
590 deref_ptr(a2);
591
592 /* End of extremely ugly fix. */
593
594 if (/* UNI FALSE */ equ_tokch((*tok),':') && arg1 && arg2) {
595
596 if (a1!=a2) {
597 if (a1->type==top &&
598 !a1->attr_list &&
599 !a1->resid) {
600 if (a1!=arg1)
601 /* push_ptr_value(psi_term_ptr,&(a1->coref)); 9.6 */
602 push_psi_ptr_value(a1,(GENERIC *)&(a1->coref));
603 a1->coref=stack_copy_psi_term(*arg2);
604 tok=arg1;
605 }
606 else
607 if(a2->type==top &&
608 !a2->attr_list &&
609 !a2->resid) {
610 if(a2!=arg2)
611 /* push_ptr_value(psi_term_ptr,&(a2->coref)); 9.6 */
612 push_psi_ptr_value(a2,(GENERIC *)&(a2->coref));
613 a2->coref=stack_copy_psi_term(*arg1);
614 tok=arg2;
615 }
616 else { /* RM: Feb 22 1993 Now reports an error */
617 Syntaxerrorline("':' occurs where '&' required (%E)\n");
618 *tok= *error_psi_term;
619 /* make_unify_pair(tok,arg1,arg2); Old code */
620 }
621 }
622 else
623 tok=arg1;
624 }
625 else {
626
627 /* RM: Jun 21 1993 */
628 /* And now for another nasty hack: reading negative numbers */
629 if(tok->type==minus_symbol &&
630 a1 &&
631 !a2 &&
632 a1->value_3 &&
633 (a1->type==integer || a1->type==real)) {
634
635 tok->type=a1->type;
636 tok->value_3=(GENERIC)heap_alloc(sizeof(REAL));
637 *(REAL *)tok->value_3 = - *(REAL *)a1->value_3;
638
639 return *tok;
640 }
641 /* End of other nasty hack */
642
643 (void)stack_insert(FEATCMP,one,&(tok->attr_list),(GENERIC)stack_copy_psi_term(*arg1));
644 if (arg2)
645 (void)stack_insert(FEATCMP,two,&(tok->attr_list),(GENERIC)stack_copy_psi_term(*arg2));
646 }
647
648 return *tok;
649 }
wl_psi_term::resid
ptr_residuation resid
Definition: def_struct.h:189
FEATCMP
#define FEATCMP
indicates to use featcmp for comparison (in trees.c)
Definition: def_const.h:979
integer
ptr_definition integer
symbol in bi module
Definition: def_glob.h:312
two
char * two
Definition: def_glob.h:892
push_psi_ptr_value
void push_psi_ptr_value(ptr_psi_term q, GENERIC *p)
push_psi_ptr_value
Definition: login.c:474
wl_psi_term
Definition: def_struct.h:177
NULL
#define NULL
Definition: def_const.h:533
REAL
#define REAL
Which C type to use to represent reals and integers in Wild_Life.
Definition: def_const.h:132
real
ptr_definition real
symbol in bi module
Definition: def_glob.h:375
GENERIC
unsigned long * GENERIC
unsigned long *GENERIC
Definition: def_struct.h:35
stack_insert
ptr_node stack_insert(long comp, char *keystr, ptr_node *tree, GENERIC info)
stack_insert
Definition: trees.c:337
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
Syntaxerrorline
void Syntaxerrorline(char *format,...)
Syntaxerrorline.
Definition: error.c:557
minus_symbol
ptr_definition minus_symbol
symbol in syntax module
Definition: def_glob.h:333
wl_psi_term::value_3
GENERIC value_3
Definition: def_struct.h:186
stack_copy_psi_term
ptr_psi_term stack_copy_psi_term(psi_term t)
stack_copy_psi_term
Definition: parser.c:205
wl_psi_term::coref
ptr_psi_term coref
Definition: def_struct.h:188
one
char * one
Definition: def_glob.h:891
error_psi_term
ptr_psi_term error_psi_term
symbol in bi module
Definition: def_glob.h:118
top
ptr_definition top
symbol in syntax module
Definition: def_glob.h:403
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187
heap_alloc
GENERIC heap_alloc(long s)
heap_alloc
Definition: memory.c:1616
equ_tokch
#define equ_tokch(A, B)
Definition: def_macro.h:71

psi_term parse | ( | long * | q | ) |

parse

Parameters

  q | - long *q

PARSE(is_it_a_clause) This returns one clause or query from the input stream. It also indicates the type psi-term read, that is whether it was a clause or a query in the IS_IT_A_CLAUSE variable. This is the top level of the parser.

The whole parser is, rather like the psi_termiser, not too well written. It handles psi_terms rather than pointers which causes a lot of messy code and is somewhat slower.

Definition at line 907 of file parser.c.

References eof, EOLN, ERROR, FACT, FALSE, final_dot, final_question, mark_nonstrict(), NULL, parse_ok, parser_stack_index, prompt, put_back_char(), QUERY, read_char(), read_life_form(), read_token(), saved_char, saved_psi_term, stringparse, Syntaxerrorline(), TRUE, and wl_psi_term::type.

908 {
909 psi_term s,t,u;
910 long c;
911
912 parser_stack_index=0;
913 parse_ok=TRUE;
914
915 /*s=read_life_form('.','?');*/
916 s=read_life_form(0,0);
917
918 if (parse_ok) {
919 if (s.type!=eof) {
920 read_token(&t);
921
922 /*
923 if (equ_tokch(t,'?'))
924 *q=QUERY;
925 else if (equ_tokch(t,'.'))
926 *q=FACT;
927 */
928
929 /* RM: Jul 7 1993 */
930 if (t.type==final_question)
931 {
932 *q=QUERY;
933 }
934 else if (t.type==final_dot)
935 {
936 *q=FACT;
937 }
938 else
939 {
940 if (stringparse) parse_ok=FALSE;
941 else {
942
943 /*
944 perr("*** Syntax error ");psi_term_error();perr(": ");
945 display_psi_stderr(&t);
946 perr(".\n");
947 */
948
949 /* RM: Feb 1 1993 */
950 Syntaxerrorline("'%P' (%E)\n",&t);
951
952 }
953 *q=ERROR;
954 }
955 }
956 }
957
958
959 if (!parse_ok) {
960
961 while (saved_psi_term!=NULL) read_token(&u);
962
963 prompt="error>";
964 while((c=read_char()) && c!=EOF && c!='.' && c!='?' && c!=EOLN) {}
965
966 *q=ERROR;
967 }
968 else if (saved_char)
969 do {
970 c=read_char();
971 if (c==EOLN)
972 c=0;
973 else if (c<0 || c>32) {
974 put_back_char(c);
975 c=0;
976 }
977 } while(c && c!=EOF);
978
979 /* Make sure arguments of nonstrict terms are marked quoted. */
980 if (parse_ok) mark_nonstrict(&s); /* 25.8 */
981
982 /* mark_eval(&s); 24.8 XXX */
983
984 /* Mark all the psi-terms corresponding to variables in the var_tree as */
985 /* quoted. This is needed for correct parsing of inputs; otherwise vars */
986 /* that occur in an increment of a query are marked to be evaluated again! */
987 /* mark_quote_tree(var_tree); 24.8 XXX */
988
989
990 return s;
991 }
put_back_char
void put_back_char(long c)
put_back_char
Definition: token.c:729
read_token
void read_token(ptr_psi_term tok)
read_token
Definition: token.c:1186
final_question
ptr_definition final_question
symbol in syntax module
Definition: def_glob.h:615
wl_psi_term
Definition: def_struct.h:177
FACT
#define FACT
Fact Kind of user input.
Definition: def_const.h:338
mark_nonstrict
void mark_nonstrict(ptr_psi_term t)
mark_nonstrict
Definition: copy.c:513
NULL
#define NULL
Definition: def_const.h:533
parse_ok
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
saved_char
long saved_char
Definition: def_glob.h:849
QUERY
#define QUERY
Query Kind of user input.
Definition: def_const.h:345
ERROR
#define ERROR
Error Kind of user input.
Definition: def_const.h:352
read_life_form
psi_term read_life_form(char ch1, char ch2)
read_life_form
Definition: parser.c:728
EOLN
#define EOLN
End of line.
Definition: def_const.h:309
final_dot
ptr_definition final_dot
symbol in syntax module
Definition: def_glob.h:608
Syntaxerrorline
void Syntaxerrorline(char *format,...)
Syntaxerrorline.
Definition: error.c:557
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
eof
ptr_definition eof
symbol in syntax module
Definition: def_glob.h:263
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
saved_psi_term
ptr_psi_term saved_psi_term
Definition: def_glob.h:851
prompt
char * prompt
Definition: def_glob.h:1018
read_char
long read_char()
read_char
Definition: token.c:680
parser_stack_index
long parser_stack_index
index to parser stack
Definition: def_glob.h:164
stringparse
long stringparse
Definition: def_glob.h:859
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181

psi_term parse_list | ( | ptr_definition | typ,
|  | char | e,
|  | char | s
| ) |  |

parse_list

Parameters

  typ | - ptr_definition typ
  e | - char e
  s | - char s

PARSE_LIST(type,end,separator)

This function provides a replacement for the function 'read_list'. It does not create the old (slightly more compact and a lot more complicated) list structure, but instead creates a generic psi-term with 2 features. The list is terminated by the atom 'nil'.

Example:

[a,b,c|d] -> cons(a,cons(b,cons(c,d))). [] -> nil {a;b;c} -> disj(a,disj(b,disj(c,{}))). {} -> {} = bottom

Example: TYP=disjunction, END="}", SEPARATOR=";" will read in disjunctions.

Example: TYP=list, END="]", SEPARATOR="," will read lists such as [1,2,a,b,c|d]

Definition at line 329 of file parser.c.

References wl_psi_term::attr_list, display_psi_stderr(), equ_tokc, equ_tokch, FALSE, FEATCMP, list_nil(), NULL, one, parse_ok, perr(), psi_term_error(), put_back_token(), read_life_form(), read_token(), stack_copy_psi_term(), stack_insert(), stringparse, two, and wl_psi_term::type.

330 {
331 ptr_psi_term car=NULL;
332 ptr_psi_term cdr=NULL;
333 psi_term result;
334 psi_term t;
335 char a;
336
337 result=list_nil(typ); /* RM: Feb 1 1993 */
338
339 if (parse_ok) {
340
341 /* Character used for building cons pairs */
342 a='|'; /* RM: Jan 11 1993 */
343
344
345 read_token(&t);
346
347 if(!equ_tokc(t,e)) {
348
349 /* Read the CAR of the list */
350 put_back_token(t);
351 car=stack_copy_psi_term(read_life_form(s,a));
352
353 /* Read the CDR of the list */
354 read_token(&t);
355 if(equ_tokch(t,s))
356 cdr=stack_copy_psi_term(parse_list(typ,e,s));
357 else if(equ_tokch(t,e))
358 cdr=stack_copy_psi_term(list_nil(typ));
359 else if(equ_tokch(t,'|')) {
360 cdr=stack_copy_psi_term(read_life_form(e,0));
361 read_token(&t);
362 if(!equ_tokch(t,e)) {
363 if (stringparse) parse_ok=FALSE;
364 else {
365 perr("*** Syntax error ");psi_term_error();
366 perr(": bad symbol for end of list '");
367 display_psi_stderr(&t);
368 perr("'.\n");
369 put_back_token(t);
370 }
371 }
372 }
373 else
374 if (stringparse) parse_ok=FALSE;
375 else {
376 perr("*** Syntax error ");psi_term_error();
377 perr(": bad symbol in list '");
378 display_psi_stderr(&t);
379 perr("'.\n");
380 put_back_token(t);
381 }
382
383 result.type=typ;
384 if(car)
385 (void)stack_insert(FEATCMP,one,&(result.attr_list),(GENERIC)car);
386 if(cdr)
387 (void)stack_insert(FEATCMP,two,&(result.attr_list),(GENERIC)cdr);
388 }
389 }
390
391 return result;
392 }
psi_term_error
void psi_term_error()
psi_term_error
Definition: token.c:761
FEATCMP
#define FEATCMP
indicates to use featcmp for comparison (in trees.c)
Definition: def_const.h:979
perr
void perr(char *str)
perr
Definition: error.c:763
equ_tokc
#define equ_tokc(A, B)
Definition: def_macro.h:76
read_token
void read_token(ptr_psi_term tok)
read_token
Definition: token.c:1186
two
char * two
Definition: def_glob.h:892
wl_psi_term
Definition: def_struct.h:177
NULL
#define NULL
Definition: def_const.h:533
parse_list
psi_term parse_list(ptr_definition typ, char e, char s)
parse_list
Definition: parser.c:329
parse_ok
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
display_psi_stderr
void display_psi_stderr(ptr_psi_term t)
display_psi_stderr
Definition: print.c:1550
put_back_token
void put_back_token(psi_term t)
put_back_token
Definition: token.c:746
GENERIC
unsigned long * GENERIC
unsigned long *GENERIC
Definition: def_struct.h:35
read_life_form
psi_term read_life_form(char ch1, char ch2)
read_life_form
Definition: parser.c:728
stack_insert
ptr_node stack_insert(long comp, char *keystr, ptr_node *tree, GENERIC info)
stack_insert
Definition: trees.c:337
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
stack_copy_psi_term
ptr_psi_term stack_copy_psi_term(psi_term t)
stack_copy_psi_term
Definition: parser.c:205
one
char * one
Definition: def_glob.h:891
list_nil
psi_term list_nil(ptr_definition type)
list_nil
Definition: parser.c:278
stringparse
long stringparse
Definition: def_glob.h:859
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187
equ_tokch
#define equ_tokch(A, B)
Definition: def_macro.h:71

long pop | ( | ptr_psi_term | tok,
|  | long * | op
| ) |  |

pop

Parameters

  tok | - ptr_psi_term tok
  op | - long *op

POP(psi_term,op); This function pops PSI_TERM and OP off the parser stack and returns its precedence.

Definition at line 132 of file parser.c.

References error_psi_term, FALSE, int_stack, parse_ok, parser_stack_index, and psi_term_stack.

133 {
134 long r=0;
135
136 if (parser_stack_index==0) {
137 /*
138 perr("*** Parser error ");
139 psi_term_error();
140 perr(": stack empty.\n");
141 */
142
143 (*tok)= *error_psi_term;
144 parse_ok=FALSE;
145 }
146 else {
147 (*tok)=psi_term_stack[parser_stack_index];
148 (*op)=op_stack[parser_stack_index];
149 r=int_stack[parser_stack_index];
150 parser_stack_index--;
151 }
152
153 return r;
154 }
parse_ok
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
error_psi_term
ptr_psi_term error_psi_term
symbol in bi module
Definition: def_glob.h:118
parser_stack_index
long parser_stack_index
index to parser stack
Definition: def_glob.h:164
int_stack
long int_stack[PARSER_STACK_SIZE]
Definition: def_glob.h:959
psi_term_stack
psi_term psi_term_stack[PARSER_STACK_SIZE]
Definition: def_glob.h:958

long precedence | ( | psi_term | tok,
|  | long | typ
| ) |  |

precedence

Parameters

  tok | - psi_term tok
  typ | - long typ

PRECEDENCE(tok,typ) This function returns the precedence of TOK if it is an operator of type TYP where TYP is FX XFX XF etc... Note that this allows both a binary and unary minus. The result is NOP if tok is not an operator.

Definition at line 180 of file parser.c.

References wl_operator_data::next, NOP, wl_definition::op_data, wl_operator_data::precedence, and wl_psi_term::type.

181 {
182 long r=NOP;
183 ptr_operator_data o;
184
185 o=tok.type->op_data;
186 while(o && r==NOP) {
187 if(typ==o->type)
188 r=o->precedence;
189 else
190 o=o->next;
191 }
192
193 return r;
194 }
wl_operator_data::precedence
long precedence
Definition: def_struct.h:75
wl_operator_data
Definition: def_struct.h:73
wl_operator_data::next
ptr_operator_data next
Definition: def_struct.h:76
NOP
#define NOP
returned by precedence if token is not an operator
Definition: def_const.h:1337
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_definition::op_data
ptr_operator_data op_data
Definition: def_struct.h:158

void push | ( | psi_term | tok,
|  | long | prec,
|  | long | op
| ) |  |

push

Parameters

  tok | - psi_term tok
  prec | - long prec
  op | - long op

PUSH(tok,prec,op) Push psi_term and precedence and operator onto parser stack.

Definition at line 107 of file parser.c.

References int_stack, parser_stack_index, PARSER_STACK_SIZE, perr(), psi_term_error(), and psi_term_stack.

108 {
109 if (parser_stack_index==PARSER_STACK_SIZE) {
110 perr("*** Parser error ");
111 psi_term_error();
112 perr(": stack full.\n");
113 }
114 else {
115 parser_stack_index++;
116 psi_term_stack[parser_stack_index]=tok;
117 int_stack[parser_stack_index]=prec;
118 op_stack[parser_stack_index]=op;
119 }
120 }
psi_term_error
void psi_term_error()
psi_term_error
Definition: token.c:761
perr
void perr(char *str)
perr
Definition: error.c:763
PARSER_STACK_SIZE
#define PARSER_STACK_SIZE
Maximum depth of the parser stack.
Definition: def_const.h:198
parser_stack_index
long parser_stack_index
index to parser stack
Definition: def_glob.h:164
int_stack
long int_stack[PARSER_STACK_SIZE]
Definition: def_glob.h:959
psi_term_stack
psi_term psi_term_stack[PARSER_STACK_SIZE]
Definition: def_glob.h:958

psi_term read_life_form | ( | char | ch1,
|  | char | ch2
| ) |  |

read_life_form

Parameters

  ch1 | - char ch1
  ch2 | - char ch2

READ_LIFE_FORM(str1,str2) This reads in one life-form from the input stream which finishes with the psi_term whose name is STR1 or STR2, typically if we're reading a list [A,4*5,b-4!] then STR1="," and STR2="|" . It would be incorrect if "," were taken as an operator.

This routine implements the two state expression parser as described in the implementation guide. It deals with all the various types of operators, precedence is dealt with by the CRUNCH function. Each time an opening parenthesis is encountered a new expression is started.

Definition at line 728 of file parser.c.

References wl_psi_term::attr_list, bad_psi_term(), crunch(), equ_tokc, equ_tokch, error_psi_term, FALSE, fx, fy, line_count, MAX_PRECEDENCE, nop, NOP, parse_ok, parser_stack_index, pop(), precedence(), push(), put_back_token(), read_psi_term(), read_token(), stringparse, Syntaxerrorline(), TRUE, xf, xfx, xfy, yf, and yfx.

729 {
730 psi_term t,t2;
731 long limit,pr_op,pr_1,pr_2,start=0;
732 long fin=FALSE;
733 long state=0;
734 long prec=0;
735
736 long op;
737
738 limit=parser_stack_index+1;
739
740 if (parse_ok)
741 do {
742 if (state)
743 read_token(&t);
744 else
745 t=read_psi_term();
746
747 if (!start)
748 start=line_count;
749
750 if (!fin)
751 if (state) {
752 if (equ_tokc(t,ch1) || equ_tokc(t,ch2)) {
753 fin=TRUE;
754 put_back_token(t);
755 }
756 else {
757 pr_op=precedence(t,xf);
758 pr_1=pr_op-1;
759
760 if(pr_op==NOP) {
761 pr_op=precedence(t,yf);
762 pr_1=pr_op;
763 }
764
765 if(pr_op==NOP) {
766
767 pr_op=precedence(t,xfx);
768 pr_1=pr_op-1;
769 pr_2=pr_op-1;
770
771 if(pr_op==NOP) {
772 pr_op=precedence(t,xfy);
773 pr_1=pr_op-1;
774 pr_2=pr_op;
775 }
776
777 if(pr_op==NOP) {
778 pr_op=precedence(t,yfx);
779 pr_1=pr_op;
780 pr_2=pr_op-1;
781 }
782
783 /* if(pr_op==NOP) {
784 pr_op=precedence(t,yfy);
785 pr_1=pr_op;
786 pr_2=pr_op-1;
787 }
788 */
789
790 if(pr_op==NOP) {
791 fin=TRUE;
792 put_back_token(t);
793 }
794 else
795 {
796 crunch(pr_1,limit);
797 push(t,pr_2,xfx);
798 prec=pr_2;
799 state=0;
800 }
801 }
802 else {
803 crunch(pr_1,limit);
804 push(t,pr_1,xf);
805 prec=pr_1;
806 }
807 }
808 }
809 else {
810
811 if(t.attr_list)
812 pr_op=NOP;
813 else {
814 pr_op=precedence(t,fx);
815 pr_2=pr_op-1;
816
817 if(pr_op==NOP) {
818 pr_op=precedence(t,fy);
819 pr_2=pr_op;
820 }
821 }
822
823 if(pr_op==NOP) {
824 if(equ_tokch(t,'(')) {
825 t2=read_life_form(')',0);
826 if(parse_ok) {
827 push(t2,prec,nop);
828 read_token(&t2);
829 if(!equ_tokch(t2,')')) {
830 if (stringparse) parse_ok=FALSE;
831 else {
832 /*
833 perr("*** Syntax error ");psi_term_error();
834 perr(": ')' missing.\n");
835 */
836
837 /* RM: Feb 1 1993 */
838 Syntaxerrorline("')' missing (%E)\n");
839
840 put_back_token(t2);
841 }
842 }
843 state=1;
844 }
845 }
846 else
847 if(bad_psi_term(&t)) {
848 put_back_token(t);
849 /* psi_term_error(); */
850 fin=TRUE;
851 }
852 else {
853 push(t,prec,nop);
854 state=1;
855 }
856 }
857 else {
858 push(t,pr_2,fx);
859 prec=pr_2;
860 }
861
862 }
863
864 } while (!fin && parse_ok);
865
866 if (state)
867 crunch(MAX_PRECEDENCE,limit);
868
869 if (parse_ok && parser_stack_index!=limit) {
870 if (stringparse) parse_ok=FALSE;
871 else {
872 /*
873 perr("*** Syntax error ");psi_term_error();
874 perr(": bad expression.\n");
875 */
876
877 /* RM: Feb 1 1993 */
878 Syntaxerrorline("bad expression (%E)\n");
879 }
880 }
881 else
882 (void)pop(&t,&op);
883
884 if (!parse_ok)
885 t= *error_psi_term;
886
887 parser_stack_index=limit-1;
888
889 return t;
890 }
yfx
#define yfx
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1037
equ_tokc
#define equ_tokc(A, B)
Definition: def_macro.h:76
read_token
void read_token(ptr_psi_term tok)
read_token
Definition: token.c:1186
xfx
#define xfx
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1021
fx
#define fx
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1000
NOP
#define NOP
returned by precedence if token is not an operator
Definition: def_const.h:1337
wl_psi_term
Definition: def_struct.h:177
push
void push(psi_term tok, long prec, long op)
push
Definition: parser.c:107
precedence
long precedence(psi_term tok, long typ)
precedence
Definition: parser.c:180
xfy
#define xfy
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1030
parse_ok
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
nop
#define nop
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:986
put_back_token
void put_back_token(psi_term t)
put_back_token
Definition: token.c:746
line_count
long line_count
Definition: def_glob.h:1015
read_life_form
psi_term read_life_form(char ch1, char ch2)
read_life_form
Definition: parser.c:728
Syntaxerrorline
void Syntaxerrorline(char *format,...)
Syntaxerrorline.
Definition: error.c:557
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
pop
long pop(ptr_psi_term tok, long *op)
pop
Definition: parser.c:132
crunch
void crunch(long prec, long limit)
crunch
Definition: parser.c:662
bad_psi_term
int bad_psi_term(ptr_psi_term t)
bad_psi_term
Definition: parser.c:31
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
xf
#define xf
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:993
yf
#define yf
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1007
error_psi_term
ptr_psi_term error_psi_term
symbol in bi module
Definition: def_glob.h:118
MAX_PRECEDENCE
#define MAX_PRECEDENCE
Maximum operator precedence.
Definition: def_const.h:205
parser_stack_index
long parser_stack_index
index to parser stack
Definition: def_glob.h:164
stringparse
long stringparse
Definition: def_glob.h:859
read_psi_term
psi_term read_psi_term()
read_psi_term
Definition: parser.c:421
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187
fy
#define fy
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1014
equ_tokch
#define equ_tokch(A, B)
Definition: def_macro.h:71

psi_term read_psi_term | ( |  | ) |

read_psi_term

READ_PSI_TERM() This reads in a complex object from the input stream, that is, a whole psi-term.

Examples:

[A,B,C]

{0;1;2+A}

<a,b,c> death(victim => V,murderer => M)

which(x,y,z)

A:g(f)

I have allowed mixing labelled with unlabelled attributes.

Example:

f(x=>A,B,y=>K,"hklk",D) is parsed as f(1=>B,2=>"hklk",3=>D,x=>A,y=>K).

Definition at line 421 of file parser.c.

References add_module1, add_module2, add_module3, alist, apply, wl_psi_term::attr_list, bad_psi_term(), wl_keyword::combined_name, wl_psi_term::coref, current_module, disjunction, eof, equ_tok, equ_tokch, equal_types, error_psi_term, FALSE, FEATCMP, feature_insert(), find(), functor, heap_copy_string(), integer, wl_definition::keyword, wl_module::module_name, NULL, parse_list(), parse_ok, wl_keyword::private_feature, put_back_token(), quoted_string, read_life_form(), read_token(), REAL, wl_psi_term::resid, stack_copy_psi_term(), stack_insert(), stack_psi_term(), stringparse, wl_keyword::symbol, Syntaxerrorline(), TRUE, two, wl_psi_term::type, wl_psi_term::value_3, variable, and wl_const_3.

422 {
423 psi_term t,t2,t3;
424 char s[10];
425 long count=0,f=TRUE,f2,v;
426 ptr_psi_term module;
427
428 if(parse_ok) {
429
430 read_token(&t);
431
432 if(equ_tokch(t,'['))
433 t=parse_list(alist,']',','); /*** RICHARD Nov_4 ***/
434 else
435 if(equ_tokch(t,'{'))
436 t=parse_list(disjunction,'}',';'); /*** RICHARD Nov_4 ***/
437
438 /* The syntax <a,b,c> for conjunctions has been abandoned.
439 else
440 if(equ_tokch(t,'<'))
441 t=parse_list(conjunction,'>',',');
442 */
443
444 if(parse_ok
445 && t.type!=eof
446 && !bad_psi_term(&t)
447 /* && (precedence(t,fx)==NOP)
448 && (precedence(t,fy)==NOP) */
449 ) {
450 read_token(&t2);
451 if(equ_tokch(t2,'(')) {
452
453 do {
454
455 f2=TRUE;
456 read_token(&t2);
457
458 if(wl_const_3(t2) && !bad_psi_term(&t2)) {
459 read_token(&t3);
460 if(equ_tok(t3,"=>")) {
461 t3=read_life_form(',',')');
462
463 if(t2.type->keyword->private_feature) /* RM: Mar 11 1993 */
464 feature_insert(t2.type->keyword->combined_name,
465 /* RM: Jan 13 1993 */
466 &(t.attr_list),
467 &t3);
468 else
469 feature_insert(t2.type->keyword->symbol,
470 /* RM: Jan 13 1993 */
471 &(t.attr_list),
472 &t3);
473
474 f2=FALSE;
475 }
476 else
477 put_back_token(t3);
478 }
479
480 if(parse_ok && equal_types(t2.type,integer)) {
481 read_token(&t3);
482 if(equ_tok(t3,"=>")) {
483 t3=read_life_form(',',')');
484 v= *(REAL *)t2.value_3;
485 (void)snprintf(s,10,"%ld",v);
486 feature_insert(s,&(t.attr_list),&t3);
487 f2=FALSE;
488 }
489 else
490 put_back_token(t3);
491 }
492
493 if(f2) {
494 put_back_token(t2);
495 t2=read_life_form(',',')');
496 ++count;
497 (void)snprintf(s,10,"%ld",count);
498 feature_insert(s,&(t.attr_list),&t2);
499 }
500
501 read_token(&t2);
502
503 if(equ_tokch(t2,')'))
504 f=FALSE;
505 else
506 if(!equ_tokch(t2,',')) {
507 if (stringparse) parse_ok=FALSE;
508 else {
509 /*
510 perr("*** Syntax error ");psi_term_error();
511 perr(": ',' expected in argument list.\n");
512 */
513
514 /* RM: Feb 1 1993 */
515 Syntaxerrorline("',' expected in argument list (%E)\n");
516
517 f=FALSE;
518 }
519 }
520
521 } while(f && parse_ok);
522 }
523 else
524 put_back_token(t2);
525 }
526 }
527 else
528 t= *error_psi_term;
529
530 if(t.type==variable && t.attr_list) {
531 t2=t;
532 t.type=apply;
533 t.value_3=NULL;
534 t.coref=NULL;
535 t.resid=NULL;
536 (void)stack_insert(FEATCMP,(char *)functor->keyword->symbol,
537 &(t.attr_list),
538 (GENERIC)stack_copy_psi_term(t2));
539 }
540
541
542 /* RM: Mar 12 1993 Nasty hack for Bruno's features in modules */
543 if((t.type==add_module1 || t.type==add_module2 || t.type==add_module3) &&
544 !find(FEATCMP,two,t.attr_list)) {
545
546 module=stack_psi_term(4);
547 module->type=quoted_string;
548 module->value_3=(GENERIC)heap_copy_string(current_module->module_name);
549
550 (void)stack_insert(FEATCMP,two,&(t.attr_list),(GENERIC)module);
551 }
552
553 return t;
554 }
disjunction
ptr_definition disjunction
symbol in bi module
Definition: def_glob.h:249
alist
ptr_definition alist
symbol in bi module
Definition: def_glob.h:319
wl_psi_term::resid
ptr_residuation resid
Definition: def_struct.h:189
FEATCMP
#define FEATCMP
indicates to use featcmp for comparison (in trees.c)
Definition: def_const.h:979
apply
ptr_definition apply
symbol in bi module
Definition: def_glob.h:178
read_token
void read_token(ptr_psi_term tok)
read_token
Definition: token.c:1186
integer
ptr_definition integer
symbol in bi module
Definition: def_glob.h:312
functor
ptr_definition functor
symbol in bi module
Definition: def_glob.h:298
wl_keyword::combined_name
char * combined_name
Definition: def_struct.h:119
current_module
ptr_module current_module
The current module for the tokenizer.
Definition: def_glob.h:729
two
char * two
Definition: def_glob.h:892
wl_psi_term
Definition: def_struct.h:177
wl_definition::keyword
ptr_keyword keyword
Definition: def_struct.h:147
NULL
#define NULL
Definition: def_const.h:533
add_module3
ptr_definition add_module3
symbol in bi module for feature_values
Definition: def_glob.h:157
add_module2
ptr_definition add_module2
symbol in bi module for str2psi
Definition: def_glob.h:150
REAL
#define REAL
Which C type to use to represent reals and integers in Wild_Life.
Definition: def_const.h:132
parse_list
psi_term parse_list(ptr_definition typ, char e, char s)
parse_list
Definition: parser.c:329
parse_ok
long parse_ok
indicates whether there was a syntax error
Definition: def_glob.h:765
wl_keyword::symbol
char * symbol
Definition: def_struct.h:118
put_back_token
void put_back_token(psi_term t)
put_back_token
Definition: token.c:746
GENERIC
unsigned long * GENERIC
unsigned long *GENERIC
Definition: def_struct.h:35
read_life_form
psi_term read_life_form(char ch1, char ch2)
read_life_form
Definition: parser.c:728
feature_insert
void feature_insert(char *keystr, ptr_node *tree, ptr_psi_term psi)
feature_insert
Definition: parser.c:251
variable
ptr_definition variable
symbol in bi module
Definition: def_glob.h:438
wl_const_3
#define wl_const_3(S)
Definition: def_macro.h:109
stack_insert
ptr_node stack_insert(long comp, char *keystr, ptr_node *tree, GENERIC info)
stack_insert
Definition: trees.c:337
heap_copy_string
char * heap_copy_string(char *s)
heap_copy_string
Definition: trees.c:172
Syntaxerrorline
void Syntaxerrorline(char *format,...)
Syntaxerrorline.
Definition: error.c:557
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
eof
ptr_definition eof
symbol in syntax module
Definition: def_glob.h:263
bad_psi_term
int bad_psi_term(ptr_psi_term t)
bad_psi_term
Definition: parser.c:31
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
add_module1
ptr_definition add_module1
symbol in bi module for features
Definition: def_glob.h:143
stack_psi_term
ptr_psi_term stack_psi_term(long stat)
stack_psi_term
Definition: lefun.c:21
wl_psi_term::value_3
GENERIC value_3
Definition: def_struct.h:186
stack_copy_psi_term
ptr_psi_term stack_copy_psi_term(psi_term t)
stack_copy_psi_term
Definition: parser.c:205
wl_module::module_name
char * module_name
Definition: def_struct.h:106
wl_psi_term::coref
ptr_psi_term coref
Definition: def_struct.h:188
equal_types
#define equal_types(A, B)
Definition: def_macro.h:111
find
ptr_node find(long comp, char *keystr, ptr_node tree)
find
Definition: trees.c:394
error_psi_term
ptr_psi_term error_psi_term
symbol in bi module
Definition: def_glob.h:118
wl_keyword::private_feature
int private_feature
Definition: def_struct.h:121
equ_tok
#define equ_tok(A, B)
Definition: def_macro.h:67
stringparse
long stringparse
Definition: def_glob.h:859
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187
quoted_string
ptr_definition quoted_string
symbol in bi module
Definition: def_glob.h:368
equ_tokch
#define equ_tokch(A, B)
Definition: def_macro.h:71

void show | ( | long | limit | ) |

show

Parameters

  limit | - long limit

SHOW(limit) This prints the parser's stack, for debugging purposes only, LIMIT marks the bottom of the current stack.

Definition at line 64 of file parser.c.

References display_psi_stdout(), fx, int_stack, nop, parser_stack_index, psi_term_stack, xf, and xfx.

65 {
66 long i;
67
68 for (i=1;i<=parser_stack_index;i++) {
69 if (i==limit)
70 printf("-> ");
71 else
72 printf(" ");
73 printf("%3ld: ",i);
74 switch (op_stack[i]) {
75 case fx:
76 printf("FX ");
77 break;
78 case xfx:
79 printf("XFX ");
80 break;
81 case xf:
82 printf("XF ");
83 break;
84 case nop:
85 printf("NOP ");
86 break;
87 default:
88 printf("??? ");
89 }
90 printf(" prec=%4ld ",int_stack[i]);
91 display_psi_stdout(&(psi_term_stack[i]));
92 printf("\n");
93 }
94 printf("\n");
95 }
xfx
#define xfx
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1021
fx
#define fx
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1000
display_psi_stdout
void display_psi_stdout(ptr_psi_term t)
display_psi_stdout
Definition: print.c:1536
nop
#define nop
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:986
xf
#define xf
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:993
parser_stack_index
long parser_stack_index
index to parser stack
Definition: def_glob.h:164
int_stack
long int_stack[PARSER_STACK_SIZE]
Definition: def_glob.h:959
psi_term_stack
psi_term psi_term_stack[PARSER_STACK_SIZE]
Definition: def_glob.h:958

ptr_psi_term stack_copy_psi_term | ( | psi_term | t | ) |

stack_copy_psi_term

Parameters

  t | - psi_term t

STACK_COPY_PSI_TERM(tok) Return the address of a copy of TOK on the STACK. All psi_terms read in by the parser are read into the stack.

Definition at line 205 of file parser.c.

References global_time_stamp, and STACK_ALLOC.

206 {
207 ptr_psi_term p;
208
209 p=STACK_ALLOC(psi_term);
210 (*p)=t;
211 #ifdef TS
212 p->time_stamp=global_time_stamp; /* 9.6 */
213 #endif
214
215 return p;
216 }
wl_psi_term
Definition: def_struct.h:177
STACK_ALLOC
#define STACK_ALLOC(A)
Definition: def_macro.h:21
global_time_stamp
unsigned long global_time_stamp
Definition: login.c:28