Example #1
0
word	WordComm( word u, word w )
{
   word x;

   x = Commutator( u, w );

   Free( u );
   Free( w );
   return x;
}
Example #2
0
/*
**    Atom() reads an atom. Note that Atom() creates a generator by
**    calling GenNumber().
**
**    The defining rule for atoms is:
**
**    atom:            'generator' | '(' word ')' | commutator
*/
static node     *Atom(void) {

	node            *n = 0;

	if (Token == GEN) {
		n = GetNode(TGEN);
		n->cont.g = GenNumber(Gen, NOCREATE);
		if (n->cont.g == (gen)0) SyntaxError("Unkown generator");
		NextToken();
	} else if (Token == LPAREN) {
		NextToken();
		n = Word();
		if (Token != RPAREN)
			SyntaxError("Closing parenthesis expected");
		NextToken();
	} else if (Token == LBRACK) {
		n = Commutator();
	} else {
		SyntaxError("Generator, left parenthesis or commutator expected");
	}
	return n;
}