Mercurial > hg-old > index.cgi
view src/expr.h @ 13:05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
author | lost |
---|---|
date | Wed, 22 Oct 2008 04:51:16 +0000 |
parents | |
children | b28d7cb60779 |
line wrap: on
line source
/* expr.h Copyright © 2008 William Astle This file is part of LWASM. LWASM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* This file contains definitions associated with the expression evaluator used by LWASM. The core of the entire expression handler is the opaque type LWVAL, pointers to which are passed around to keep track of values. A value may be a simple integer or it could be a more complex expression linked by operators or it could be a polynomial expression. Simple integers are merely a degenerate case of polynomials. The package understands the following operations: addition subtraction multiplication division modulus parentheses unary negation unary "positive" bitwise and bitwise or bitwise not (1's complement) bitwise exclusive or Infix operators can be expressed as LWVAL <op> LWVAL. Thus, the order of operations is only relevant when initially parsing the expression. The order of evaluation is determined by what appears on either side of the <op> as an LWVAL may be an expression. */ typedef union lwval LWVAL; struct lwval_int { int lwval_type; // type of value int lwval_int_value; // integer value }; union lwval { struct lwval_int lwval_type_int; // integer type }; enum lwval_types { LWVAL_TYPE_INT }; #ifndef __expr_h_seen__ #define __expr_h_seen__ #endif //__expr_h_seen__