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