Annotation of parser3/src/include/pa_opcode.h, revision 1.9
1.1 paf 1: /** @file
2: Parser: compiled code related decls.
3:
4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
5:
1.8 paf 6: Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)
1.1 paf 7:
1.9 ! paf 8: $Id: pa_opcode.h,v 1.8 2001/11/05 11:46:24 paf Exp $
1.1 paf 9: */
10:
11: #ifndef CODE_H
12: #define CODE_H
13:
14: #include "pa_string.h"
15: #include "pa_array.h"
16:
17: class Value;
18: class Array;
19:
20: /// Compiled operation code
21: enum OPCODE {
22: //@{
23: /// @name literals
24: OP_VALUE, OP_CURLY_CODE__STORE_PARAM, OP_EXPR_CODE__STORE_PARAM,
25: //@}
26:
27: //@{
28: /// @name actions
1.6 parser 29: OP_WITH_ROOT, OP_WITH_SELF, OP_WITH_READ, OP_WITH_WRITE,
1.1 paf 30: OP_GET_CLASS,
1.3 parser 31: OP_CONSTRUCT_VALUE, OP_CONSTRUCT_EXPR, OP_CURLY_CODE__CONSTRUCT,
1.1 paf 32: OP_WRITE_VALUE, OP_WRITE_EXPR_RESULT, OP_STRING__WRITE,
33: OP_GET_ELEMENT, OP_GET_ELEMENT__WRITE,
34: OP_CREATE_EWPOOL, OP_REDUCE_EWPOOL,
35: OP_CREATE_SWPOOL, OP_REDUCE_SWPOOL,
36: OP_GET_METHOD_FRAME,
37: OP_STORE_PARAM,
1.5 parser 38: OP_PREPARE_TO_CONSTRUCT_OBJECT, OP_CALL,
1.1 paf 39: //@}
40:
41: //@{
42: /// @name expression ops: unary
43: OP_NEG, OP_INV, OP_NOT, OP_DEF, OP_IN, OP_FEXISTS, OP_DEXISTS,
44: //@}
45:
46: //@{
47: /// @name expression ops: binary
1.7 paf 48: OP_SUB, OP_ADD, OP_MUL, OP_DIV, OP_MOD, OP_INTDIV,
1.1 paf 49: OP_BIN_AND, OP_BIN_OR, OP_BIN_XOR,
50: OP_LOG_AND, OP_LOG_OR, OP_LOG_XOR,
51: OP_NUM_LT, OP_NUM_GT, OP_NUM_LE, OP_NUM_GE, OP_NUM_EQ, OP_NUM_NE,
52: OP_STR_LT, OP_STR_GT, OP_STR_LE, OP_STR_GE, OP_STR_EQ, OP_STR_NE,
53: OP_IS
54: //@}
55: };
56:
57: /**
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: */
68: union Operation {
69: void *cast; ///< casting helper
70:
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
74: };
75:
76: #endif
E-mail: