|
|
| version 1.20, 2002/08/01 11:41:15 | version 1.27, 2004/02/11 15:33:14 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: compiled code related decls. | Parser: compiled code related decls. |
| Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| #ifndef CODE_H | #ifndef OPCODE_H |
| #define CODE_H | #define OPCODE_H |
| static const char* IDENT_OPCODE_H="$Date$"; | static const char * const IDENT_OPCODE_H="$Date$"; |
| #include "pa_string.h" | |
| #include "pa_array.h" | |
| class Value; | |
| class Array; | |
| /// Compiled operation code | /// Compiled operation code |
| enum OPCODE { | enum OPCODE { |
| Line 46 enum OPCODE { | Line 40 enum OPCODE { |
| //@{ | //@{ |
| /// @name expression ops: binary | /// @name expression ops: binary |
| OP_SUB, OP_ADD, OP_MUL, OP_DIV, OP_MOD, OP_INTDIV, | OP_SUB, OP_ADD, OP_MUL, OP_DIV, OP_MOD, OP_INTDIV, |
| OP_BIN_SL, OP_BIN_SR, | |
| OP_BIN_AND, OP_BIN_OR, OP_BIN_XOR, | OP_BIN_AND, OP_BIN_OR, OP_BIN_XOR, |
| OP_LOG_AND, OP_LOG_OR, OP_LOG_XOR, | OP_LOG_AND, OP_LOG_OR, OP_LOG_XOR, |
| OP_NUM_LT, OP_NUM_GT, OP_NUM_LE, OP_NUM_GE, OP_NUM_EQ, OP_NUM_NE, | OP_NUM_LT, OP_NUM_GT, OP_NUM_LE, OP_NUM_GE, OP_NUM_EQ, OP_NUM_NE, |
| Line 54 enum OPCODE { | Line 49 enum OPCODE { |
| //@} | //@} |
| }; | }; |
| /** | |
| Parser source code got compiled into intermediate form of Operation-s, | |
| which is executed afterwards. | |
| It is compiled into Array of Operation-s. | |
| Each Operation can be either OPCODE or data pointer, | |
| following the literal-instruction. | |
| - OP_VALUE followed by Value* | |
| - OP_CURLY_CODE__STORE_PARAM followed by Array* | |
| - OP_EXPR_CODE__STORE_PARAM followed by Array* | |
| - OP_NESTED_CODE followed by Array* | |
| */ | |
| union Operation { | |
| void *cast; ///< casting helper | |
| OPCODE code; ///< operation code | |
| Value *value; ///< not an operation, but rather value stored after argumented op | |
| Array *array; ///< not an operation, but rather code array stored after argumented op | |
| }; | |
| #endif | #endif |