prec.h

This source file is part of the SubC compiler, which is described in the book

Practical Compiler Construction.

You might prefer to download the compiler source code. It is in the public domain.

Operator Precedence

These are the precedence levels of all (non-short-circuit) binary operators. They are used in the expression parser and constant expression parser.

/*
 *	NMH's Simple C Compiler, 2011,2012
 *	Binary operator precedence
 */

static int Prec[] = {
	7, /* SLASH */
	7, /* STAR */
	7, /* MOD */
	6, /* PLUS */
	6, /* MINUS */
	5, /* LSHIFT */
	5, /* RSHIFT */
	4, /* GREATER */
	4, /* GTEQ */
	4, /* LESS */
	4, /* LTEQ */
	3, /* EQUAL */
	3, /* NOTEQ */
	2, /* AMPER */
	1, /* CARET */
	0, /* PIPE */
};

contact