Annotation of parser3/src/include/code.h, revision 1.28
1.24 paf 1: /** @file
1.26 paf 2: Parser: compiled code related decls.
3:
1.19 paf 4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.26 paf 5:
1.20 paf 6: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.19 paf 7:
1.28 ! paf 8: $Id: code.h,v 1.27 2001/04/25 11:02:52 paf Exp $
1.1 paf 9: */
10:
11: #ifndef CODE_H
12: #define CODE_H
13:
1.2 paf 14: #include "pa_string.h"
15: #include "pa_array.h"
16:
1.24 paf 17: class Value;
18: class Array;
19:
20: /// Compiled operation code
1.1 paf 21: enum OPCODE {
1.28 ! paf 22: //@{ @name literals
1.23 paf 23: OP_VALUE, OP_CURLY_CODE__STORE_PARAM, OP_EXPR_CODE__STORE_PARAM,
1.24 paf 24: //@}
1.10 paf 25:
1.24 paf 26: //@{
1.28 ! paf 27: /// @name actions
1.8 paf 28: OP_WITH_SELF, OP_WITH_ROOT, OP_WITH_READ, OP_WITH_WRITE,
1.16 paf 29: OP_GET_CLASS,
1.17 paf 30: OP_CONSTRUCT_VALUE, OP_CONSTRUCT_EXPR,
1.22 paf 31: OP_WRITE_VALUE, OP_WRITE_EXPR_RESULT, OP_STRING__WRITE,
1.5 paf 32: OP_GET_ELEMENT, OP_GET_ELEMENT__WRITE,
1.1 paf 33: OP_CREATE_EWPOOL, OP_REDUCE_EWPOOL,
34: OP_CREATE_RWPOOL, OP_REDUCE_RWPOOL,
1.10 paf 35: OP_CREATE_SWPOOL, OP_REDUCE_SWPOOL,
1.1 paf 36: OP_GET_METHOD_FRAME,
37: OP_STORE_PARAM,
1.10 paf 38: OP_CALL,
1.24 paf 39: //@}
1.10 paf 40:
1.24 paf 41: //@{
1.28 ! paf 42: /// @name expression ops: unary
1.27 paf 43: OP_NEG, OP_INV, OP_NOT, OP_DEF, OP_IN, OP_FEXISTS, OP_DEXISTS,
1.24 paf 44: //@}
45:
46: //@{
1.28 ! paf 47: /// @name expression ops: binary
1.11 paf 48: OP_SUB, OP_ADD, OP_MUL, OP_DIV, OP_MOD,
1.14 paf 49: OP_BIN_AND, OP_BIN_OR, OP_BIN_XOR,
50: OP_LOG_AND, OP_LOG_OR, OP_LOG_XOR,
1.10 paf 51: OP_NUM_LT, OP_NUM_GT, OP_NUM_LE, OP_NUM_GE, OP_NUM_EQ, OP_NUM_NE,
1.21 paf 52: OP_STR_LT, OP_STR_GT, OP_STR_LE, OP_STR_GE, OP_STR_EQ, OP_STR_NE,
53: OP_IS
1.24 paf 54: //@}
1.11 paf 55: };
1.2 paf 56:
1.25 paf 57: /**
1.24 paf 58: Parser source code got compiled into intermediate form of Operation-s,
59: which is executed afterwards.
60:
61: It is compiled into Array of Operation-s.
62: Each Operation can be either OPCODE or data pointer,
63: following the literal-instruction.
64: - OP_VALUE followed by Value*
65: - OP_CURLY_CODE__STORE_PARAM followed by Array*
66: - OP_EXPR_CODE__STORE_PARAM followed by Array*
67: */
1.2 paf 68: union Operation {
1.24 paf 69: void *cast; ///< casting helper
1.2 paf 70:
1.24 paf 71: OPCODE code; ///< operation code
72: Value *value; ///< not an operation, but rather value stored after argumented op
73: Array *array; ///< not an operation, but rather code array stored after argumented op
1.1 paf 74: };
75:
76: #endif
E-mail: