summaryrefslogtreecommitdiff
path: root/misc/pascal/pascal/ptdefs.h
blob: 7d3ce55c1b4a7f84b6faa088e04a44a08a48fdaf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/***********************************************************************
 * ptdefs.h
 * Token and Symbol Table Definitions
 *
 *   Copyright (C) 2008 Gregory Nutt. All rights reserved.
 *   Author: Gregory Nutt <gnutt@nuttx.org>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name NuttX nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 ***********************************************************************/

#ifndef __PTDEFS_H
#define __PTDEFS_H

/***********************************************************************/
/* Token Values 0-0x20 reserved for get_token identification */

#define tIDENT           0x01
#define tINT_CONST       0x02
#define tCHAR_CONST      0x03
#define tBOOLEAN_CONST   0x04
#define tREAL_CONST      0x05
#define tSTRING_CONST    0x06

#define tLE              0x07
#define tGE              0x08
#define tASSIGN          0x09
#define tSUBRANGE        0x0A

/* Token Values 0x21-0x2F (except 0x24) are for ASCII character tokens */

#define tNE              ('#')
#define SQUOTE           0x27
#define tMUL             ('*')
#define tFDIV            ('/')

/* Token Values 0x30-0x39 are spare */
/* Token Values 0x3A-0x40 are for ASCII character tokens */

#define tLT              ('<')
#define tEQ              ('=')
#define tGT              ('>')

/* Token Values 0x41-0x5A are SYMBOL TABLE definitions */

#define sPROC            0x41
#define sFUNC            0x42
#define sLABEL           0x43
#define sTYPE            0x44
#define sFILE            0x45
#define sINT             0x46
#define sBOOLEAN         0x47
#define sCHAR            0x48
#define sREAL            0x49
#define sTEXT            0x4a
#define sSTRING          0x4b /* String storage type */
#define sRSTRING         0x4c /* String reference type */
#define sSTRING_CONST    0x4d
#define sPOINTER         0x4e
#define sSCALAR          0x4f
#define sSCALAR_OBJECT   0x50
#define sSUBRANGE        0x51
#define sSET_OF          0x52
#define sARRAY           0x53
#define sRECORD          0x54
#define sRECORD_OBJECT   0x55
#define sFILE_OF         0x56
#define sVAR_PARM        0x57

/* Token Values 0x5B-0x60 (except 0x5F) are for ASCII character tokens */
/* Token Values 0x61-0x7a are SYMBOL TABLE definitions */

/* Token Values 0x7b-0x7f are for ASCII character tokens */
/* Token Value  0x7f is spare */

/* Token Values 0x80-0xef are for RESERVED WORDS */

/* Standard constants (TRUE, FALSE, MAXINT) and standard files (INPUT, OUTPUT) 
 * are hard initialized into the constant/symbol table and are transparent
 * to the compiler */

/* Reserved Words 0x80-0xaf*/

#define tAND             0x80
#define tARRAY           0x81
#define tBEGIN           0x82
#define tCASE            0x83
#define tCONST           0x84
#define tDIV             0x85
#define tDO              0x86
#define tDOWNTO          0x87
#define tELSE            0x88
#define tEND             0x89
#define tFILE            0x8a
#define tFOR             0x8b
#define tFUNCTION        0x8c
#define tGOTO            0x8d
#define tIF              0x8e
#define tIMPLEMENTATION 0x08f /* Extended pascal */
#define tIN              0x90
#define tINTERFACE       0x91 /* Extended pascal */
#define tLABEL           0x92
#define tMOD             0x93
#define tNIL             0x94
#define tNOT             0x95
#define tOF              0x96
#define tOR              0x97
#define tPACKED          0x98
#define tPROCEDURE       0x99
#define tPROGRAM         0x9a
#define tRECORD          0x9b
#define tREPEAT          0x9c
#define tSET             0x9d
#define tSHL             0x9e
#define tSHR             0x9f
#define tTHEN            0xa0
#define tTO              0xa1
#define tTYPE            0xa2
#define tUNIT            0xa3 /* Extended pascal */
#define tUNTIL           0xa4
#define tUSES            0xa5 /* Extended pascal */
#define tVAR             0xa6
#define tWHILE           0xa7
#define tWITH            0xa8

/* The following codes indicate that the token is a built-in procedure
 * or function recognized by the compiler.  An additional code will be
 * place in tknSubType by the tokenizer to indicate which built-in
 * procedure or function applies.
 */

#define tFUNC            0xb0
#define tPROC            0xb1

/***********************************************************************/
/* Codes to indentify built-in functions and procedures */

#define txNONE           0x00

/* Standard Functions 0x01-0x1f*/

#define txABS            0x01
#define txARCTAN         0x02
#define txCHR            0x03
#define txCOS            0x04
#define txEOF            0x05
#define txEOLN           0x06
#define txEXP            0x07
#define txLN             0x08
#define txODD            0x09
#define txORD            0x0a
#define txPRED           0x0b
#define txROUND          0x0c
#define txSIN            0x0d
#define txSQR            0x0e
#define txSQRT           0x0f
#define txSUCC           0x10
#define txTRUNC          0x11

/* "Less than standard" Functions 0x20-0x7f */

#define txGETENV         0x20

/* Standard Procedures 0x81-0xbf */

#define txGET            0x80
#define txNEW            0x81
#define txPACK           0x82
#define txPAGE           0x83
#define txPUT            0x84
#define txREAD           0x85
#define txREADLN         0x86
#define txRESET          0x87
#define txREWRITE        0x88
#define txUNPACK         0x89
#define txWRITE          0x8a
#define txWRITELN        0x8b

/* "Less than standard" Procedures 0xc0-0xff */

#define txVAL            0xc0

#endif /* __PTDEFS_H */