author | mjsousa |
Tue, 20 May 2014 08:24:25 +0100 | |
changeset 891 | 58109ca87903 |
parent 876 | e2c4f6f4abe2 |
child 894 | 39086e324665 |
permissions | -rw-r--r-- |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1 |
/* |
264
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
2 |
* matiec - a compiler for the programming languages defined in IEC 61131-3 |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
3 |
* |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
4 |
* Copyright (C) 2003-2011 Mario de Sousa (msousa@fe.up.pt) |
279
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
278
diff
changeset
|
5 |
* Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant |
264
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
6 |
* |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
7 |
* This program is free software: you can redistribute it and/or modify |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
8 |
* it under the terms of the GNU General Public License as published by |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
9 |
* the Free Software Foundation, either version 3 of the License, or |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
10 |
* (at your option) any later version. |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
11 |
* |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
12 |
* This program is distributed in the hope that it will be useful, |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
15 |
* GNU General Public License for more details. |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
16 |
* |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
19 |
* |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
20 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
21 |
* This code is made available on the understanding that it will not be |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
22 |
* used in safety-critical situations without a full and competent review. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
23 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
24 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
25 |
/* |
264
6facabd9c2cd
Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
258
diff
changeset
|
26 |
* An IEC 61131-3 compiler. |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
27 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
28 |
* Based on the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
29 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
30 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
31 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
32 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
33 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
34 |
* Stage 2 |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
35 |
* ======= |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
36 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
37 |
* This file contains the syntax definition of the textual |
91 | 38 |
* languages IL and ST, as well as the textual version of SFC. |
39 |
* The syntax parser, comprising the 2nd stage of the overall |
|
40 |
* compiler, is generated by runing bison on this file. |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
41 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
42 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
43 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
44 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
45 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
46 |
/**********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
47 |
/**********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
48 |
/**********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
49 |
/**********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
50 |
/******* *******/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
51 |
/******* The following syntax does not have any conflicts. *******/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
52 |
/******* *******/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
53 |
/******* P L E A S E K E E P I T T H A T W A Y ! *******/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
54 |
/******* =================================================== *******/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
55 |
/******* *******/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
56 |
/**********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
57 |
/**********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
58 |
/**********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
59 |
/**********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
60 |
|
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
61 |
/* NOTE: the following file contains many rules used merely for detecting errors in |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
62 |
* the IEC source code being parsed. |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
63 |
* To remove all these rules, simply execute the command (first replace all '%' with '/'): |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
64 |
* $sed '\:%\* ERROR_CHECK_BEGIN \*%:,\:%\* ERROR_CHECK_END \*%: d' iec_bison.yy |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
65 |
* |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
66 |
* The above command had to be edited ('/' replaced by '%') so as not to include the C syntax that closes |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
67 |
* comments inside this comment! |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
68 |
* If you place the command in a shell script, be sure to remove the backslashes '\' before each asterisk '*' !! |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
69 |
*/ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
70 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
71 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
72 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
73 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
74 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
75 |
%{ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
76 |
#include <string.h> /* required for strdup() */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
77 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
78 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
79 |
/* declare the token parser generated by flex... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
80 |
int yylex(void); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
81 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
82 |
/* declare the error handler defined at the end of this file */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
83 |
void yyerror (const char *error_msg); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
84 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
85 |
/* produce a more verbose parsing error message */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
86 |
#define YYERROR_VERBOSE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
87 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
88 |
/* Include debuging code. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
89 |
* Printing of debug info must then be activated by setting |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
90 |
* the variable yydebug to 1. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
91 |
*/ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
92 |
#define YYDEBUG 0 |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
93 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
94 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
95 |
/* file with declaration of absyntax classes... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
96 |
#include "../absyntax/absyntax.hh" |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
97 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
98 |
/* file with declaration of token constants. Generated by bison! */ |
354
0f24db96b519
Fixing automake configuration to work properly with flex and bison.
Mario de Sousa <msousa@fe.up.pt>
parents:
350
diff
changeset
|
99 |
#include "iec_bison.h" |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
100 |
|
68 | 101 |
/* The interface through which bison and flex interact. */ |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
102 |
#include "stage1_2_priv.hh" |
748
ad4265253528
Start to change code like Mario suggestions.
Manuele Conti <conti.ma@alice.it>
parents:
747
diff
changeset
|
103 |
#include "create_enumtype_conversion_functions.hh" |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
104 |
|
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
105 |
#include "../absyntax_utils/add_en_eno_param_decl.hh" /* required for add_en_eno_param_decl_c */ |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
106 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
107 |
/* an ugly hack!! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
108 |
* We will probably not need it when we decide |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
109 |
* to cut down the abstract syntax down to size. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
110 |
* We keep it as it is until we get to write |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
111 |
* stages 3 and 4 of the compiler. Who knows, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
112 |
* we might just find out that we really do need |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
113 |
* the abstract syntax tree to stay as it is |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
114 |
* afterall! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
115 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
116 |
/* for each element <elem> in list_c * <list> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
117 |
* execute the code <code> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
118 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
119 |
#define FOR_EACH_ELEMENT(elem, list, code) { \ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
120 |
symbol_c *elem; \ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
121 |
for(int i = 0; i < list->n; i++) { \ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
122 |
elem = list->elements[i]; \ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
123 |
code; \ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
124 |
} \ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
125 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
126 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
127 |
|
68 | 128 |
|
129 |
/* Macros used to pass the line and column locations when |
|
130 |
* creating a new object for the abstract syntax tree. |
|
131 |
*/ |
|
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
132 |
#define locloc(foo) foo.first_line, foo.first_column, foo.first_file, foo.first_order, foo.last_line, foo.last_column, foo.last_file, foo.last_order |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
133 |
#define locf(foo) foo.first_line, foo.first_column, foo.first_file, foo.first_order |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
134 |
#define locl(foo) foo.last_line, foo.last_column, foo.last_file, foo.last_order |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
135 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
136 |
/* Redefine the default action to take for each rule, so that the filenames are correctly processed... */ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
137 |
# define YYLLOC_DEFAULT(Current, Rhs, N) \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
138 |
do \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
139 |
if (N) \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
140 |
{ \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
141 |
(Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
142 |
(Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
143 |
(Current).first_file = YYRHSLOC(Rhs, 1).first_file; \ |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
144 |
(Current).first_order = YYRHSLOC(Rhs, 1).first_order; \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
145 |
(Current).last_line = YYRHSLOC(Rhs, N).last_line; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
146 |
(Current).last_column = YYRHSLOC(Rhs, N).last_column; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
147 |
(Current).last_file = YYRHSLOC(Rhs, 1).last_file; \ |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
148 |
(Current).last_order = YYRHSLOC(Rhs, 1).last_order; \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
149 |
} \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
150 |
else \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
151 |
{ \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
152 |
(Current).first_line = (Current).last_line = \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
153 |
YYRHSLOC(Rhs, 0).last_line; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
154 |
(Current).first_column = (Current).last_column = \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
155 |
YYRHSLOC(Rhs, 0).last_column; \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
156 |
(Current).first_file = (Current).last_file = \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
157 |
YYRHSLOC(Rhs, 0).last_file; \ |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
158 |
(Current).first_order = (Current).last_order = \ |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
159 |
YYRHSLOC(Rhs, 0).last_order; \ |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
160 |
} \ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
161 |
while (0) |
68 | 162 |
|
163 |
||
596
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
584
diff
changeset
|
164 |
#include "../main.hh" // required for ERROR() and ERROR_MSG() macros. |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
165 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
166 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
167 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
168 |
/*************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
169 |
/* global variables... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
170 |
/*************************/ |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
171 |
/* NOTE: For some strange reason bison ver 2.3 is including these declarations |
354
0f24db96b519
Fixing automake configuration to work properly with flex and bison.
Mario de Sousa <msousa@fe.up.pt>
parents:
350
diff
changeset
|
172 |
* in the iec_bison.h file, which is in turn included by flex. |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
173 |
* We cannot therefore define any variables over here, but merely declare |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
174 |
* their existance (otherwise we get errors when linking the code, since we |
354
0f24db96b519
Fixing automake configuration to work properly with flex and bison.
Mario de Sousa <msousa@fe.up.pt>
parents:
350
diff
changeset
|
175 |
* would get a new variable defined each time iec_bison.h is included!). |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
176 |
* Even though the variables are declared 'extern' over here, they will in |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
177 |
* fact be defined towards the end of this same file (i.e. in the prologue) |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
178 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
179 |
|
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
180 |
|
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
181 |
/* NOTE: These variable are really parameters we would like the stage2__ function to pass |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
182 |
* to the yyparse() function. However, the yyparse() function is created automatically |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
183 |
* by bison, so we cannot add parameters to this function. The only other |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
184 |
* option is to use global variables! yuck! |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
185 |
*/ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
186 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
187 |
/* A global flag used to tell the parser if overloaded funtions should be allowed. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
188 |
* The IEC 61131-3 standard allows overloaded funtions in the standard library, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
189 |
* but disallows them in user code... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
190 |
*/ |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
191 |
extern bool allow_function_overloading; |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
192 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
193 |
/* A flag to tell the compiler whether to allow the declaration |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
194 |
* of extensible function (i.e. functions that may have a variable number of |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
195 |
* input parameters, such as AND(word#33, word#44, word#55, word#66). |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
196 |
* This is an extension to the standard syntax. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
197 |
* See comments below for details why we support this! |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
198 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
199 |
extern bool allow_extensible_function_parameters; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
200 |
|
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
201 |
/* A global flag used to tell the parser whether to include the full variable location |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
202 |
* when printing out error messages... |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
203 |
*/ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
204 |
extern bool full_token_loc; |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
205 |
|
746
c7219a37cc39
Add conversion functions option.
Manuele Conti <conti.ma@alice.it>
parents:
745
diff
changeset
|
206 |
/* A global flag used to tell the parser whether to generate conversion function |
c7219a37cc39
Add conversion functions option.
Manuele Conti <conti.ma@alice.it>
parents:
745
diff
changeset
|
207 |
* for enumerated data types. |
c7219a37cc39
Add conversion functions option.
Manuele Conti <conti.ma@alice.it>
parents:
745
diff
changeset
|
208 |
*/ |
c7219a37cc39
Add conversion functions option.
Manuele Conti <conti.ma@alice.it>
parents:
745
diff
changeset
|
209 |
extern bool conversion_functions_; |
c7219a37cc39
Add conversion functions option.
Manuele Conti <conti.ma@alice.it>
parents:
745
diff
changeset
|
210 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
211 |
/* A pointer to the root of the parsing tree that will be generated |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
212 |
* by bison. |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
213 |
*/ |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
214 |
extern symbol_c *tree_root; |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
215 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
216 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
217 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
218 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
219 |
/* forward declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
220 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
221 |
/* The functions declared here are defined at the end of this file... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
222 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
223 |
/* Convert an il_operator_c into an identifier_c */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
224 |
symbol_c *il_operator_c_2_identifier_c(symbol_c *il_operator); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
225 |
|
136 | 226 |
/* return if current token is a syntax element */ |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
227 |
/* ERROR_CHECK_BEGIN */ |
136 | 228 |
bool is_current_syntax_token(); |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
229 |
/* ERROR_CHECK_END */ |
136 | 230 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
231 |
/* print an error message */ |
136 | 232 |
void print_err_msg(int first_line, |
95 | 233 |
int first_column, |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
234 |
const char *first_filename, |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
235 |
long int first_order, |
95 | 236 |
int last_line, |
237 |
int last_column, |
|
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
238 |
const char *last_filename, |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
239 |
long int last_order, |
756
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
240 |
const char *additional_error_msg); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
241 |
%} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
242 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
243 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
244 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
245 |
|
20 | 246 |
// %glr-parser |
13 | 247 |
// %expect-rr 1 |
248 |
||
249 |
||
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
250 |
/* The following definitions need to be inside a '%code requires' |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
251 |
* so that they are also included in the header files. If this were not the case, |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
252 |
* YYLTYPE would be delcared as something in the iec.cc file, and another thing |
354
0f24db96b519
Fixing automake configuration to work properly with flex and bison.
Mario de Sousa <msousa@fe.up.pt>
parents:
350
diff
changeset
|
253 |
* (actually the default value of YYLTYPE) in the iec_bison.h heder file. |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
254 |
*/ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
255 |
%code requires { |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
256 |
/* define a new data type to store the locations, so we can also store |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
257 |
* the filename in which the token is expressed. |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
258 |
*/ |
354
0f24db96b519
Fixing automake configuration to work properly with flex and bison.
Mario de Sousa <msousa@fe.up.pt>
parents:
350
diff
changeset
|
259 |
/* NOTE: since this code will be placed in the iec_bison.h header file, |
0f24db96b519
Fixing automake configuration to work properly with flex and bison.
Mario de Sousa <msousa@fe.up.pt>
parents:
350
diff
changeset
|
260 |
* as well as the iec.cc file that also includes the iec_bison.h header file, |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
261 |
* declaring the typedef struct yyltype__local here would result in a |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
262 |
* compilation error when compiling iec.cc, as this struct would be |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
263 |
* declared twice. |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
264 |
* We therefore use the #if !defined YYLTYPE ... |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
265 |
* to make sure only the first declaration is parsed by the C++ compiler. |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
266 |
*/ |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
267 |
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED |
415 | 268 |
typedef struct YYLTYPE { |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
269 |
int first_line; |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
270 |
int first_column; |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
271 |
const char *first_file; |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
272 |
long int first_order; |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
273 |
int last_line; |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
274 |
int last_column; |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
275 |
const char *last_file; |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
276 |
long int last_order; |
415 | 277 |
} YYLTYPE; |
278 |
#define YYLTYPE_IS_DECLARED 1 |
|
823
c95f42f28b69
Declare that YYLSTYPE is not the default trivial datatype used by bison. (was causing compile errors in bison ver >= 2.7)
Mario de Sousa <msousa@fe.up.pt>
parents:
811
diff
changeset
|
279 |
#define YYLTYPE_IS_TRIVIAL 0 |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
280 |
#endif |
415 | 281 |
|
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
282 |
} |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
283 |
|
13 | 284 |
|
285 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
286 |
%union { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
287 |
symbol_c *leaf; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
288 |
list_c *list; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
289 |
char *ID; /* token value */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
290 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
291 |
|
68 | 292 |
/* |
293 |
TODO: DO we need to define a destructor do free |
|
294 |
memory when recovering from errors, or do the |
|
295 |
class destructors already handle this? |
|
296 |
Following is example on how to define |
|
297 |
detructors, using the syntax: |
|
298 |
%destructor { CODE } SYMBOLS |
|
299 |
%union |
|
300 |
{ |
|
301 |
char *string; |
|
302 |
} |
|
303 |
%token <string> STRING |
|
304 |
%type <string> string |
|
305 |
%destructor { free ($$); } STRING string |
|
306 |
*/ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
307 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
308 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
309 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
310 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
311 |
/*************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
312 |
/* Prelimenary helpful constructs... */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
313 |
/*************************************/ |
73 | 314 |
/* A token used to identify the very end of the input file |
315 |
* after all includes have already been processed. |
|
316 |
* |
|
317 |
* Flex automatically returns the token with value 0 |
|
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
318 |
* at the end of the file. We therefore specify here |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
319 |
* a token with that exact same value here, so we can use it |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
320 |
* to detect the very end of the input files. |
73 | 321 |
*/ |
322 |
%token END_OF_INPUT 0 |
|
323 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
324 |
/* A bogus token that, in principle, flex MUST NEVER generate */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
325 |
/* USE 1: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
326 |
* ====== |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
327 |
* This token is currently also being used as the default |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
328 |
* initialisation value of the token_id member in |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
329 |
* the symbol_c base class. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
330 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
331 |
* USE 2 |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
332 |
* ===== |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
333 |
* This token may also be used in the future to remove |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
334 |
* mysterious reduce/reduce conflicts due to the fact |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
335 |
* that our grammar may not be LALR(1) but merely LR(1). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
336 |
* This means that bison cannot handle it without some |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
337 |
* caoxing from ourselves. We will then need this token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
338 |
* to do the coaxing... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
339 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
340 |
%token BOGUS_TOKEN_ID |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
341 |
|
68 | 342 |
%type <leaf> start |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
343 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
344 |
%type <leaf> any_identifier |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
345 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
346 |
%token <ID> prev_declared_variable_name_token |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
347 |
%token <ID> prev_declared_direct_variable_token |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
348 |
%token <ID> prev_declared_fb_name_token |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
349 |
%type <leaf> prev_declared_variable_name |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
350 |
%type <leaf> prev_declared_direct_variable |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
351 |
%type <leaf> prev_declared_fb_name |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
352 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
353 |
%token <ID> prev_declared_simple_type_name_token |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
354 |
%token <ID> prev_declared_subrange_type_name_token |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
355 |
%token <ID> prev_declared_enumerated_type_name_token |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
356 |
%token <ID> prev_declared_array_type_name_token |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
357 |
%token <ID> prev_declared_structure_type_name_token |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
358 |
%token <ID> prev_declared_string_type_name_token |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
359 |
%token <ID> prev_declared_ref_type_name_token /* defined in IEC 61131-3 v3 */ |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
360 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
361 |
%type <leaf> prev_declared_simple_type_name |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
362 |
%type <leaf> prev_declared_subrange_type_name |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
363 |
%type <leaf> prev_declared_enumerated_type_name |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
364 |
%type <leaf> prev_declared_array_type_name |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
365 |
%type <leaf> prev_declared_structure_type_name |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
366 |
%type <leaf> prev_declared_string_type_name |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
367 |
%type <leaf> prev_declared_ref_type_name /* defined in IEC 61131-3 v3 */ |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
368 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
369 |
%token <ID> prev_declared_derived_function_name_token |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
370 |
%token <ID> prev_declared_derived_function_block_name_token |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
371 |
%token <ID> prev_declared_program_type_name_token |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
372 |
%type <leaf> prev_declared_derived_function_name |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
373 |
%type <leaf> prev_declared_derived_function_block_name |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
374 |
%type <leaf> prev_declared_program_type_name |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
375 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
376 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
377 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
378 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
379 |
/**********************************************************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
380 |
/* B XXX - Things that are missing from the standard, but should have been there! */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
381 |
/**********************************************************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
382 |
|
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
383 |
/* Pragmas that our compiler will accept. |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
384 |
* See the comment in iec.flex for why these pragmas exist. |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
385 |
*/ |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
386 |
%token disable_code_generation_pragma_token |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
387 |
%token enable_code_generation_pragma_token |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
388 |
%type <leaf> disable_code_generation_pragma |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
389 |
%type <leaf> enable_code_generation_pragma |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
390 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
391 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
392 |
/* All other pragmas that we do not support... */ |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
393 |
/* In most stage 4, the text inside the pragmas will simply be copied to the output file. |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
394 |
* This allows us to insert C code (if using stage 4 generating C code) |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
395 |
* inside/interningled with the IEC 61131-3 code! |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
396 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
397 |
%token <ID> pragma_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
398 |
%type <leaf> pragma |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
399 |
|
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
400 |
/* The joining of all previous pragmas, i.e. any possible pragma */ |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
401 |
%type <leaf> any_pragma |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
402 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
403 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
404 |
/* Where do these tokens belong?? They are missing from the standard! */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
405 |
/* NOTE: There are other tokens related to these 'EN' ENO', that are also |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
406 |
* missing from the standard. However, their location in the annex B is |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
407 |
* relatively obvious, so they have been inserted in what seems to us their |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
408 |
* correct place in order to ease understanding of the parser... |
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
409 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
410 |
* please read the comment above the definition of 'variable' in section B1.4 for details. |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
411 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
412 |
%token EN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
413 |
%token ENO |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
414 |
%type <leaf> en_identifier |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
415 |
%type <leaf> eno_identifier |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
416 |
|
873
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
417 |
/* Keyword in IEC 61131-3 v3 */ |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
418 |
%token REF |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
419 |
%token REF_TO |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
420 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
421 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
422 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
423 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
424 |
/* B 0 - Programming Model */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
425 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
426 |
%type <list> library |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
427 |
%type <leaf> library_element_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
428 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
429 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
430 |
/*******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
431 |
/* B 1.1 - Letters, digits and identifiers */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
432 |
/*******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
433 |
/* Done totally within flex... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
434 |
letter |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
435 |
digit |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
436 |
octal_digit |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
437 |
hex_digit |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
438 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
439 |
%token <ID> identifier_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
440 |
%type <leaf> identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
441 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
442 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
443 |
/* B 1.2 - Constants */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
444 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
445 |
%type <leaf> constant |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
446 |
%type <leaf> non_int_or_real_constant |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
447 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
448 |
/******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
449 |
/* B 1.2.1 - Numeric Literals */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
450 |
/******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
451 |
/* Done totally within flex... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
452 |
bit |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
453 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
454 |
%type <leaf> numeric_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
455 |
%type <leaf> integer_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
456 |
%type <leaf> signed_integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
457 |
%token <ID> integer_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
458 |
%type <leaf> integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
459 |
%token <ID> binary_integer_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
460 |
%type <leaf> binary_integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
461 |
%token <ID> octal_integer_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
462 |
%type <leaf> octal_integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
463 |
%token <ID> hex_integer_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
464 |
%type <leaf> hex_integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
465 |
%token <ID> real_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
466 |
%type <leaf> real |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
467 |
%type <leaf> signed_real |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
468 |
%type <leaf> real_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
469 |
// %type <leaf> exponent |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
470 |
%type <leaf> bit_string_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
471 |
%type <leaf> boolean_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
472 |
|
257 | 473 |
%token safeboolean_true_literal_token |
474 |
%token safeboolean_false_literal_token |
|
475 |
%token boolean_true_literal_token |
|
476 |
%token boolean_false_literal_token |
|
477 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
478 |
%token FALSE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
479 |
%token TRUE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
480 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
481 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
482 |
/*******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
483 |
/* B 1.2.2 - Character Strings */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
484 |
/*******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
485 |
%token <ID> single_byte_character_string_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
486 |
%token <ID> double_byte_character_string_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
487 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
488 |
%type <leaf> character_string |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
489 |
%type <leaf> single_byte_character_string |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
490 |
%type <leaf> double_byte_character_string |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
491 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
492 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
493 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
494 |
/* B 1.2.3 - Time Literals */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
495 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
496 |
%type <leaf> time_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
497 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
498 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
499 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
500 |
/* B 1.2.3.1 - Duration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
501 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
502 |
%type <leaf> duration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
503 |
%type <leaf> interval |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
504 |
%type <leaf> days |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
505 |
%type <leaf> fixed_point |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
506 |
%type <leaf> hours |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
507 |
%type <leaf> minutes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
508 |
%type <leaf> seconds |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
509 |
%type <leaf> milliseconds |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
510 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
511 |
%token <ID> fixed_point_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
512 |
%token <ID> fixed_point_d_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
513 |
%token <ID> integer_d_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
514 |
%token <ID> fixed_point_h_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
515 |
%token <ID> integer_h_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
516 |
%token <ID> fixed_point_m_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
517 |
%token <ID> integer_m_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
518 |
%token <ID> fixed_point_s_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
519 |
%token <ID> integer_s_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
520 |
%token <ID> fixed_point_ms_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
521 |
%token <ID> integer_ms_token |
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
522 |
%token <ID> end_interval_token |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
523 |
%token <ID> erroneous_interval_token |
257 | 524 |
// %token TIME |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
525 |
%token T_SHARP |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
526 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
527 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
528 |
/************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
529 |
/* B 1.2.3.2 - Time of day and Date */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
530 |
/************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
531 |
%type <leaf> time_of_day |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
532 |
%type <leaf> daytime |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
533 |
%type <leaf> day_hour |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
534 |
%type <leaf> day_minute |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
535 |
%type <leaf> day_second |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
536 |
%type <leaf> date |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
537 |
%type <leaf> date_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
538 |
%type <leaf> year |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
539 |
%type <leaf> month |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
540 |
%type <leaf> day |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
541 |
%type <leaf> date_and_time |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
542 |
|
257 | 543 |
// %token TIME_OF_DAY |
544 |
// %token DATE |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
545 |
%token D_SHARP |
257 | 546 |
// %token DATE_AND_TIME |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
547 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
548 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
549 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
550 |
/* B 1.3 - Data Types */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
551 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
552 |
/* Strangely, the following symbol does seem to be required! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
553 |
// %type <leaf> data_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
554 |
%type <leaf> non_generic_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
555 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
556 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
557 |
/***********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
558 |
/* B 1.3.1 - Elementary Data Types */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
559 |
/***********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
560 |
/* NOTES: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
561 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
562 |
* - To make the definition of bit_string_literal more |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
563 |
* concise, it is useful to use an extra non-terminal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
564 |
* symbol (i.e. a grouping or construct) that groups the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
565 |
* following elements (BYTE, WORD, DWORD, LWORD). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
566 |
* Note that the definition of bit_string_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
567 |
* (according to the spec) includes the above elements |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
568 |
* and an extra BOOL. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
569 |
* We could use an extra construct with the first four |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
570 |
* elements to be used solely in the definition of |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
571 |
* bit_string_literal, but with the objective of not |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
572 |
* having to replicate the actions (if we ever need |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
573 |
* to change them, they would need to be changed in both |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
574 |
* bit_string_type_name and the extra grouping), we |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
575 |
* have re-defined bit_string_type_name as only including |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
576 |
* the first four elements. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
577 |
* In order to have our parser implement the specification |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
578 |
* correctly we have augmented every occurence of |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
579 |
* bit_string_type_name in other rules with the BOOL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
580 |
* token. Since bit_string_type_name only appears in |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
581 |
* the rule for elementary_type_name, this does not |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
582 |
* seem to be a big concession to make! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
583 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
584 |
* - We have added a helper symbol to concentrate the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
585 |
* instantiation of STRING and WSTRING into a single |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
586 |
* location (elementary_string_type_name). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
587 |
* These two elements show up in several other rules, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
588 |
* but we want to create the equivalent abstract syntax |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
589 |
* in a single location of this file, in order to make |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
590 |
* possible future changes easier to edit... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
591 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
592 |
%type <leaf> elementary_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
593 |
%type <leaf> numeric_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
594 |
%type <leaf> integer_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
595 |
%type <leaf> signed_integer_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
596 |
%type <leaf> unsigned_integer_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
597 |
%type <leaf> real_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
598 |
%type <leaf> date_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
599 |
%type <leaf> bit_string_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
600 |
/* helper symbol to concentrate the instantiation |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
601 |
* of STRING and WSTRING into a single location |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
602 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
603 |
%type <leaf> elementary_string_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
604 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
605 |
%token BYTE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
606 |
%token WORD |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
607 |
%token DWORD |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
608 |
%token LWORD |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
609 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
610 |
%token LREAL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
611 |
%token REAL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
612 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
613 |
%token SINT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
614 |
%token INT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
615 |
%token DINT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
616 |
%token LINT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
617 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
618 |
%token USINT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
619 |
%token UINT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
620 |
%token UDINT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
621 |
%token ULINT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
622 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
623 |
%token WSTRING |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
624 |
%token STRING |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
625 |
%token BOOL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
626 |
|
257 | 627 |
%token TIME |
628 |
%token DATE |
|
629 |
%token DATE_AND_TIME |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
630 |
%token DT |
257 | 631 |
%token TIME_OF_DAY |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
632 |
%token TOD |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
633 |
|
257 | 634 |
/******************************************************/ |
635 |
/* Symbols defined in */ |
|
636 |
/* "Safety Software Technical Specification, */ |
|
637 |
/* Part 1: Concepts and Function Blocks, */ |
|
638 |
/* Version 1.0 – Official Release" */ |
|
639 |
/* by PLCopen - Technical Committee 5 - 2006-01-31 */ |
|
640 |
/******************************************************/ |
|
641 |
||
642 |
%token SAFEBYTE |
|
643 |
%token SAFEWORD |
|
644 |
%token SAFEDWORD |
|
645 |
%token SAFELWORD |
|
646 |
||
647 |
%token SAFELREAL |
|
648 |
%token SAFEREAL |
|
649 |
||
650 |
%token SAFESINT |
|
651 |
%token SAFEINT |
|
652 |
%token SAFEDINT |
|
653 |
%token SAFELINT |
|
654 |
||
655 |
%token SAFEUSINT |
|
656 |
%token SAFEUINT |
|
657 |
%token SAFEUDINT |
|
658 |
%token SAFEULINT |
|
659 |
||
660 |
%token SAFEWSTRING |
|
661 |
%token SAFESTRING |
|
662 |
%token SAFEBOOL |
|
663 |
||
664 |
%token SAFETIME |
|
665 |
%token SAFEDATE |
|
666 |
%token SAFEDATE_AND_TIME |
|
667 |
%token SAFEDT |
|
668 |
%token SAFETIME_OF_DAY |
|
669 |
%token SAFETOD |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
670 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
671 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
672 |
/* B 1.3.2 - Generic data types */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
673 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
674 |
/* Strangely, the following symbol does seem to be required! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
675 |
// %type <leaf> generic_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
676 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
677 |
/* The following tokens do not seem to be used either |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
678 |
* but we declare them so they become reserved words... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
679 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
680 |
%token ANY |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
681 |
%token ANY_DERIVED |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
682 |
%token ANY_ELEMENTARY |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
683 |
%token ANY_MAGNITUDE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
684 |
%token ANY_NUM |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
685 |
%token ANY_REAL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
686 |
%token ANY_INT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
687 |
%token ANY_BIT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
688 |
%token ANY_STRING |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
689 |
%token ANY_DATE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
690 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
691 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
692 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
693 |
/* B 1.3.3 - Derived data types */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
694 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
695 |
%type <leaf> derived_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
696 |
%type <leaf> single_element_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
697 |
// %type <leaf> simple_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
698 |
// %type <leaf> subrange_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
699 |
// %type <leaf> enumerated_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
700 |
// %type <leaf> array_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
701 |
// %type <leaf> structure_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
702 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
703 |
%type <leaf> data_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
704 |
/* helper symbol for data_type_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
705 |
%type <list> type_declaration_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
706 |
%type <leaf> type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
707 |
%type <leaf> single_element_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
708 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
709 |
%type <leaf> simple_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
710 |
%type <leaf> simple_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
711 |
%type <leaf> simple_specification |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
712 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
713 |
%type <leaf> subrange_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
714 |
%type <leaf> subrange_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
715 |
%type <leaf> subrange_specification |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
716 |
%type <leaf> subrange |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
717 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
718 |
%type <leaf> enumerated_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
719 |
%type <leaf> enumerated_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
720 |
%type <leaf> enumerated_specification |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
721 |
/* helper symbol for enumerated_value */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
722 |
%type <list> enumerated_value_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
723 |
%type <leaf> enumerated_value |
85 | 724 |
//%type <leaf> enumerated_value_without_identifier |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
725 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
726 |
%type <leaf> array_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
727 |
%type <leaf> array_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
728 |
%type <leaf> array_specification |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
729 |
/* helper symbol for array_specification */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
730 |
%type <list> array_subrange_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
731 |
%type <leaf> array_initialization |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
732 |
/* helper symbol for array_initialization */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
733 |
%type <list> array_initial_elements_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
734 |
%type <leaf> array_initial_elements |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
735 |
%type <leaf> array_initial_element |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
736 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
737 |
%type <leaf> structure_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
738 |
%type <leaf> structure_specification |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
739 |
%type <leaf> initialized_structure |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
740 |
%type <leaf> structure_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
741 |
/* helper symbol for structure_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
742 |
%type <list> structure_element_declaration_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
743 |
%type <leaf> structure_element_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
744 |
%type <leaf> structure_element_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
745 |
%type <leaf> structure_initialization |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
746 |
/* helper symbol for structure_initialization */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
747 |
%type <list> structure_element_initialization_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
748 |
%type <leaf> structure_element_initialization |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
749 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
750 |
//%type <leaf> string_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
751 |
%type <leaf> string_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
752 |
/* helper symbol for string_type_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
753 |
%type <leaf> string_type_declaration_size |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
754 |
/* helper symbol for string_type_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
755 |
%type <leaf> string_type_declaration_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
756 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
757 |
%token ASSIGN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
758 |
%token DOTDOT /* ".." */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
759 |
%token TYPE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
760 |
%token END_TYPE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
761 |
%token ARRAY |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
762 |
%token OF |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
763 |
%token STRUCT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
764 |
%token END_STRUCT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
765 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
766 |
|
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
767 |
%type <leaf> ref_spec /* defined in IEC 61131-3 v3 */ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
768 |
%type <leaf> ref_spec_init /* defined in IEC 61131-3 v3 */ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
769 |
%type <leaf> ref_type_decl /* defined in IEC 61131-3 v3 */ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
770 |
|
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
771 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
772 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
773 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
774 |
/* B 1.4 - Variables */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
775 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
776 |
%type <leaf> variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
777 |
%type <leaf> symbolic_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
778 |
/* helper symbol for prog_cnxn */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
779 |
%type <leaf> any_symbolic_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
780 |
%type <leaf> variable_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
781 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
782 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
783 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
784 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
785 |
/********************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
786 |
/* B.1.4.1 Directly Represented Variables */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
787 |
/********************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
788 |
/* Done totally within flex... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
789 |
location_prefix |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
790 |
size_prefix |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
791 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
792 |
%token <ID> direct_variable_token |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
793 |
//%type <leaf> direct_variable |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
794 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
795 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
796 |
/*************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
797 |
/* B.1.4.2 Multi-element Variables */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
798 |
/*************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
799 |
%type <leaf> multi_element_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
800 |
/* helper symbol for any_symbolic_variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
801 |
%type <leaf> any_multi_element_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
802 |
%type <leaf> array_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
803 |
/* helper symbol for any_symbolic_variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
804 |
%type <leaf> any_array_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
805 |
%type <leaf> subscripted_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
806 |
/* helper symbol for any_symbolic_variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
807 |
%type <leaf> any_subscripted_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
808 |
%type <list> subscript_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
809 |
%type <leaf> subscript |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
810 |
%type <leaf> structured_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
811 |
/* helper symbol for any_symbolic_variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
812 |
%type <leaf> any_structured_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
813 |
%type <leaf> record_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
814 |
/* helper symbol for any_symbolic_variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
815 |
%type <leaf> any_record_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
816 |
%type <leaf> field_selector |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
817 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
818 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
819 |
/******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
820 |
/* B 1.4.3 - Declaration & Initialisation */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
821 |
/******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
822 |
%type <leaf> input_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
823 |
/* helper symbol for input_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
824 |
%type <list> input_declaration_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
825 |
%type <leaf> input_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
826 |
%type <leaf> edge_declaration |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
827 |
/* en_param_declaration is not in the standard, but should be! */ |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
828 |
%type <leaf> en_param_declaration |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
829 |
%type <leaf> var_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
830 |
%type <leaf> var1_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
831 |
%type <list> var1_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
832 |
%type <leaf> array_var_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
833 |
%type <leaf> structured_var_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
834 |
%type <leaf> fb_name_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
835 |
/* helper symbol for fb_name_decl */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
836 |
%type <list> fb_name_list_with_colon |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
837 |
/* helper symbol for fb_name_list_with_colon */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
838 |
%type <list> var1_list_with_colon |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
839 |
// %type <list> fb_name_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
840 |
// %type <leaf> fb_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
841 |
%type <leaf> output_declarations |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
842 |
%type <leaf> var_output_init_decl |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
843 |
%type <list> var_output_init_decl_list |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
844 |
/* eno_param_declaration is not in the standard, but should be! */ |
147 | 845 |
%type <leaf> eno_param_declaration |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
846 |
%type <leaf> input_output_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
847 |
/* helper symbol for input_output_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
848 |
%type <list> var_declaration_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
849 |
%type <leaf> var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
850 |
%type <leaf> temp_var_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
851 |
%type <leaf> var1_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
852 |
%type <leaf> array_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
853 |
%type <leaf> structured_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
854 |
%type <leaf> var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
855 |
%type <leaf> retentive_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
856 |
%type <leaf> located_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
857 |
/* helper symbol for located_var_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
858 |
%type <list> located_var_decl_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
859 |
%type <leaf> located_var_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
860 |
%type <leaf> external_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
861 |
/* helper symbol for external_var_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
862 |
%type <list> external_declaration_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
863 |
%type <leaf> external_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
864 |
%type <leaf> global_var_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
865 |
%type <leaf> global_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
866 |
/* helper symbol for global_var_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
867 |
%type <list> global_var_decl_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
868 |
%type <leaf> global_var_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
869 |
%type <leaf> global_var_spec |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
870 |
%type <leaf> located_var_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
871 |
%type <leaf> location |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
872 |
%type <list> global_var_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
873 |
%type <leaf> string_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
874 |
%type <leaf> single_byte_string_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
875 |
%type <leaf> single_byte_string_spec |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
876 |
%type <leaf> double_byte_string_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
877 |
%type <leaf> double_byte_string_spec |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
878 |
%type <leaf> incompl_located_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
879 |
/* helper symbol for incompl_located_var_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
880 |
%type <list> incompl_located_var_decl_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
881 |
%type <leaf> incompl_located_var_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
882 |
%type <leaf> incompl_location |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
883 |
%type <leaf> var_spec |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
884 |
/* helper symbol for var_spec */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
885 |
%type <leaf> string_spec |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
886 |
/* intermediate helper symbol for: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
887 |
* - non_retentive_var_decls |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
888 |
* - var_declarations |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
889 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
890 |
%type <list> var_init_decl_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
891 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
892 |
%token <ID> incompl_location_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
893 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
894 |
%token VAR_INPUT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
895 |
%token VAR_OUTPUT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
896 |
%token VAR_IN_OUT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
897 |
%token VAR_EXTERNAL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
898 |
%token VAR_GLOBAL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
899 |
%token END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
900 |
%token RETAIN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
901 |
%token NON_RETAIN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
902 |
%token R_EDGE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
903 |
%token F_EDGE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
904 |
%token AT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
905 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
906 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
907 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
908 |
/* B 1.5.1 - Functions */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
909 |
/***********************/ |
68 | 910 |
// %type <leaf> function_name |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
911 |
/* helper symbol for IL language */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
912 |
%type <leaf> function_name_no_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
913 |
%type <leaf> function_name_simpleop_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
914 |
//%type <leaf> function_name_expression_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
915 |
/* helper symbols for ST language */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
916 |
//%type <leaf> function_name_NOT_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
917 |
%type <leaf> function_name_no_NOT_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
918 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
919 |
//%type <leaf> standard_function_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
920 |
/* helper symbols for IL language */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
921 |
%type <leaf> standard_function_name_no_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
922 |
%type <leaf> standard_function_name_simpleop_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
923 |
%type <leaf> standard_function_name_expression_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
924 |
/* helper symbols for ST language */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
925 |
%type <leaf> standard_function_name_NOT_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
926 |
%type <leaf> standard_function_name_no_NOT_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
927 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
928 |
%type <leaf> derived_function_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
929 |
%type <leaf> function_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
930 |
/* helper symbol for function_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
931 |
%type <leaf> function_name_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
932 |
%type <leaf> io_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
933 |
%type <leaf> function_var_decls |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
934 |
%type <leaf> function_body |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
935 |
%type <leaf> var2_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
936 |
/* intermediate helper symbol for function_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
937 |
%type <list> io_OR_function_var_declarations_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
938 |
/* intermediate helper symbol for function_var_decls */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
939 |
%type <list> var2_init_decl_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
940 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
941 |
%token <ID> standard_function_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
942 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
943 |
%token FUNCTION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
944 |
%token END_FUNCTION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
945 |
%token CONSTANT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
946 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
947 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
948 |
/*****************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
949 |
/* B 1.5.2 - Function Blocks */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
950 |
/*****************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
951 |
%type <leaf> function_block_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
952 |
%type <leaf> standard_function_block_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
953 |
%type <leaf> derived_function_block_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
954 |
%type <leaf> function_block_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
955 |
%type <leaf> other_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
956 |
%type <leaf> temp_var_decls |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
957 |
%type <leaf> non_retentive_var_decls |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
958 |
%type <leaf> function_block_body |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
959 |
/* intermediate helper symbol for function_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
960 |
%type <list> io_OR_other_var_declarations_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
961 |
/* intermediate helper symbol for temp_var_decls */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
962 |
%type <list> temp_var_decls_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
963 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
964 |
%token <ID> standard_function_block_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
965 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
966 |
%token FUNCTION_BLOCK |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
967 |
%token END_FUNCTION_BLOCK |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
968 |
%token VAR_TEMP |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
969 |
// %token END_VAR |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
970 |
%token VAR |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
971 |
// %token NON_RETAIN |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
972 |
// %token END_VAR |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
973 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
974 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
975 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
976 |
/* B 1.5.3 - Programs */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
977 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
978 |
%type <leaf> program_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
979 |
%type <leaf> program_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
980 |
/* helper symbol for program_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
981 |
%type <list> program_var_declarations_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
982 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
983 |
%token PROGRAM |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
984 |
%token END_PROGRAM |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
985 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
986 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
987 |
/********************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
988 |
/* B 1.6 Sequential Function Chart elements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
989 |
/********************************************/ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
990 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
991 |
%type <list> sequential_function_chart |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
992 |
%type <list> sfc_network |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
993 |
%type <leaf> initial_step |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
994 |
%type <leaf> step |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
995 |
%type <list> action_association_list |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
996 |
%type <leaf> step_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
997 |
%type <leaf> action_association |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
998 |
/* helper symbol for action_association */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
999 |
%type <list> indicator_name_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1000 |
%type <leaf> action_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1001 |
%type <leaf> action_qualifier |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
1002 |
%type <leaf> qualifier |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1003 |
%type <leaf> timed_qualifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1004 |
%type <leaf> action_time |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1005 |
%type <leaf> indicator_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1006 |
%type <leaf> transition |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1007 |
%type <leaf> steps |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1008 |
%type <list> step_name_list |
131 | 1009 |
%type <leaf> transition_priority |
85 | 1010 |
%type <leaf> transition_condition |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1011 |
%type <leaf> action |
151 | 1012 |
%type <leaf> action_body |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
1013 |
%type <leaf> transition_name |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
1014 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1015 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1016 |
// %token ASSIGN |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1017 |
%token ACTION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1018 |
%token END_ACTION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1019 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1020 |
%token TRANSITION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1021 |
%token END_TRANSITION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1022 |
%token FROM |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1023 |
%token TO |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1024 |
%token PRIORITY |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1025 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1026 |
%token INITIAL_STEP |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1027 |
%token STEP |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1028 |
%token END_STEP |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1029 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1030 |
%token L |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1031 |
%token D |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1032 |
%token SD |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1033 |
%token DS |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1034 |
%token SL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1035 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1036 |
%token N |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1037 |
%token P |
627
e7caa7d32ef5
Adding support for P0 and P1 qualifiers and fixing code generated for SL qualifier
Laurent Bessard
parents:
616
diff
changeset
|
1038 |
%token P0 |
e7caa7d32ef5
Adding support for P0 and P1 qualifiers and fixing code generated for SL qualifier
Laurent Bessard
parents:
616
diff
changeset
|
1039 |
%token P1 |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1040 |
/* NOTE: the following two clash with the R and S IL operators. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1041 |
* It will have to be handled when we include parsing of SFC... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1042 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1043 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1044 |
%token R |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1045 |
%token S |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1046 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1047 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1048 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1049 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1050 |
/* B 1.7 Configuration elements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1051 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1052 |
%type <leaf> configuration_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1053 |
%type <leaf> resource_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1054 |
%type <leaf> configuration_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1055 |
// helper symbol for |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1056 |
// - configuration_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1057 |
// - resource_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1058 |
// |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
1059 |
%type <list> global_var_declarations_list |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1060 |
// helper symbol for configuration_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1061 |
%type <leaf> optional_access_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1062 |
// helper symbol for configuration_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1063 |
%type <leaf> optional_instance_specific_initializations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1064 |
// helper symbol for configuration_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1065 |
%type <list> resource_declaration_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1066 |
%type <leaf> resource_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1067 |
%type <leaf> single_resource_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1068 |
// helper symbol for single_resource_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1069 |
%type <list> task_configuration_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1070 |
// helper symbol for single_resource_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1071 |
%type <list> program_configuration_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1072 |
%type <leaf> resource_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1073 |
// %type <leaf> access_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1074 |
// helper symbol for access_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1075 |
// %type <leaf> access_declaration_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1076 |
// %type <leaf> access_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1077 |
// %type <leaf> access_path |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1078 |
// helper symbol for access_path |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1079 |
%type <list> any_fb_name_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1080 |
%type <leaf> global_var_reference |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1081 |
// %type <leaf> access_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1082 |
%type <leaf> program_output_reference |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1083 |
%type <leaf> program_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1084 |
// %type <leaf> direction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1085 |
%type <leaf> task_configuration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1086 |
%type <leaf> task_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1087 |
%type <leaf> task_initialization |
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
1088 |
// 3 helper symbols for task_initialization |
75 | 1089 |
%type <leaf> task_initialization_single |
1090 |
%type <leaf> task_initialization_interval |
|
1091 |
%type <leaf> task_initialization_priority |
|
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
1092 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1093 |
%type <leaf> data_source |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1094 |
%type <leaf> program_configuration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1095 |
// helper symbol for program_configuration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1096 |
%type <leaf> optional_task_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1097 |
// helper symbol for program_configuration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1098 |
%type <leaf> optional_prog_conf_elements |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1099 |
%type <list> prog_conf_elements |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1100 |
%type <leaf> prog_conf_element |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1101 |
%type <leaf> fb_task |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1102 |
%type <leaf> prog_cnxn |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1103 |
%type <leaf> prog_data_source |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1104 |
%type <leaf> data_sink |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1105 |
%type <leaf> instance_specific_initializations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1106 |
// helper symbol for instance_specific_initializations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1107 |
%type <list> instance_specific_init_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1108 |
%type <leaf> instance_specific_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1109 |
// helper symbol for instance_specific_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1110 |
%type <leaf> fb_initialization |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1111 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1112 |
%type <leaf> prev_declared_global_var_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1113 |
%token <ID> prev_declared_global_var_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1114 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1115 |
%type <leaf> prev_declared_program_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1116 |
%token <ID> prev_declared_program_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1117 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1118 |
%type <leaf> prev_declared_resource_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1119 |
%token <ID> prev_declared_resource_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1120 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1121 |
%token <ID> prev_declared_configuration_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1122 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1123 |
// %type <leaf> prev_declared_task_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1124 |
// %token <ID> prev_declared_task_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1125 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1126 |
%token CONFIGURATION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1127 |
%token END_CONFIGURATION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1128 |
%token TASK |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1129 |
%token RESOURCE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1130 |
%token ON |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1131 |
%token END_RESOURCE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1132 |
%token VAR_CONFIG |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1133 |
%token VAR_ACCESS |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1134 |
// %token END_VAR |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1135 |
%token WITH |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1136 |
// %token PROGRAM |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1137 |
// %token RETAIN |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1138 |
// %token NON_RETAIN |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1139 |
// %token PRIORITY |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1140 |
%token SINGLE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1141 |
%token INTERVAL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1142 |
%token READ_WRITE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1143 |
%token READ_ONLY |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1144 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1145 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1146 |
/***********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1147 |
/* B 2.1 Instructions and Operands */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1148 |
/***********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1149 |
%type <list> instruction_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1150 |
%type <leaf> il_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1151 |
%type <leaf> il_incomplete_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1152 |
%type <leaf> label |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1153 |
%type <leaf> il_simple_operation |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1154 |
// helper symbol for il_simple_operation |
91 | 1155 |
//%type <tmp_symbol> il_simple_operator_clash_il_operand |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1156 |
%type <leaf> il_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1157 |
%type <leaf> il_jump_operation |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1158 |
%type <leaf> il_fb_call |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1159 |
%type <leaf> il_formal_funct_call |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1160 |
// helper symbol for il_formal_funct_call |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1161 |
%type <leaf> il_expr_operator_clash_eol_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1162 |
%type <leaf> il_operand |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1163 |
%type <list> il_operand_list |
91 | 1164 |
// helper symbol for il_simple_operation |
1165 |
%type <list> il_operand_list2 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1166 |
%type <list> simple_instr_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1167 |
%type <leaf> il_simple_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1168 |
%type <list> il_param_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1169 |
%type <list> il_param_instruction_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1170 |
%type <leaf> il_param_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1171 |
%type <leaf> il_param_last_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1172 |
%type <leaf> il_param_assignment |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1173 |
%type <leaf> il_param_out_assignment |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1174 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1175 |
%token EOL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1176 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1177 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1178 |
/*******************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1179 |
/* B 2.2 Operators */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1180 |
/*******************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1181 |
%token <ID> sendto_identifier_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1182 |
%type <leaf> sendto_identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1183 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1184 |
%type <leaf> LD_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1185 |
%type <leaf> LDN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1186 |
%type <leaf> ST_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1187 |
%type <leaf> STN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1188 |
%type <leaf> NOT_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1189 |
%type <leaf> S_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1190 |
%type <leaf> R_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1191 |
%type <leaf> S1_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1192 |
%type <leaf> R1_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1193 |
%type <leaf> CLK_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1194 |
%type <leaf> CU_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1195 |
%type <leaf> CD_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1196 |
%type <leaf> PV_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1197 |
%type <leaf> IN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1198 |
%type <leaf> PT_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1199 |
%type <leaf> AND_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1200 |
%type <leaf> AND2_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1201 |
%type <leaf> OR_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1202 |
%type <leaf> XOR_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1203 |
%type <leaf> ANDN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1204 |
%type <leaf> ANDN2_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1205 |
%type <leaf> ORN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1206 |
%type <leaf> XORN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1207 |
%type <leaf> ADD_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1208 |
%type <leaf> SUB_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1209 |
%type <leaf> MUL_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1210 |
%type <leaf> DIV_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1211 |
%type <leaf> MOD_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1212 |
%type <leaf> GT_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1213 |
%type <leaf> GE_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1214 |
%type <leaf> EQ_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1215 |
%type <leaf> LT_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1216 |
%type <leaf> LE_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1217 |
%type <leaf> NE_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1218 |
%type <leaf> CAL_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1219 |
%type <leaf> CALC_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1220 |
%type <leaf> CALCN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1221 |
%type <leaf> RET_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1222 |
%type <leaf> RETC_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1223 |
%type <leaf> RETCN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1224 |
%type <leaf> JMP_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1225 |
%type <leaf> JMPC_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1226 |
%type <leaf> JMPCN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1227 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1228 |
%type <leaf> il_simple_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1229 |
%type <leaf> il_simple_operator_clash |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1230 |
%type <leaf> il_simple_operator_clash1 |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1231 |
%type <leaf> il_simple_operator_clash2 |
382
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
1232 |
%type <leaf> il_simple_operator_clash3 |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1233 |
%type <leaf> il_simple_operator_noclash |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1234 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1235 |
//%type <leaf> il_expr_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1236 |
%type <leaf> il_expr_operator_clash |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1237 |
%type <leaf> il_expr_operator_noclash |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1238 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1239 |
%type <leaf> il_assign_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1240 |
%type <leaf> il_assign_out_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1241 |
%type <leaf> il_call_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1242 |
%type <leaf> il_return_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1243 |
%type <leaf> il_jump_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1244 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1245 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1246 |
%token LD |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1247 |
%token LDN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1248 |
%token ST |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1249 |
%token STN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1250 |
%token NOT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1251 |
%token S |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1252 |
%token R |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1253 |
%token S1 |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1254 |
%token R1 |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1255 |
%token CLK |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1256 |
%token CU |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1257 |
%token CD |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1258 |
%token PV |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1259 |
%token IN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1260 |
%token PT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1261 |
%token AND |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1262 |
%token AND2 /* character '&' in the source code*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1263 |
%token OR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1264 |
%token XOR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1265 |
%token ANDN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1266 |
%token ANDN2 /* characters '&N' in the source code */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1267 |
%token ORN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1268 |
%token XORN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1269 |
%token ADD |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1270 |
%token SUB |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1271 |
%token MUL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1272 |
%token DIV |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1273 |
%token MOD |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1274 |
%token GT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1275 |
%token GE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1276 |
%token EQ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1277 |
%token LT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1278 |
%token LE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1279 |
%token NE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1280 |
%token CAL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1281 |
%token CALC |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1282 |
%token CALCN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1283 |
%token RET |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1284 |
%token RETC |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1285 |
%token RETCN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1286 |
%token JMP |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1287 |
%token JMPC |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1288 |
%token JMPCN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1289 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1290 |
%token SENDTO /* "=>" */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1291 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1292 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1293 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1294 |
/* B 3.1 - Expressions */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1295 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1296 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1297 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1298 |
* - unary_operator, multiply_operator, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1299 |
* add_operator and comparison_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1300 |
* are not required. Their values are integrated |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1301 |
* directly into other rules... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1302 |
*/ |
873
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
1303 |
%type <leaf> ref_expression /* an extension to the IEC 61131-3 v2 standard, based on the IEC 61131-3 v3 standard */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1304 |
%type <leaf> expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1305 |
%type <leaf> xor_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1306 |
%type <leaf> and_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1307 |
%type <leaf> comparison |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1308 |
%type <leaf> equ_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1309 |
// %type <leaf> comparison_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1310 |
%type <leaf> add_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1311 |
// %type <leaf> add_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1312 |
%type <leaf> term |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1313 |
// %type <leaf> multiply_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1314 |
%type <leaf> power_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1315 |
%type <leaf> unary_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1316 |
// %type <leaf> unary_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1317 |
%type <leaf> primary_expression |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1318 |
%type <leaf> non_int_or_real_primary_expression |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1319 |
/* intermediate helper symbol for primary_expression */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1320 |
%type <leaf> function_invocation |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1321 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1322 |
// %token AND |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1323 |
// %token XOR |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1324 |
// %token OR |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1325 |
// %token MOD |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1326 |
// %token NOT |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1327 |
%token OPER_NE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1328 |
%token OPER_GE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1329 |
%token OPER_LE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1330 |
%token OPER_EXP |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1331 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1332 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1333 |
/********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1334 |
/* B 3.2 Statements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1335 |
/********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1336 |
%type <list> statement_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1337 |
%type <leaf> statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1338 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1339 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1340 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1341 |
/*********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1342 |
/* B 3.2.1 Assignment Statements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1343 |
/*********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1344 |
%type <leaf> assignment_statement |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1345 |
// %token ASSIGN /* ":=" */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1346 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1347 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1348 |
/*****************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1349 |
/* B 3.2.2 Subprogram Control Statements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1350 |
/*****************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1351 |
%type <leaf> subprogram_control_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1352 |
%type <leaf> return_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1353 |
%type <leaf> fb_invocation |
85 | 1354 |
// %type <leaf> param_assignment |
1355 |
%type <leaf> param_assignment_formal |
|
1356 |
%type <leaf> param_assignment_nonformal |
|
1357 |
/* helper symbols for fb_invocation */ |
|
1358 |
%type <list> param_assignment_formal_list |
|
1359 |
%type <list> param_assignment_nonformal_list |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1360 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1361 |
// %token ASSIGN |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1362 |
// %token SENDTO /* "=>" */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1363 |
%token RETURN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1364 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1365 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1366 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1367 |
/* B 3.2.3 Selection Statements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1368 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1369 |
%type <leaf> selection_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1370 |
%type <leaf> if_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1371 |
%type <leaf> case_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1372 |
%type <leaf> case_element |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1373 |
%type <list> case_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1374 |
%type <leaf> case_list_element |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1375 |
/* helper symbol for if_statement */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1376 |
%type <list> elseif_statement_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1377 |
/* helper symbol for elseif_statement_list */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1378 |
%type <leaf> elseif_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1379 |
/* helper symbol for case_statement */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1380 |
%type <list> case_element_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1381 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1382 |
%token IF |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1383 |
%token THEN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1384 |
%token ELSIF |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1385 |
%token ELSE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1386 |
%token END_IF |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1387 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1388 |
%token CASE |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1389 |
// %token OF |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1390 |
// %token ELSE |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1391 |
%token END_CASE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1392 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1393 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1394 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1395 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1396 |
/* B 3.2.4 Iteration Statements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1397 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1398 |
%type <leaf> iteration_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1399 |
%type <leaf> for_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1400 |
%type <leaf> control_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1401 |
%type <leaf> while_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1402 |
%type <leaf> repeat_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1403 |
%type <leaf> exit_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1404 |
/* Integrated directly into for_statement */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1405 |
// %type <leaf> for_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1406 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1407 |
%token FOR |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1408 |
// %token ASSIGN |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1409 |
// %token TO |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1410 |
%token BY |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1411 |
%token DO |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1412 |
%token END_FOR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1413 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1414 |
%token WHILE |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1415 |
// %token DO |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1416 |
%token END_WHILE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1417 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1418 |
%token REPEAT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1419 |
%token UNTIL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1420 |
%token END_REPEAT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1421 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1422 |
%token EXIT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1423 |
|
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
1424 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1425 |
%% |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1426 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1427 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1428 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1429 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1430 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1431 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1432 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1433 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1434 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1435 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1436 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1437 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1438 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1439 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1440 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1441 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1442 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1443 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1444 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1445 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1446 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1447 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1448 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1449 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1450 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1451 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1452 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1453 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1454 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1455 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1456 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1457 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1458 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1459 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1460 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1461 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1462 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1463 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1464 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1465 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1466 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1467 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1468 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1469 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1470 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1471 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1472 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1473 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1474 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1475 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1476 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1477 |
start: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1478 |
library {$$ = $1;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1479 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1480 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1481 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1482 |
/**********************************************************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1483 |
/* B XXX - Things that are missing from the standard, but should have been there! */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1484 |
/**********************************************************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1485 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1486 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1487 |
/* the pragmas... */ |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1488 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1489 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1490 |
disable_code_generation_pragma: |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1491 |
disable_code_generation_pragma_token {$$ = new disable_code_generation_pragma_c(locloc(@$));} |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1492 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1493 |
enable_code_generation_pragma: |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1494 |
enable_code_generation_pragma_token {$$ = new enable_code_generation_pragma_c(locloc(@$));} |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1495 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1496 |
pragma: |
68 | 1497 |
pragma_token {$$ = new pragma_c($1, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1498 |
|
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1499 |
any_pragma: |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1500 |
disable_code_generation_pragma |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1501 |
| enable_code_generation_pragma |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1502 |
| pragma |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1503 |
; |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1504 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1505 |
|
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
1506 |
/* EN/ENO */ |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1507 |
/* Tese tokens are essentially used as variable names, so we handle them |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1508 |
* similarly to these... |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1509 |
*/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1510 |
en_identifier: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1511 |
EN {$$ = new identifier_c("EN", locloc(@$));} |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1512 |
; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1513 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1514 |
eno_identifier: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1515 |
ENO {$$ = new identifier_c("ENO", locloc(@$));} |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1516 |
; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1517 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1518 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1519 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1520 |
/*************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1521 |
/* Prelimenary helpful constructs... */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1522 |
/*************************************/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1523 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1524 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1525 |
* short version: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1526 |
* identifier is used for previously undeclared identifiers |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1527 |
* any_identifier is used when any identifier, previously |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1528 |
* declared or not, is required in the syntax. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1529 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1530 |
* long version: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1531 |
* When flex comes across an identifier, it first |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1532 |
* searches through the currently declared variables, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1533 |
* functions, types, etc... to determine if it has |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1534 |
* been previously declared. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1535 |
* Only if the identifier has not yet been declared |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1536 |
* will it return an identifier_token (later turned into |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1537 |
* an identifier symbol by the bison generated syntax parser). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1538 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1539 |
* Some constructs in the syntax, such as when calling |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1540 |
* a function 'F(var1 := 1; var2 := 2);', will accept _any_ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1541 |
* identifier in 'var1', even if it has been previously |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1542 |
* declared in the current scope, since var1 belongs to |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1543 |
* another scope (the variables declared in function F). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1544 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1545 |
* For the above reason, we need to define the symbol |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1546 |
* any_identifier. All the symbols that may become an |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1547 |
* any_identifier are expected to be stored in the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1548 |
* abstract syntax as a identifier_c |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1549 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1550 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1551 |
* Type names, function names, function block type names and |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1552 |
* program type names are considerd keywords once they are defined, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1553 |
* so may no longer be used for variable names! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1554 |
* BUT the spec is confusing on this issue, as it is not clear when |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1555 |
* a function name should be considered as defined. If it is to be |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1556 |
* considered defined only from the location from where it is declared |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1557 |
* and onwards, it means that before it is declared its name may be |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1558 |
* used for variable names! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1559 |
* This means that we must allow names previously used for functions |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1560 |
* (et. al.) to also constitue an any_identifier! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1561 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1562 |
any_identifier: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1563 |
identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1564 |
| prev_declared_fb_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1565 |
| prev_declared_variable_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1566 |
/**/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1567 |
| prev_declared_enumerated_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1568 |
| prev_declared_simple_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1569 |
| prev_declared_subrange_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1570 |
| prev_declared_array_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1571 |
| prev_declared_structure_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1572 |
| prev_declared_string_type_name |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1573 |
| prev_declared_ref_type_name /* defined in IEC 61131-3 v3 */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1574 |
| prev_declared_derived_function_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1575 |
| prev_declared_derived_function_block_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1576 |
| prev_declared_program_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1577 |
/**/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1578 |
| prev_declared_resource_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1579 |
| prev_declared_program_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1580 |
| prev_declared_global_var_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1581 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1582 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1583 |
|
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1584 |
prev_declared_variable_name : prev_declared_variable_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1585 |
prev_declared_fb_name : prev_declared_fb_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1586 |
|
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1587 |
prev_declared_simple_type_name : prev_declared_simple_type_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1588 |
prev_declared_subrange_type_name : prev_declared_subrange_type_name_token {$$ = new identifier_c($1, locloc(@$));}; |
68 | 1589 |
prev_declared_enumerated_type_name: prev_declared_enumerated_type_name_token {$$ = new identifier_c($1, locloc(@$));}; |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1590 |
prev_declared_array_type_name : prev_declared_array_type_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1591 |
prev_declared_structure_type_name : prev_declared_structure_type_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1592 |
prev_declared_string_type_name : prev_declared_string_type_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1593 |
prev_declared_ref_type_name : prev_declared_ref_type_name_token {$$ = new identifier_c($1, locloc(@$));}; /* defined in IEC 61131-3 v3 */ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1594 |
|
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1595 |
prev_declared_derived_function_name : prev_declared_derived_function_name_token {$$ = new identifier_c($1, locloc(@$));}; |
68 | 1596 |
prev_declared_derived_function_block_name: prev_declared_derived_function_block_name_token {$$ = new identifier_c($1, locloc(@$));}; |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
1597 |
prev_declared_program_type_name : prev_declared_program_type_name_token {$$ = new identifier_c($1, locloc(@$));}; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1598 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1599 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1600 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1601 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1602 |
/* B 0 - Programming Model */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1603 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1604 |
library: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1605 |
/* empty */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1606 |
{if (tree_root == NULL) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1607 |
tree_root = new library_c(); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1608 |
$$ = (list_c *)tree_root; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1609 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1610 |
| library library_element_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1611 |
{$$ = $1; $$->add_element($2);} |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1612 |
| library any_pragma |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1613 |
{$$ = $1; $$->add_element($2);} |
77 | 1614 |
/* ERROR_CHECK_BEGIN */ |
136 | 1615 |
| library error library_element_declaration |
1616 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unknown syntax error."); yyerrok;} |
|
73 | 1617 |
| library error END_OF_INPUT |
136 | 1618 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unknown syntax error."); yyerrok;} |
77 | 1619 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1620 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1621 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1622 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1623 |
library_element_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1624 |
data_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1625 |
| function_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1626 |
| function_block_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1627 |
| program_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1628 |
| configuration_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1629 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1630 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1631 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1632 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1633 |
/*******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1634 |
/* B 1.1 - Letters, digits and identifiers */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1635 |
/*******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1636 |
/* NOTE: the spec defines identifier as: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1637 |
* identifier ::= (letter|('_' (letter|digit))) {['_'] (letter|digit)} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1638 |
* In essence, any sequence of letters or digits, starting with a letter |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1639 |
* or '_'. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1640 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1641 |
* On section 2.1.3 (pg 26) , the spec states |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1642 |
* "The keywords listed in annex C shall not be used for any other purpose, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1643 |
* e.g., variable names or extensions as defined in 1.5.1." |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1644 |
* (NOTE: the spec itself does not follow this rule, as it defines standard |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1645 |
* functions with names identidal to keywords, e.g. 'MOD', 'NOT' !!. This is |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1646 |
* another issue altogether, and is worked around somewhere else...) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1647 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1648 |
* This means that we must re-define indentifier so as to exclude |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1649 |
* any keywords defined in annex C. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1650 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1651 |
* Note also that the list includes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1652 |
* - Data type names |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1653 |
* - Function names |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1654 |
* - Function Block names |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1655 |
* This means that any named used for a function name, data type name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1656 |
* or function block name, essentially becomes a keyword, and may therefore |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1657 |
* no longer be re-used for any other use! (see NOTE 2) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1658 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1659 |
* In our case, excluding the keywords is achieved in the lexical parser, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1660 |
* by two mechanisms: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1661 |
* (1) giving higher priority to the keywords (tokens) than to identifiers, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1662 |
* so when the lexical parser finds a keyword it will be parsed as a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1663 |
* token before being parsed as an identifier. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1664 |
* (2) when an identifier is found that is not a keyword, the lexical parser |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1665 |
* then looks in the global symbol table, and will not return an identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1666 |
* if the name has been previously used as a data type name, function name, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1667 |
* or function block name! (In these cases it will return a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1668 |
* prev_declared_function_name_token, etc...). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1669 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1670 |
* Unfortunately, the language (especially IL) uses tokens that are |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1671 |
* not defined as keywords in the spec (e.g. 'IN', 'R1', 'S1', 'PT', etc...)! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1672 |
* This means that it is valid to name a function 'IN', a variable 'PT', etc... |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1673 |
* In order to solve this potential ambiguity, flex only parses the above |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1674 |
* identifiers as keywords / tokens if we are currently parsing IL code. |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1675 |
* When parsing all code other than IL code, the above identifiers are treated |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1676 |
* just like any other identifier. |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1677 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1678 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1679 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1680 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1681 |
* NOTE 2: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1682 |
* I (Mario) find it strange that the writers of the spec really want |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1683 |
* names previously used for function names, data type names or function |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1684 |
* block names, to become full fledged keywords. I understand that they |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1685 |
* do not want these names being used as variable names, but how about |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1686 |
* enumeration values? How about structure element names? |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1687 |
* If we interpret the spec literally, these would not be accepted, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1688 |
* which would probably burden the programmer quite a bit, in making sure |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1689 |
* all these name don't clash! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1690 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1691 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1692 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1693 |
* NOTE 3: The keywords, as specified in Annex C are... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1694 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1695 |
* - Data type names |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1696 |
* - Function names |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1697 |
* - Function Block names |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1698 |
* - ACTION...END_ACTION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1699 |
* - ARRAY...OF |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1700 |
* - AT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1701 |
* - CASE...OF...ELSE...END_CASE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1702 |
* - CONFIGURATION...END_CONFIGURATION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1703 |
* - CONSTANT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1704 |
* - EN, ENO |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1705 |
* - EXIT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1706 |
* - FALSE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1707 |
* - F_EDGE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1708 |
* - FOR...TO...BY...DO...END_FOR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1709 |
* - FUNCTION...END_FUNCTION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1710 |
* - FUNCTION_BLOCK...END_FUNCTION_BLOCK |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1711 |
* - IF...THEN...ELSIF...ELSE...END_IF |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1712 |
* - INITIAL_STEP...END_STEP |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1713 |
* - NOT, MOD, AND, XOR, OR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1714 |
* - PROGRAM...WITH... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1715 |
* - PROGRAM...END_PROGRAM |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1716 |
* - R_EDGE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1717 |
* - READ_ONLY, READ_WRITE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1718 |
* - REPEAT...UNTIL...END_REPEAT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1719 |
* - RESOURCE...ON...END_RESOURCE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1720 |
* - RETAIN, NON_RETAIN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1721 |
* - RETURN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1722 |
* - STEP...END_STEP |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1723 |
* - STRUCT...END_STRUCT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1724 |
* - TASK |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1725 |
* - TRANSITION...FROM...TO...END_TRANSITION |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1726 |
* - TRUE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1727 |
* - TYPE...END_TYPE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1728 |
* - VAR...END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1729 |
* - VAR_INPUT...END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1730 |
* - VAR_OUTPUT...END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1731 |
* - VAR_IN_OUT...END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1732 |
* - VAR_TEMP...END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1733 |
* - VAR_EXTERNAL...END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1734 |
* - VAR_ACCESS...END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1735 |
* - VAR_CONFIG...END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1736 |
* - VAR_GLOBAL...END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1737 |
* - WHILE...DO...END_WHILE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1738 |
* - WITH |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1739 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1740 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1741 |
identifier: |
68 | 1742 |
identifier_token {$$ = new identifier_c($1, locloc(@$));} |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1743 |
; |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1744 |
|
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1745 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1746 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1747 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1748 |
/* B 1.2 - Constants */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1749 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1750 |
constant: |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1751 |
character_string |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1752 |
| time_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1753 |
| bit_string_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1754 |
| boolean_literal |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1755 |
| numeric_literal |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1756 |
/* NOTE: Our definition of numeric_literal is diferent than the one in the standard. |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1757 |
* We will now add what is missing in our definition of numeric literal, so our |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1758 |
* definition of constant matches what the definition of constant in the standard. |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1759 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1760 |
/* NOTE: in order to remove reduce/reduce conflicts, |
257 | 1761 |
* [between -9.5 being parsed as |
1762 |
* (i) a signed real, |
|
1763 |
* (ii) or as a real preceded by the '-' operator |
|
1764 |
* ] |
|
1765 |
* we need to define a variant of the constant construct |
|
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1766 |
* where any real or integer constant is always preceded by |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1767 |
* a sign (i.e. the '-' or '+' characters). |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1768 |
* (For more info, see comment in the construct non_int_or_real_primary_expression) |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1769 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1770 |
* For the above reason, our definition of the numeric_literal construct |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1771 |
* is missing the integer and real constrcuts (when not preceded by a sign) |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1772 |
* so we add then here explicitly! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1773 |
*/ |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1774 |
| real |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1775 |
| integer |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1776 |
/* NOTE: unsigned_integer, although used in some |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1777 |
* rules, is not defined in the spec! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1778 |
* We therefore replaced unsigned_integer as integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1779 |
*/ |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1780 |
; |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1781 |
|
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1782 |
|
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1783 |
|
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1784 |
|
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1785 |
non_int_or_real_constant: |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1786 |
character_string |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1787 |
| time_literal |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1788 |
| bit_string_literal |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1789 |
| boolean_literal |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1790 |
| numeric_literal |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1791 |
/* NOTE: Our definition of numeric_literal is diferent than the one in the standard. |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1792 |
* It is missing the integer and real when not prefixed by a sign |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1793 |
* (i.e. -54, +42 is included in numerical_literal, |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1794 |
* but 54, 42 is not parsed as a numeric_literal!!) |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1795 |
*/ |
257 | 1796 |
/* NOTE: in order to remove reduce/reduce conflicts, |
1797 |
* [between -9.5 being parsed as |
|
1798 |
* (i) a signed real, |
|
1799 |
* (ii) or as a real preceded by the '-' operator |
|
1800 |
* ] |
|
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1801 |
* [and a similar situation for integers!] |
257 | 1802 |
* we need to define a variant of the constant construct |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1803 |
* where any real or integer constant is always preceded by |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1804 |
* a sign (i.e. the '-' or '+' characters). |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1805 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1806 |
* For the above reason, our definition of the numeric_literal construct |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1807 |
* is missing the integer and real constrcuts (when not preceded by a sign) |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1808 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1809 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1810 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1811 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1812 |
/******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1813 |
/* B 1.2.1 - Numeric Literals */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1814 |
/******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1815 |
/* NOTES: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1816 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1817 |
* - integer is parsed by flex, but signed_integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1818 |
* is parsed by bison. Flex cannot parse a signed |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1819 |
* integer correctly! For example: '123+456' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1820 |
* would be parsed by flex as an {integer} {signed_integer} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1821 |
* instead of {integer} '+' {integer} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1822 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1823 |
* - Neither flex nor bison can parse a real_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1824 |
* completely (and correctly). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1825 |
* Note that we cannot use the definition of real in bison as |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1826 |
* real: signed_integer '.' integer [exponent] |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1827 |
* exponent: {'E'|'e'} ['+'|'-'] integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1828 |
* because 123e45 would be parsed by flex as |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1829 |
* integer (123) identifier (e45). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1830 |
* I.e., flex never hands over an 'e' directly to |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1831 |
* bison, but rather interprets it as an identifier. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1832 |
* I guess we could jump through hoops and get it |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1833 |
* working in bison, but the following alternative |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1834 |
* seems more straight forward... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1835 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1836 |
* We therefore had to break up the definition of |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1837 |
* real_literal in discrete parts: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1838 |
* real_literal: [real_type_name '#'] singned_real |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1839 |
* signed_real: ['+'|'-'] real |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1840 |
* Flex handles real, while bison handles signed_real |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1841 |
* and real_literal. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1842 |
* |
257 | 1843 |
* - According to the spec, integer '.' integer |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1844 |
* may be reduced to either a real or a fixed_point. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1845 |
* It is nevertheless possible to figure out from the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1846 |
* context which of the two rules should be used in |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1847 |
* the reduction. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1848 |
* Unfortunately, due to the issue described above |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1849 |
* regarding the exponent of a real, the syntax |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1850 |
* integer '.' integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1851 |
* must be parsed by flex as a single token (i.e. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1852 |
* fixed_point_token). This means we must add fixed_point |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1853 |
* to the definition of real! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1854 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1855 |
* - The syntax also uses a construct |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1856 |
* fixed_point: integer ['.' integer] |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1857 |
* Notice that real is not defined based on fixed point, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1858 |
* but rather off integer thus: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1859 |
* real: integer '.' integer [exponent] |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1860 |
* This means that a real may not be composed of a single |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1861 |
* integer, unlike the construct fixed_point! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1862 |
* This also means that a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1863 |
* integer '.' integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1864 |
* could be reduced to either a real or a fixed_point |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1865 |
* construct. It is probably possible to decide by looking |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1866 |
* at the context, BUT: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1867 |
* Unfortunatley, due to the reasons explained way above, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1868 |
* a real (with an exponent) has to be handled by flex as a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1869 |
* whole. This means that we cannot leave to bison (the syntax |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1870 |
* parser) the decision of how to reduce an |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1871 |
* integer '.' integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1872 |
* (either to real or to fixed_point) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1873 |
* The decision on how to reduce it would need to be done by |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1874 |
* ther lexical analyser (i.e. flex). But flex cannot do this |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1875 |
* sort of thing. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1876 |
* The solution I (Mario) adopted is to have flex return |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1877 |
* a real_token on (notice that exponent is no longer optional) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1878 |
* integer '.' integer exponent |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1879 |
* and to return a fixed_point_token when it finds |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1880 |
* integer '.' integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1881 |
* We now redefine real and fixed_point to be |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1882 |
* fixed_point: fixed_point_token | integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1883 |
* real: real_token | fixed_point_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1884 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1885 |
real: |
68 | 1886 |
real_token {$$ = new real_c($1, locloc(@$));} |
1887 |
| fixed_point_token {$$ = new real_c($1, locloc(@$));} |
|
1888 |
; |
|
1889 |
||
1890 |
integer: integer_token {$$ = new integer_c($1, locloc(@$));}; |
|
1891 |
binary_integer: binary_integer_token {$$ = new binary_integer_c($1, locloc(@$));}; |
|
1892 |
octal_integer: octal_integer_token {$$ = new octal_integer_c($1, locloc(@$));}; |
|
1893 |
hex_integer: hex_integer_token {$$ = new hex_integer_c($1, locloc(@$));}; |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1894 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1895 |
numeric_literal: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1896 |
integer_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1897 |
| real_literal |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1898 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1899 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1900 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1901 |
integer_literal: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1902 |
integer_type_name '#' signed_integer |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
1903 |
{$$ = new integer_literal_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1904 |
| integer_type_name '#' binary_integer |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
1905 |
{$$ = new integer_literal_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1906 |
| integer_type_name '#' octal_integer |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
1907 |
{$$ = new integer_literal_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1908 |
| integer_type_name '#' hex_integer |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
1909 |
{$$ = new integer_literal_c($1, $3, locloc(@$));} |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1910 |
| binary_integer |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1911 |
| octal_integer |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1912 |
| hex_integer |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1913 |
//|signed_integer /* We expand the construct signed_integer here, so we can remove one of its constituents */ |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1914 |
//| integer /* REMOVED! see note in the definition of constant for reason why integer is missing here! */ |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1915 |
| '+' integer {$$ = $2;} |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1916 |
| '-' integer {$$ = new neg_integer_c($2, locloc(@$));} |
131 | 1917 |
/* ERROR_CHECK_BEGIN */ |
1918 |
| integer_type_name signed_integer |
|
136 | 1919 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;} |
131 | 1920 |
| integer_type_name binary_integer |
136 | 1921 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;} |
131 | 1922 |
| integer_type_name octal_integer |
136 | 1923 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;} |
131 | 1924 |
| integer_type_name hex_integer |
136 | 1925 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;} |
131 | 1926 |
| integer_type_name '#' error |
136 | 1927 |
{$$ = NULL; |
1928 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for integer literal.");} |
|
1929 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for integer literal."); yyclearin;} |
|
131 | 1930 |
yyerrok; |
1931 |
} |
|
1932 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1933 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1934 |
|
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1935 |
/* NOTE: this construct is used in the definition of integer_literal. However, in order to remove |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1936 |
* a reduce/reduce conflict (see NOTE in definition of constant for reason why) |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1937 |
* it is not used directly, but rather its expansion is copied there. |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1938 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1939 |
* If for some reason you need to change the definition of signed_integer, don't forget |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1940 |
* to change its expansion in integer_literal too! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1941 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1942 |
signed_integer: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1943 |
integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1944 |
| '+' integer {$$ = $2;} |
257 | 1945 |
| '-' integer {$$ = new neg_integer_c($2, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1946 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1947 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1948 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1949 |
real_literal: |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1950 |
// signed_real /* We expand the construct signed_integer here, so we can remove one of its constituents */ |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1951 |
// real /* REMOVED! see note in the definition of constant for reason why real is missing here! */ |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1952 |
'+' real {$$ = $2;} |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1953 |
| '-' real {$$ = new neg_real_c($2, locloc(@2));} |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1954 |
| real_type_name '#' signed_real |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
1955 |
{$$ = new real_literal_c($1, $3, locloc(@$));} |
131 | 1956 |
/* ERROR_CHECK_BEGIN */ |
1957 |
| real_type_name signed_real |
|
136 | 1958 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between real type name and value in real literal."); yynerrs++;} |
131 | 1959 |
| real_type_name '#' error |
136 | 1960 |
{$$ = NULL; |
1961 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for real literal.");} |
|
1962 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for real literal."); yyclearin;} |
|
131 | 1963 |
yyerrok; |
1964 |
} |
|
1965 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1966 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1967 |
|
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1968 |
/* NOTE: this construct is used in the definition of real_literal. However, in order to remove |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1969 |
* a reduce/reduce conflict (see NOTE in definition of constant for reason why) |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1970 |
* it is not used directly, but rather its expansion is copied there. |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1971 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1972 |
* If for some reason you need to change the definition of signed_real, don't forget |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1973 |
* to change its expansion in real_literal too! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1974 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1975 |
signed_real: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1976 |
real |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1977 |
| '+' real {$$ = $2;} |
257 | 1978 |
| '-' real {$$ = new neg_real_c($2, locloc(@2));} |
1979 |
; |
|
1980 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1981 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1982 |
bit_string_literal: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1983 |
bit_string_type_name '#' integer /* i.e. unsigned_integer */ |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
1984 |
{$$ = new bit_string_literal_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1985 |
| bit_string_type_name '#' binary_integer |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
1986 |
{$$ = new bit_string_literal_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1987 |
| bit_string_type_name '#' octal_integer |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
1988 |
{$$ = new bit_string_literal_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1989 |
| bit_string_type_name '#' hex_integer |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
1990 |
{$$ = new bit_string_literal_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1991 |
/* NOTE: see note in the definition of constant for reason |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1992 |
* why unsigned_integer, binary_integer, octal_integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1993 |
* and hex_integer are missing here! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1994 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1995 |
/* NOTE: see note under the B 1.2.1 section of token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1996 |
* and grouping type definition for reason why the use of |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1997 |
* bit_string_type_name, although seemingly incorrect, is |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1998 |
* really correct here! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1999 |
*/ |
131 | 2000 |
/* ERROR_CHECK_BEGIN */ |
2001 |
| bit_string_type_name integer |
|
136 | 2002 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;} |
131 | 2003 |
| bit_string_type_name binary_integer |
136 | 2004 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;} |
131 | 2005 |
| bit_string_type_name octal_integer |
136 | 2006 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;} |
131 | 2007 |
| bit_string_type_name hex_integer |
136 | 2008 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;} |
131 | 2009 |
| bit_string_type_name '#' error |
257 | 2010 |
{$$ = NULL; |
136 | 2011 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for bit string literal.");} |
2012 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for bit string literal."); yyclearin;} |
|
131 | 2013 |
yyerrok; |
2014 |
} |
|
2015 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2016 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2017 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2018 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2019 |
boolean_literal: |
257 | 2020 |
boolean_true_literal_token |
2021 |
{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)), |
|
2022 |
new boolean_true_c(locloc(@$)), |
|
2023 |
locloc(@$)); |
|
2024 |
} |
|
2025 |
| boolean_false_literal_token |
|
2026 |
{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)), |
|
68 | 2027 |
new boolean_false_c(locloc(@$)), |
257 | 2028 |
locloc(@$)); |
2029 |
} |
|
2030 |
| safeboolean_true_literal_token |
|
2031 |
{$$ = new boolean_literal_c(new safebool_type_name_c(locloc(@$)), |
|
2032 |
new boolean_true_c(locloc(@$)), |
|
2033 |
locloc(@$)); |
|
2034 |
} |
|
2035 |
| safeboolean_false_literal_token |
|
2036 |
{$$ = new boolean_literal_c(new safebool_type_name_c(locloc(@$)), |
|
2037 |
new boolean_false_c(locloc(@$)), |
|
2038 |
locloc(@$)); |
|
2039 |
} |
|
2040 |
| FALSE |
|
2041 |
{$$ = new boolean_literal_c(NULL, |
|
2042 |
new boolean_false_c(locloc(@$)), |
|
2043 |
locloc(@$)); |
|
2044 |
} |
|
2045 |
| TRUE |
|
2046 |
{$$ = new boolean_literal_c(NULL, |
|
2047 |
new boolean_true_c(locloc(@$)), |
|
2048 |
locloc(@$)); |
|
2049 |
} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2050 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2051 |
| BOOL '#' '1' {} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2052 |
| BOOL '#' '0' {} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2053 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2054 |
/* NOTE: the rules |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2055 |
* BOOL '#' '1' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2056 |
* and |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2057 |
* BOOL '#' '0' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2058 |
* do not work as expected... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2059 |
* Consider that we are using 'BOOL' and '#' as tokens |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2060 |
* that flex hands over to bison (yacc). Because flex would |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2061 |
* then parse the single '1' or '0' as an integer, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2062 |
* the rule in bison would have to be |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2063 |
* BOOL '#' integer, followed by verifying of the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2064 |
* integer has the correct value! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2065 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2066 |
* We therefore have flex return TRUE whenever it |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2067 |
* comes across 'TRUE' or 'BOOL#1', and FALSE whenever |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2068 |
* it comes across 'FALSE' or 'BOOL#0'. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2069 |
* Note that this means that flex will parse "BOOL#01" |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2070 |
* as FALSE followed by an integer ('1'). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2071 |
* Bison should detect this as an error, so we should |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2072 |
* be OK. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2073 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2074 |
* Another option would be to change the rules to accept |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2075 |
* BOOL '#' integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2076 |
* but then check whether the integer has a correct |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2077 |
* value! At the moment I feel that the first option |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2078 |
* is more straight forward. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2079 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2080 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2081 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2082 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2083 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2084 |
/*******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2085 |
/* B 1.2.2 - Character Strings */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2086 |
/*******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2087 |
/* Transform the tokens given us by flex into leafs */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2088 |
single_byte_character_string: single_byte_character_string_token |
68 | 2089 |
{$$ = new single_byte_character_string_c($1, locloc(@$));}; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2090 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2091 |
double_byte_character_string: double_byte_character_string_token |
68 | 2092 |
{$$ = new double_byte_character_string_c($1, locloc(@$));}; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2093 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2094 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2095 |
character_string: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2096 |
single_byte_character_string |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2097 |
| double_byte_character_string |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2098 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2099 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2100 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2101 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2102 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2103 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2104 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2105 |
/* B 1.2.3 - Time Literals */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2106 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2107 |
time_literal: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2108 |
time_of_day |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2109 |
| date |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2110 |
| date_and_time |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2111 |
| duration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2112 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2113 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2114 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2115 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2116 |
/* B 1.2.3.1 - Duration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2117 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2118 |
duration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2119 |
/* (T | TIME) '#' ['-'] interval */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2120 |
/* NOTE: since TIME is also a data type, it is a keyword |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2121 |
* and may therefore be handled by a token. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2122 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2123 |
* Unfortunately T is not a data type, and therefore |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2124 |
* not a keyword. This means that we may have variables named T! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2125 |
* Flex cannot return the token TIME when it comes across a single T! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2126 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2127 |
* We therefore have flex returning the token T_SHARP |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2128 |
* when it comes across 'T#' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2129 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2130 |
TIME '#' interval |
257 | 2131 |
{$$ = new duration_c(new time_type_name_c(locloc(@1)), NULL, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2132 |
| TIME '#' '-' interval |
257 | 2133 |
{$$ = new duration_c(new time_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $4, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2134 |
| T_SHARP interval |
257 | 2135 |
{$$ = new duration_c(new time_type_name_c(locloc(@1)), NULL, $2, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2136 |
| T_SHARP '-' interval |
257 | 2137 |
{$$ = new duration_c(new time_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $3, locloc(@$));} |
2138 |
| SAFETIME '#' interval |
|
2139 |
{$$ = new duration_c(new safetime_type_name_c(locloc(@1)), NULL, $3, locloc(@$));} |
|
2140 |
| SAFETIME '#' '-' interval |
|
2141 |
{$$ = new duration_c(new safetime_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $4, locloc(@$));} |
|
131 | 2142 |
/* ERROR_CHECK_BEGIN */ |
2143 |
| TIME interval |
|
136 | 2144 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME' and interval in duration."); yynerrs++;} |
131 | 2145 |
| TIME '-' interval |
136 | 2146 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME' and interval in duration."); yynerrs++;} |
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2147 |
| TIME '#' erroneous_interval_token |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2148 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value for duration."); yynerrs++;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2149 |
| T_SHARP erroneous_interval_token |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2150 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid value for duration."); yynerrs++;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2151 |
| TIME '#' '-' erroneous_interval_token |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2152 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value for duration."); yynerrs++;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2153 |
| T_SHARP '-' erroneous_interval_token |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2154 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid value for duration."); yynerrs++;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2155 |
/* ERROR_CHECK_END */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2156 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2157 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2158 |
fixed_point: |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2159 |
integer |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2160 |
| fixed_point_token {$$ = new fixed_point_c($1, locloc(@$));}; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2161 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2162 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2163 |
interval: |
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2164 |
days hours minutes seconds milliseconds end_interval_token |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2165 |
{$$ = new interval_c($1, $2, $3, $4, $5, locloc(@$));}; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2166 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2167 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2168 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2169 |
days: /* fixed_point ('d') */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2170 |
/* empty */ {$$ = NULL;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2171 |
| fixed_point_d_token {$$ = new fixed_point_c($1, locloc(@$));}; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2172 |
| integer_d_token {$$ = new integer_c($1, locloc(@$));}; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2173 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2174 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2175 |
hours: /* fixed_point ('h') */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2176 |
/* empty */ {$$ = NULL;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2177 |
| fixed_point_h_token {$$ = new fixed_point_c($1, locloc(@$));}; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2178 |
| integer_h_token {$$ = new integer_c($1, locloc(@$));}; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2179 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2180 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2181 |
minutes: /* fixed_point ('m') */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2182 |
/* empty */ {$$ = NULL;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2183 |
| fixed_point_m_token {$$ = new fixed_point_c($1, locloc(@$));}; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2184 |
| integer_m_token {$$ = new integer_c($1, locloc(@$));}; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2185 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2186 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2187 |
seconds: /* fixed_point ('s') */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2188 |
/* empty */ {$$ = NULL;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2189 |
| fixed_point_s_token {$$ = new fixed_point_c($1, locloc(@$));}; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2190 |
| integer_s_token {$$ = new integer_c($1, locloc(@$));}; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2191 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2192 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2193 |
milliseconds: /* fixed_point ('ms') */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2194 |
/* empty */ {$$ = NULL;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2195 |
| fixed_point_ms_token {$$ = new fixed_point_c($1, locloc(@$));}; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2196 |
| integer_ms_token {$$ = new integer_c($1, locloc(@$));}; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2197 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2198 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2199 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2200 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2201 |
/************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2202 |
/* B 1.2.3.2 - Time of day and Date */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2203 |
/************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2204 |
time_of_day: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2205 |
TIME_OF_DAY '#' daytime |
257 | 2206 |
{$$ = new time_of_day_c(new tod_type_name_c(locloc(@1)), $3, locloc(@$));} |
2207 |
| SAFETIME_OF_DAY '#' daytime |
|
2208 |
{$$ = new time_of_day_c(new safetod_type_name_c(locloc(@1)), $3, locloc(@$));} |
|
131 | 2209 |
/* ERROR_CHECK_BEGIN */ |
2210 |
| TIME_OF_DAY daytime |
|
136 | 2211 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME_OF_DAY' and daytime in time of day."); yynerrs++;} |
131 | 2212 |
| TIME_OF_DAY '#' error |
2213 |
{$$ = NULL; |
|
136 | 2214 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for time of day.");} |
2215 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for time of day."); yyclearin;} |
|
131 | 2216 |
yyerrok; |
2217 |
} |
|
2218 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2219 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2220 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2221 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2222 |
daytime: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2223 |
day_hour ':' day_minute ':' day_second |
68 | 2224 |
{$$ = new daytime_c($1, $3, $5, locloc(@$));} |
131 | 2225 |
/* ERROR_CHECK_BEGIN */ |
136 | 2226 |
| ':' day_minute ':' day_second |
2227 |
{$$ = NULL; print_err_msg(locf(@1), locl(@4), "no value defined for hours in daytime."); yynerrs++;} |
|
2228 |
| error ':' day_minute ':' day_second |
|
2229 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid value defined for hours in daytime."); yyerrok;} |
|
131 | 2230 |
| day_hour day_minute ':' day_second |
136 | 2231 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between hours and minutes in daytime."); yynerrs++;} |
131 | 2232 |
| day_hour ':' ':' day_second |
136 | 2233 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for minutes in daytime."); yynerrs++;} |
131 | 2234 |
| day_hour ':' error ':' day_second |
136 | 2235 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value defined for minutes in daytime."); yyerrok;} |
131 | 2236 |
| day_hour ':' day_minute day_second |
136 | 2237 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "':' missing between minutes and seconds in daytime."); yynerrs++;} |
131 | 2238 |
| day_hour ':' day_minute ':' error |
2239 |
{$$ = NULL; |
|
136 | 2240 |
if (is_current_syntax_token()) {print_err_msg(locl(@4), locf(@5), "no value defined for seconds in daytime.");} |
2241 |
else {print_err_msg(locf(@5), locl(@5), "invalid value for seconds in daytime."); yyclearin;} |
|
131 | 2242 |
yyerrok; |
2243 |
} |
|
2244 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2245 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2246 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2247 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2248 |
day_hour: integer; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2249 |
day_minute: integer; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2250 |
day_second: fixed_point; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2251 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2252 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2253 |
date: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2254 |
DATE '#' date_literal |
257 | 2255 |
{$$ = new date_c(new date_type_name_c(locloc(@1)), $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2256 |
| D_SHARP date_literal |
257 | 2257 |
{$$ = new date_c(new date_type_name_c(locloc(@1)), $2, locloc(@$));} |
2258 |
| SAFEDATE '#' date_literal |
|
2259 |
{$$ = new date_c(new safedate_type_name_c(locloc(@1)), $3, locloc(@$));} |
|
131 | 2260 |
/* ERROR_CHECK_BEGIN */ |
2261 |
| DATE date_literal |
|
136 | 2262 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE' and date literal in date."); yynerrs++;} |
131 | 2263 |
| DATE '#' error |
2264 |
{$$ = NULL; |
|
136 | 2265 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for date.");} |
2266 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for date."); yyclearin;} |
|
131 | 2267 |
yyerrok; |
2268 |
} |
|
2269 |
| D_SHARP error |
|
136 | 2270 |
{$$ = NULL; |
2271 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no value defined for date.");} |
|
2272 |
else {print_err_msg(locf(@2), locl(@2), "invalid value for date."); yyclearin;} |
|
131 | 2273 |
yyerrok; |
2274 |
} |
|
2275 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2276 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2277 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2278 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2279 |
date_literal: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2280 |
year '-' month '-' day |
68 | 2281 |
{$$ = new date_literal_c($1, $3, $5, locloc(@$));} |
131 | 2282 |
/* ERROR_CHECK_BEGIN */ |
136 | 2283 |
| '-' month '-' day |
2284 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no value defined for year in date literal."); yynerrs++;} |
|
131 | 2285 |
| year month '-' day |
136 | 2286 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'-' missing between year and month in date literal."); yynerrs++;} |
2287 |
| year '-' '-' day |
|
2288 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for month in date literal."); yynerrs++;} |
|
2289 |
| year '-' error '-' day |
|
2290 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value defined for month in date literal."); yyerrok;} |
|
2291 |
| year '-' month day |
|
2292 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "'-' missing between month and day in date literal."); yynerrs++;} |
|
2293 |
| year '-' month '-' error |
|
131 | 2294 |
{$$ = NULL; |
136 | 2295 |
if (is_current_syntax_token()) {print_err_msg(locl(@4), locf(@5), "no value defined for day in date literal.");} |
2296 |
else {print_err_msg(locf(@5), locl(@5), "invalid value for day in date literal."); yyclearin;} |
|
131 | 2297 |
yyerrok; |
2298 |
} |
|
2299 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2300 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2301 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2302 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2303 |
year: integer; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2304 |
month: integer; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2305 |
day: integer; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2306 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2307 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2308 |
date_and_time: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2309 |
DATE_AND_TIME '#' date_literal '-' daytime |
257 | 2310 |
{$$ = new date_and_time_c(new dt_type_name_c(locloc(@1)), $3, $5, locloc(@$));} |
2311 |
| SAFEDATE_AND_TIME '#' date_literal '-' daytime |
|
2312 |
{$$ = new date_and_time_c(new safedt_type_name_c(locloc(@1)), $3, $5, locloc(@$));} |
|
131 | 2313 |
/* ERROR_CHECK_BEGIN */ |
2314 |
| DATE_AND_TIME date_literal '-' daytime |
|
136 | 2315 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE_AND_TIME' and date literal in date and time."); yynerrs++;} |
131 | 2316 |
| DATE_AND_TIME '#' '-' daytime |
136 | 2317 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for date literal in date and time."); yynerrs++;} |
131 | 2318 |
| DATE_AND_TIME '#' error '-' daytime |
136 | 2319 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value for date literal in date and time."); yyerrok;} |
131 | 2320 |
| DATE_AND_TIME '#' date_literal daytime |
136 | 2321 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "'-' missing between date literal and daytime in date and time."); yynerrs++;} |
131 | 2322 |
| DATE_AND_TIME '#' date_literal '-' error |
2323 |
{$$ = NULL; |
|
136 | 2324 |
if (is_current_syntax_token()) {print_err_msg(locl(@4), locf(@5), "no value defined for daytime in date and time.");} |
2325 |
else {print_err_msg(locf(@5), locl(@5), "invalid value for daytime in date and time."); yyclearin;} |
|
131 | 2326 |
yyerrok; |
2327 |
} |
|
2328 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2329 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2330 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2331 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2332 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2333 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2334 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2335 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2336 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2337 |
/* B 1.3 - Data Types */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2338 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2339 |
/* Strangely, the following symbol does seem to be required! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2340 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2341 |
data_type_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2342 |
non_generic_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2343 |
| generic_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2344 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2345 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2346 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2347 |
non_generic_type_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2348 |
elementary_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2349 |
| derived_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2350 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2351 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2352 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2353 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2354 |
/***********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2355 |
/* B 1.3.1 - Elementary Data Types */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2356 |
/***********************************/ |
257 | 2357 |
/******************************************************/ |
2358 |
/* SAFExxxx Symbols defined in */ |
|
2359 |
/* "Safety Software Technical Specification, */ |
|
2360 |
/* Part 1: Concepts and Function Blocks, */ |
|
2361 |
/* Version 1.0 – Official Release" */ |
|
2362 |
/* by PLCopen - Technical Committee 5 - 2006-01-31 */ |
|
2363 |
/******************************************************/ |
|
2364 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2365 |
elementary_type_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2366 |
numeric_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2367 |
| date_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2368 |
| bit_string_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2369 |
| elementary_string_type_name |
68 | 2370 |
| TIME {$$ = new time_type_name_c(locloc(@$));} |
2371 |
| BOOL {$$ = new bool_type_name_c(locloc(@$));} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2372 |
/* NOTE: see note under the B 1.2.1 section of token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2373 |
* and grouping type definition for reason why BOOL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2374 |
* was added to this definition. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2375 |
*/ |
257 | 2376 |
| SAFETIME {$$ = new safetime_type_name_c(locloc(@$));} |
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
2377 |
| SAFEBOOL {$$ = new safebool_type_name_c(locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2378 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2379 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2380 |
numeric_type_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2381 |
integer_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2382 |
| real_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2383 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2384 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2385 |
integer_type_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2386 |
signed_integer_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2387 |
| unsigned_integer_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2388 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2389 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2390 |
signed_integer_type_name: |
257 | 2391 |
SINT {$$ = new sint_type_name_c(locloc(@$));} |
2392 |
| INT {$$ = new int_type_name_c(locloc(@$));} |
|
2393 |
| DINT {$$ = new dint_type_name_c(locloc(@$));} |
|
2394 |
| LINT {$$ = new lint_type_name_c(locloc(@$));} |
|
2395 |
| SAFESINT {$$ = new safesint_type_name_c(locloc(@$));} |
|
2396 |
| SAFEINT {$$ = new safeint_type_name_c(locloc(@$));} |
|
2397 |
| SAFEDINT {$$ = new safedint_type_name_c(locloc(@$));} |
|
2398 |
| SAFELINT {$$ = new safelint_type_name_c(locloc(@$));} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2399 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2400 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2401 |
unsigned_integer_type_name: |
257 | 2402 |
USINT {$$ = new usint_type_name_c(locloc(@$));} |
2403 |
| UINT {$$ = new uint_type_name_c(locloc(@$));} |
|
2404 |
| UDINT {$$ = new udint_type_name_c(locloc(@$));} |
|
2405 |
| ULINT {$$ = new ulint_type_name_c(locloc(@$));} |
|
2406 |
| SAFEUSINT {$$ = new safeusint_type_name_c(locloc(@$));} |
|
2407 |
| SAFEUINT {$$ = new safeuint_type_name_c(locloc(@$));} |
|
2408 |
| SAFEUDINT {$$ = new safeudint_type_name_c(locloc(@$));} |
|
2409 |
| SAFEULINT {$$ = new safeulint_type_name_c(locloc(@$));} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2410 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2411 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2412 |
real_type_name: |
257 | 2413 |
REAL {$$ = new real_type_name_c(locloc(@$));} |
2414 |
| LREAL {$$ = new lreal_type_name_c(locloc(@$));} |
|
2415 |
| SAFEREAL {$$ = new safereal_type_name_c(locloc(@$));} |
|
2416 |
| SAFELREAL {$$ = new safelreal_type_name_c(locloc(@$));} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2417 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2418 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2419 |
date_type_name: |
257 | 2420 |
DATE {$$ = new date_type_name_c(locloc(@$));} |
2421 |
| TIME_OF_DAY {$$ = new tod_type_name_c(locloc(@$));} |
|
2422 |
| TOD {$$ = new tod_type_name_c(locloc(@$));} |
|
2423 |
| DATE_AND_TIME {$$ = new dt_type_name_c(locloc(@$));} |
|
2424 |
| DT {$$ = new dt_type_name_c(locloc(@$));} |
|
2425 |
| SAFEDATE {$$ = new safedate_type_name_c(locloc(@$));} |
|
2426 |
| SAFETIME_OF_DAY {$$ = new safetod_type_name_c(locloc(@$));} |
|
2427 |
| SAFETOD {$$ = new safetod_type_name_c(locloc(@$));} |
|
2428 |
| SAFEDATE_AND_TIME {$$ = new safedt_type_name_c(locloc(@$));} |
|
2429 |
| SAFEDT {$$ = new safedt_type_name_c(locloc(@$));} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2430 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2431 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2432 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2433 |
bit_string_type_name: |
257 | 2434 |
BYTE {$$ = new byte_type_name_c(locloc(@$));} |
2435 |
| WORD {$$ = new word_type_name_c(locloc(@$));} |
|
2436 |
| DWORD {$$ = new dword_type_name_c(locloc(@$));} |
|
2437 |
| LWORD {$$ = new lword_type_name_c(locloc(@$));} |
|
2438 |
| SAFEBYTE {$$ = new safebyte_type_name_c(locloc(@$));} |
|
2439 |
| SAFEWORD {$$ = new safeword_type_name_c(locloc(@$));} |
|
2440 |
| SAFEDWORD {$$ = new safedword_type_name_c(locloc(@$));} |
|
2441 |
| SAFELWORD {$$ = new safelword_type_name_c(locloc(@$));} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2442 |
/* NOTE: see note under the B 1.2.1 section of token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2443 |
* and grouping type definition for reason why the BOOL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2444 |
* was omitted from this definition. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2445 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2446 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2447 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2448 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2449 |
/* Helper symbol to concentrate the instantiation |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2450 |
* of STRING and WSTRING into a single location. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2451 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2452 |
* These two elements show up in several other rules, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2453 |
* but we want to create the equivalent abstract syntax |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2454 |
* in a single location of this file, in order to make |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2455 |
* possible future changes easier to edit... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2456 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2457 |
elementary_string_type_name: |
68 | 2458 |
STRING {$$ = new string_type_name_c(locloc(@$));} |
2459 |
| WSTRING {$$ = new wstring_type_name_c(locloc(@$));} |
|
257 | 2460 |
| SAFESTRING {$$ = new safestring_type_name_c(locloc(@$));} |
2461 |
| SAFEWSTRING {$$ = new safewstring_type_name_c(locloc(@$));} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2462 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2463 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2464 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2465 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2466 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2467 |
/* B 1.3.2 - Generic data types */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2468 |
/********************************/ |
68 | 2469 |
/* Strangely, the following symbol does not seem to be required! */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2470 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2471 |
generic_type_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2472 |
ANY |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2473 |
| ANY_DERIVED |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2474 |
| ANY_ELEMENTARY |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2475 |
| ANY_MAGNITUDE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2476 |
| ANY_NUM |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2477 |
| ANY_REAL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2478 |
| ANY_INT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2479 |
| ANY_BIT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2480 |
| ANY_STRING |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2481 |
| ANY_DATE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2482 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2483 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2484 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2485 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2486 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2487 |
/* B 1.3.3 - Derived data types */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2488 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2489 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2490 |
derived_type_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2491 |
single_element_type_name |
68 | 2492 |
| prev_declared_array_type_name |
2493 |
| prev_declared_structure_type_name |
|
2494 |
| prev_declared_string_type_name |
|
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
2495 |
| prev_declared_ref_type_name /* as defined in IEC 61131-3 v3 */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2496 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2497 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2498 |
single_element_type_name: |
68 | 2499 |
prev_declared_simple_type_name |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2500 |
/* Include the following if arrays of function blocks are to be allowed! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2501 |
* Since the standard does not allow them, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2502 |
* we leave it commented out for the time being... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2503 |
*/ |
68 | 2504 |
//| prev_declared_derived_function_block_name |
2505 |
| prev_declared_subrange_type_name |
|
2506 |
| prev_declared_enumerated_type_name |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2507 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2508 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2509 |
/* NOTE: in order to remove a reduce/reduce conflict, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2510 |
* all occurences of simple_type_name, etc... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2511 |
* have been replaced with identifier! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2512 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2513 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2514 |
simple_type_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2515 |
subrange_type_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2516 |
enumerated_type_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2517 |
array_type_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2518 |
structure_type_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2519 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2520 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2521 |
data_type_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2522 |
TYPE type_declaration_list END_TYPE |
758
1972c31c844d
Fix flag to enable conversion functions.
Manuele Conti <conti.ma@alice.it>
parents:
756
diff
changeset
|
2523 |
{$$ = new data_type_declaration_c($2, locloc(@$)); if (conversion_functions_) include_string((create_enumtype_conversion_functions_c::get_declaration($$)).c_str());} |
131 | 2524 |
/* ERROR_CHECK_BEGIN */ |
2525 |
| TYPE END_TYPE |
|
136 | 2526 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no data type declared in data type(s) declaration."); yynerrs++;} |
131 | 2527 |
| TYPE error type_declaration_list END_TYPE |
136 | 2528 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'TYPE' in data type(s) declaration."); yyerrok;} |
2529 |
| TYPE type_declaration_list error END_OF_INPUT |
|
2530 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed data type(s) declaration."); yyerrok;} |
|
131 | 2531 |
| TYPE error END_TYPE |
136 | 2532 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in data type(s) declaration."); yyerrok;} |
131 | 2533 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2534 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2535 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2536 |
/* helper symbol for data_type_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2537 |
type_declaration_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2538 |
type_declaration ';' |
68 | 2539 |
{$$ = new type_declaration_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2540 |
| type_declaration_list type_declaration ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2541 |
{$$ = $1; $$->add_element($2);} |
131 | 2542 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
2543 |
| error ';' |
136 | 2544 |
{$$ = new type_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid data type declaration."); yyerrok;} |
131 | 2545 |
| type_declaration error |
136 | 2546 |
{$$ = new type_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of data type declaration."); yyerrok;} |
131 | 2547 |
| type_declaration_list type_declaration error |
136 | 2548 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of data type declaration."); yyerrok;} |
133 | 2549 |
| type_declaration_list error ';' |
136 | 2550 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid data type declaration."); yyerrok;} |
131 | 2551 |
| type_declaration_list ';' |
136 | 2552 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after data type declaration."); yynerrs++;} |
131 | 2553 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2554 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2555 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2556 |
type_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2557 |
single_element_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2558 |
| array_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2559 |
| structure_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2560 |
| string_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2561 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2562 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2563 |
single_element_type_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2564 |
simple_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2565 |
| subrange_type_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2566 |
| enumerated_type_declaration |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
2567 |
| ref_type_decl /* defined in IEC 61131-3 v3 */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2568 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2569 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2570 |
simple_type_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2571 |
/* simple_type_name ':' simple_spec_init */ |
734
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2572 |
/* To understand why simple_spec_init was brocken up into its consituent components in the following rules, please see note in the definition of 'enumerated_type_declaration'. */ |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2573 |
identifier ':' simple_specification {library_element_symtable.insert($1, prev_declared_simple_type_name_token);} |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2574 |
{$$ = new simple_type_declaration_c($1, $3, locloc(@$));} |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2575 |
| identifier ':' elementary_type_name {library_element_symtable.insert($1, prev_declared_simple_type_name_token);} ASSIGN constant |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2576 |
{$$ = new simple_type_declaration_c($1, new simple_spec_init_c($3, $6, locf(@3), locl(@6)), locloc(@$));} |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2577 |
| identifier ':' prev_declared_simple_type_name {library_element_symtable.insert($1, prev_declared_simple_type_name_token);} ASSIGN constant |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2578 |
{$$ = new simple_type_declaration_c($1, new simple_spec_init_c($3, $6, locf(@3), locl(@6)), locloc(@$));} |
131 | 2579 |
/* ERROR_CHECK_BEGIN */ |
136 | 2580 |
| error ':' simple_spec_init |
2581 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid name defined for data type declaration.");yyerrok;} |
|
131 | 2582 |
| identifier simple_spec_init |
136 | 2583 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in simple type declaration."); yynerrs++;} |
131 | 2584 |
| identifier ':' error |
2585 |
{$$ = NULL; |
|
136 | 2586 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in data type declaration.");} |
2587 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in data type declaration."); yyclearin;} |
|
131 | 2588 |
yyerrok; |
2589 |
} |
|
2590 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2591 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2592 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2593 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2594 |
simple_spec_init: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2595 |
simple_specification |
68 | 2596 |
/* The following commented line was changed to the |
2597 |
* next two lines so that we wouldn't |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2598 |
* have the first element of a simple_spec_init_c() |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2599 |
* pointing to another simple_spec_init_c! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2600 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2601 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2602 |
| simple_specification ASSIGN constant |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2603 |
{$$ = new simple_spec_init_c($1, $3);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2604 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2605 |
| elementary_type_name ASSIGN constant |
68 | 2606 |
{$$ = new simple_spec_init_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2607 |
| prev_declared_simple_type_name ASSIGN constant |
68 | 2608 |
{$$ = new simple_spec_init_c($1, $3, locloc(@$));} |
131 | 2609 |
/* ERROR_CHECK_BEGIN */ |
2610 |
| elementary_type_name constant |
|
136 | 2611 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in specification with initialization."); yynerrs++;} |
2612 |
| prev_declared_simple_type_name constant |
|
2613 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in specification with initialization."); yynerrs++;} |
|
2614 |
| elementary_type_name ASSIGN error |
|
131 | 2615 |
{$$ = NULL; |
136 | 2616 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in specification with initialization.");} |
2617 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in specification with initialization."); yyclearin;} |
|
2618 |
yyerrok; |
|
2619 |
} |
|
2620 |
| prev_declared_simple_type_name ASSIGN error |
|
131 | 2621 |
{$$ = NULL; |
136 | 2622 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in specification with initialization.");} |
2623 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in specification with initialization."); yyclearin;} |
|
2624 |
yyerrok; |
|
131 | 2625 |
} |
2626 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2627 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2628 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2629 |
/* When converting to C/C++, we need to know whether |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2630 |
* the elementary_type_name is being used in a variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2631 |
* declaration or elsewhere (ex. declaration of a derived |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2632 |
* type), so the abstract syntax has the elementary_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2633 |
* wrapped inside a simple_spec_init_c. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2634 |
* The exact same thing occurs with prev_declared_simple_type_name. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2635 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2636 |
* This is why in the definition of simple_spec_init, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2637 |
* simple_specification was brocken up into its |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2638 |
* constituent components... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2639 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2640 |
simple_specification: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2641 |
// elementary_type_name | simple_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2642 |
elementary_type_name |
68 | 2643 |
{$$ = new simple_spec_init_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2644 |
| prev_declared_simple_type_name |
68 | 2645 |
{$$ = new simple_spec_init_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2646 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2647 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2648 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2649 |
subrange_type_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2650 |
/* subrange_type_name ':' subrange_spec_init */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2651 |
identifier ':' subrange_spec_init |
68 | 2652 |
{$$ = new subrange_type_declaration_c($1, $3, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2653 |
library_element_symtable.insert($1, prev_declared_subrange_type_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2654 |
} |
131 | 2655 |
/* ERROR_CHECK_BEGIN */ |
136 | 2656 |
| error ':' subrange_spec_init |
2657 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid name defined for subrange type declaration."); yyerrok;} |
|
131 | 2658 |
| identifier subrange_spec_init |
136 | 2659 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in subrange type declaration."); yynerrs++;} |
131 | 2660 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2661 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2662 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2663 |
subrange_spec_init: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2664 |
subrange_specification |
68 | 2665 |
{$$ = new subrange_spec_init_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2666 |
| subrange_specification ASSIGN signed_integer |
68 | 2667 |
{$$ = new subrange_spec_init_c($1, $3, locloc(@$));} |
131 | 2668 |
/* ERROR_CHECK_BEGIN */ |
2669 |
| subrange_specification signed_integer |
|
136 | 2670 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in subrange specification with initialization."); yynerrs++;} |
2671 |
| subrange_specification ASSIGN error |
|
131 | 2672 |
{$$ = NULL; |
136 | 2673 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in subrange specification with initialization.");} |
2674 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in subrange specification with initialization."); yyclearin;} |
|
2675 |
yyerrok; |
|
131 | 2676 |
} |
2677 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2678 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2679 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2680 |
subrange_specification: |
131 | 2681 |
integer_type_name '(' subrange ')' |
68 | 2682 |
{$$ = new subrange_specification_c($1, $3, locloc(@$));} |
2683 |
| prev_declared_subrange_type_name |
|
98 | 2684 |
{$$ = new subrange_specification_c($1, NULL, locloc(@$));} |
131 | 2685 |
/* ERROR_CHECK_BEGIN */ |
2686 |
| integer_type_name '(' ')' |
|
136 | 2687 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no subrange defined in subrange specification."); yynerrs++;} |
131 | 2688 |
| integer_type_name '(' error ')' |
136 | 2689 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid subrange defined in subrange specification."); yyerrok;} |
131 | 2690 |
| integer_type_name '(' subrange error |
136 | 2691 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after subrange defined in subrange specification."); yyerrok;} |
131 | 2692 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2693 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2694 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2695 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2696 |
subrange: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2697 |
signed_integer DOTDOT signed_integer |
68 | 2698 |
{$$ = new subrange_c($1, $3, locloc(@$));} |
131 | 2699 |
/* ERROR_CHECK_BEGIN */ |
2700 |
| signed_integer signed_integer |
|
136 | 2701 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'..' missing between bounds in subrange definition."); yynerrs++;} |
131 | 2702 |
| signed_integer DOTDOT error |
2703 |
{$$ = NULL; |
|
136 | 2704 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for upper bound in subrange definition.");} |
584 | 2705 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for upper bound in subrange definition."); yyclearin;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
2706 |
yyerrok; |
131 | 2707 |
} |
2708 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2709 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2710 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2711 |
enumerated_type_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2712 |
/* enumerated_type_name ':' enumerated_spec_init */ |
734
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2713 |
/* NOTE: The 'identifier' used for the name of the new enumerated type is inserted early into the library_element_symtable so it may be used |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2714 |
* in defining the default initial value of this type, using the fully qualified enumerated constant syntax: type_name#enum_value |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2715 |
* In other words, this allows us to correclty parse the following IEC 61131-3 code: |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2716 |
* TYPE enum_t : (x1, x2, x3) := enum_t#x3; END_TYPE |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2717 |
* ^^^^^^^ |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2718 |
* |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2719 |
* However, we can only introduce it after we are sure we are parsing an enumerated_spec. For this reason, instead of using the |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2720 |
* symbol enumerated_spec_init in this rule, we decompose it here instead! |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2721 |
* |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2722 |
* If it were not for the above, we could use the rule |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2723 |
* identifier ':' enumerated_spec_init |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2724 |
* and include the library_element_symtable.insert(...) code in the rule actions! |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2725 |
*/ |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2726 |
identifier ':' enumerated_specification {library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);} |
756
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
2727 |
{$$ = new enumerated_type_declaration_c($1, new enumerated_spec_init_c($3, NULL, locloc(@3)), locloc(@$));} |
734
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2728 |
| identifier ':' enumerated_specification {library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);} ASSIGN enumerated_value |
49853bded539
Allow use of type#value syntax when defining default initial value inside a TYPE..END_TYPE declaration.
Mario de Sousa <msousa@fe.up.pt>
parents:
690
diff
changeset
|
2729 |
{$$ = new enumerated_type_declaration_c($1, new enumerated_spec_init_c($3, $6, locf(@3), locl(@6)), locloc(@$));} |
131 | 2730 |
/* ERROR_CHECK_BEGIN */ |
136 | 2731 |
| error ':' enumerated_spec_init |
2732 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid name defined for enumerated type declaration."); yyerrok;} |
|
131 | 2733 |
| identifier enumerated_spec_init |
136 | 2734 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in enumerated type declaration."); yynerrs++;} |
131 | 2735 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2736 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2737 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2738 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2739 |
enumerated_spec_init: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2740 |
enumerated_specification |
68 | 2741 |
{$$ = new enumerated_spec_init_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2742 |
| enumerated_specification ASSIGN enumerated_value |
68 | 2743 |
{$$ = new enumerated_spec_init_c($1, $3, locloc(@$));} |
131 | 2744 |
/* ERROR_CHECK_BEGIN */ |
2745 |
| enumerated_specification enumerated_value |
|
136 | 2746 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in enumerated specification with initialization."); yynerrs++;} |
2747 |
| enumerated_specification ASSIGN error |
|
131 | 2748 |
{$$ = NULL; |
136 | 2749 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined in enumerated specification with initialization.");} |
2750 |
else {print_err_msg(locf(@3), locl(@3), "invalid value in enumerated specification with initialization."); yyclearin;} |
|
2751 |
yyerrok; |
|
131 | 2752 |
} |
2753 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2754 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2755 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2756 |
enumerated_specification: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2757 |
'(' enumerated_value_list ')' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2758 |
{$$ = $2;} |
68 | 2759 |
| prev_declared_enumerated_type_name |
131 | 2760 |
/* ERROR_CHECK_BEGIN */ |
2761 |
| '(' ')' |
|
136 | 2762 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no enumerated value list defined in enumerated specification."); yynerrs++;} |
131 | 2763 |
| '(' error ')' |
136 | 2764 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid enumerated value list defined in enumerated specification.");yyerrok;} |
131 | 2765 |
| '(' enumerated_value_list error |
136 | 2766 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of enumerated specification."); yyerrok;} |
131 | 2767 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2768 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2769 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2770 |
/* helper symbol for enumerated_specification */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2771 |
enumerated_value_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2772 |
enumerated_value |
68 | 2773 |
{$$ = new enumerated_value_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2774 |
| enumerated_value_list ',' enumerated_value |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2775 |
{$$ = $1; $$->add_element($3);} |
131 | 2776 |
/* ERROR_CHECK_BEGIN */ |
2777 |
| enumerated_value_list enumerated_value |
|
136 | 2778 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in enumerated value list.");} |
131 | 2779 |
| enumerated_value_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
2780 |
{$$ = $1; |
136 | 2781 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined in enumerated value list.");} |
2782 |
else {print_err_msg(locf(@3), locl(@3), "invalid value in enumerated value list."); yyclearin;} |
|
131 | 2783 |
yyerrok; |
2784 |
} |
|
2785 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2786 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2787 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2788 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2789 |
enumerated_value: |
85 | 2790 |
identifier |
121
9e8ce092e169
Adding support for POU struct definition in POUS.h
lbessard
parents:
118
diff
changeset
|
2791 |
{$$ = new enumerated_value_c(NULL, $1, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2792 |
| prev_declared_enumerated_type_name '#' any_identifier |
68 | 2793 |
{$$ = new enumerated_value_c($1, $3, locloc(@$));} |
131 | 2794 |
/* ERROR_CHECK_BEGIN */ |
2795 |
| prev_declared_enumerated_type_name any_identifier |
|
136 | 2796 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between enumerated type name and value in enumerated literal."); yynerrs++;} |
131 | 2797 |
| prev_declared_enumerated_type_name '#' error |
2798 |
{$$ = NULL; |
|
136 | 2799 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for enumerated literal.");} |
2800 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for enumerated literal."); yyclearin;} |
|
2801 |
yyerrok; |
|
131 | 2802 |
} |
2803 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2804 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2805 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2806 |
|
85 | 2807 |
/* |
13 | 2808 |
enumerated_value_without_identifier: |
2809 |
prev_declared_enumerated_type_name '#' any_identifier |
|
68 | 2810 |
{$$ = new enumerated_value_c($1, $3, locloc(@$));} |
13 | 2811 |
; |
85 | 2812 |
*/ |
13 | 2813 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2814 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2815 |
array_type_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2816 |
/* array_type_name ':' array_spec_init */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2817 |
identifier ':' array_spec_init |
68 | 2818 |
{$$ = new array_type_declaration_c($1, $3, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2819 |
library_element_symtable.insert($1, prev_declared_array_type_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2820 |
} |
131 | 2821 |
/* ERROR_CHECK_BEGIN */ |
2822 |
| identifier array_spec_init |
|
136 | 2823 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in array type declaration."); yynerrs++;} |
131 | 2824 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2825 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2826 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2827 |
array_spec_init: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2828 |
array_specification |
68 | 2829 |
{$$ = new array_spec_init_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2830 |
| array_specification ASSIGN array_initialization |
68 | 2831 |
{$$ = new array_spec_init_c($1, $3, locloc(@$));} |
131 | 2832 |
/* ERROR_CHECK_BEGIN */ |
2833 |
| array_specification array_initialization |
|
136 | 2834 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in array specification with initialization."); yynerrs++;} |
2835 |
| array_specification ASSIGN error |
|
131 | 2836 |
{$$ = NULL; |
136 | 2837 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in array specification with initialization.");} |
2838 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in array specification with initialization."); yyclearin;} |
|
2839 |
yyerrok; |
|
131 | 2840 |
} |
2841 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2842 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2843 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2844 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2845 |
array_specification: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2846 |
prev_declared_array_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2847 |
| ARRAY '[' array_subrange_list ']' OF non_generic_type_name |
68 | 2848 |
{$$ = new array_specification_c($3, $6, locloc(@$));} |
131 | 2849 |
/* ERROR_CHECK_BEGIN */ |
2850 |
| ARRAY array_subrange_list ']' OF non_generic_type_name |
|
136 | 2851 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'[' missing before subrange list in array specification."); yynerrs++;} |
131 | 2852 |
| ARRAY '[' ']' OF non_generic_type_name |
136 | 2853 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no subrange list defined in array specification."); yynerrs++;} |
131 | 2854 |
| ARRAY '[' error ']' OF non_generic_type_name |
136 | 2855 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid subrange list defined in array specification."); yyerrok;} |
131 | 2856 |
| ARRAY OF non_generic_type_name |
136 | 2857 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no subrange list defined in array specification."); yynerrs++;} |
131 | 2858 |
| ARRAY error OF non_generic_type_name |
136 | 2859 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid subrange list defined in array specification."); yyerrok;} |
131 | 2860 |
| ARRAY '[' array_subrange_list OF non_generic_type_name |
136 | 2861 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "']' missing after subrange list in array specification."); yynerrs++;} |
131 | 2862 |
| ARRAY '[' array_subrange_list ']' non_generic_type_name |
136 | 2863 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "'OF' missing between subrange list and item type name in array specification."); yynerrs++;} |
131 | 2864 |
| ARRAY '[' array_subrange_list ']' OF error |
2865 |
{$$ = NULL; |
|
136 | 2866 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no item data type defined in array specification.");} |
2867 |
else {print_err_msg(locf(@3), locl(@3), "invalid item data type in array specification."); yyclearin;} |
|
131 | 2868 |
yyerrok; |
2869 |
} |
|
2870 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2871 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2872 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2873 |
/* helper symbol for array_specification */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2874 |
array_subrange_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2875 |
subrange |
68 | 2876 |
{$$ = new array_subrange_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2877 |
| array_subrange_list ',' subrange |
98 | 2878 |
{$$ = $1; $$->add_element($3);} |
131 | 2879 |
/* ERROR_CHECK_BEGIN */ |
2880 |
| array_subrange_list subrange |
|
136 | 2881 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in subrange list."); yynerrs++;} |
131 | 2882 |
| array_subrange_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
2883 |
{$$ = $1; |
136 | 2884 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no subrange defined in subrange list.");} |
2885 |
else {print_err_msg(locf(@3), locl(@3), "invalid subrange in subrange list."); yyclearin;} |
|
131 | 2886 |
yyerrok; |
2887 |
} |
|
2888 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2889 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2890 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2891 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2892 |
array_initialization: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2893 |
'[' array_initial_elements_list ']' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2894 |
{$$ = $2;} |
131 | 2895 |
/* ERROR_CHECK_BEGIN */ |
2896 |
| '[' ']' |
|
136 | 2897 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no initial values list defined in array initialization."); yynerrs++;} |
131 | 2898 |
| '[' error ']' |
136 | 2899 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid initial values list defined in array initialization."); yyerrok;} |
131 | 2900 |
| '[' array_initial_elements_list error |
136 | 2901 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "']' missing at the end of array initialization."); yyerrok;} |
131 | 2902 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2903 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2904 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2905 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2906 |
/* helper symbol for array_initialization */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2907 |
array_initial_elements_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2908 |
array_initial_elements |
68 | 2909 |
{$$ = new array_initial_elements_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2910 |
| array_initial_elements_list ',' array_initial_elements |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2911 |
{$$ = $1; $$->add_element($3);} |
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2912 |
/* ERROR_CHECK_BEGIN */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2913 |
/* The following error checking rules have been commented out. Why? Was it a typo? |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2914 |
* Lets keep them commented out for now... |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2915 |
*/ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2916 |
/* |
131 | 2917 |
| array_initial_elements_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
2918 |
{$$ = $1; |
136 | 2919 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no array initial value in array initial values list.");} |
2920 |
else {print_err_msg(locf(@3), locl(@3), "invalid array initial value in array initial values list."); yyclearin;} |
|
131 | 2921 |
yyerrok; |
2922 |
} |
|
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2923 |
*/ |
131 | 2924 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2925 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2926 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2927 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2928 |
array_initial_elements: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2929 |
array_initial_element |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2930 |
| integer '(' ')' |
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
354
diff
changeset
|
2931 |
{$$ = new array_initial_elements_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2932 |
| integer '(' array_initial_element ')' |
68 | 2933 |
{$$ = new array_initial_elements_c($1, $3, locloc(@$));} |
136 | 2934 |
/* ERROR_CHECK_BEGIN */ |
131 | 2935 |
| integer '(' error ')' |
136 | 2936 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid array initial value in array initial values list."); yyerrok;} |
131 | 2937 |
| integer '(' array_initial_element error |
136 | 2938 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of array initial value in array initial values list."); yyerrok;} |
131 | 2939 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2940 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2941 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2942 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2943 |
array_initial_element: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2944 |
constant |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2945 |
| enumerated_value |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2946 |
| structure_initialization |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2947 |
| array_initialization |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2948 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2949 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2950 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2951 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2952 |
structure_type_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2953 |
/* structure_type_name ':' structure_specification */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2954 |
identifier ':' structure_specification |
68 | 2955 |
{$$ = new structure_type_declaration_c($1, $3, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2956 |
library_element_symtable.insert($1, prev_declared_structure_type_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2957 |
} |
131 | 2958 |
/* ERROR_CHECK_BEGIN */ |
2959 |
| identifier structure_specification |
|
136 | 2960 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in structure type declaration."); yynerrs++;} |
131 | 2961 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2962 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2963 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2964 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2965 |
structure_specification: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2966 |
structure_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2967 |
| initialized_structure |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2968 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2969 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2970 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2971 |
initialized_structure: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2972 |
prev_declared_structure_type_name |
68 | 2973 |
{$$ = new initialized_structure_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2974 |
| prev_declared_structure_type_name ASSIGN structure_initialization |
68 | 2975 |
{$$ = new initialized_structure_c($1, $3, locloc(@$));} |
131 | 2976 |
/* ERROR_CHECK_BEGIN */ |
2977 |
| prev_declared_structure_type_name structure_initialization |
|
136 | 2978 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in structure specification with initialization."); yynerrs++;} |
2979 |
| prev_declared_structure_type_name ASSIGN error |
|
131 | 2980 |
{$$ = NULL; |
136 | 2981 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined in structure specification with initialization.");} |
2982 |
else {print_err_msg(locf(@3), locl(@3), "invalid value in structure specification with initialization."); yyclearin;} |
|
2983 |
yyerrok; |
|
131 | 2984 |
} |
2985 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2986 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2987 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2988 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2989 |
structure_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2990 |
STRUCT structure_element_declaration_list END_STRUCT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2991 |
{$$ = $2;} |
131 | 2992 |
/* ERROR_CHECK_BEGIN */ |
2993 |
| STRUCT END_STRUCT |
|
136 | 2994 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no structure element declared in structure type declaration."); yynerrs++;} |
131 | 2995 |
| STRUCT error structure_element_declaration_list END_STRUCT |
136 | 2996 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'STRUCT' in structure type declaration."); yyerrok;} |
2997 |
| STRUCT structure_element_declaration_list error END_OF_INPUT |
|
2998 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed structure type declaration."); yyerrok;} |
|
131 | 2999 |
| STRUCT error END_STRUCT |
136 | 3000 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in structure type declaration."); yyerrok;} |
131 | 3001 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3002 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3003 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3004 |
/* helper symbol for structure_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3005 |
structure_element_declaration_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3006 |
structure_element_declaration ';' |
68 | 3007 |
{$$ = new structure_element_declaration_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3008 |
| structure_element_declaration_list structure_element_declaration ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3009 |
{$$ = $1; $$->add_element($2);} |
131 | 3010 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3011 |
| error ';' |
136 | 3012 |
{$$ = new structure_element_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid structure element declaration."); yyerrok;} |
131 | 3013 |
| structure_element_declaration error |
136 | 3014 |
{$$ = new structure_element_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of structure element declaration."); yyerrok;} |
131 | 3015 |
| structure_element_declaration_list structure_element_declaration error |
136 | 3016 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of structure element declaration."); yyerrok;} |
133 | 3017 |
| structure_element_declaration_list error ';' |
136 | 3018 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid structure element declaration."); yyerrok;} |
131 | 3019 |
| structure_element_declaration_list ';' |
136 | 3020 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after structure element declaration."); yynerrs++;} |
131 | 3021 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3022 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3023 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3024 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3025 |
structure_element_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3026 |
structure_element_name ':' simple_spec_init |
68 | 3027 |
{$$ = new structure_element_declaration_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3028 |
| structure_element_name ':' subrange_spec_init |
68 | 3029 |
{$$ = new structure_element_declaration_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3030 |
| structure_element_name ':' enumerated_spec_init |
68 | 3031 |
{$$ = new structure_element_declaration_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3032 |
| structure_element_name ':' array_spec_init |
68 | 3033 |
{$$ = new structure_element_declaration_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3034 |
| structure_element_name ':' initialized_structure |
68 | 3035 |
{$$ = new structure_element_declaration_c($1, $3, locloc(@$));} |
131 | 3036 |
/* ERROR_CHECK_BEGIN */ |
3037 |
| structure_element_name simple_spec_init |
|
136 | 3038 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and simple specification."); yynerrs++;} |
131 | 3039 |
| structure_element_name subrange_spec_init |
136 | 3040 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and subrange specification."); yynerrs++;} |
131 | 3041 |
| structure_element_name enumerated_spec_init |
136 | 3042 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and enumerated specification."); yynerrs++;} |
131 | 3043 |
| structure_element_name array_spec_init |
136 | 3044 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and array specification."); yynerrs++;} |
131 | 3045 |
| structure_element_name initialized_structure |
136 | 3046 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and structure specification."); yynerrs++;} |
131 | 3047 |
| structure_element_name ':' error |
3048 |
{$$ = NULL; |
|
136 | 3049 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in structure element declaration.");} |
3050 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in structure element declaration."); yyclearin;} |
|
131 | 3051 |
yyerrok; |
3052 |
} |
|
3053 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3054 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3055 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3056 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3057 |
structure_element_name: any_identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3058 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3059 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3060 |
structure_initialization: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3061 |
'(' structure_element_initialization_list ')' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3062 |
{$$ = $2;} |
131 | 3063 |
/* ERROR_CHECK_BEGIN */ |
3064 |
| '(' error ')' |
|
136 | 3065 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid structure element initialization list in structure initialization."); yyerrok;} |
131 | 3066 |
| '(' structure_element_initialization_list error |
136 | 3067 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "expecting ')' at the end of structure element initialization list in structure initialization."); yyerrok;} |
131 | 3068 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3069 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3070 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3071 |
/* helper symbol for structure_initialization */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3072 |
structure_element_initialization_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3073 |
structure_element_initialization |
68 | 3074 |
{$$ = new structure_element_initialization_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3075 |
| structure_element_initialization_list ',' structure_element_initialization |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3076 |
{$$ = $1; $$->add_element($3);} |
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3077 |
/* ERROR_CHECK_BEGIN */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3078 |
/* The following error checking rules have been commented out. Why? Was it a typo? |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3079 |
* Lets keep them commented out for now... |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3080 |
*/ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3081 |
/* |
131 | 3082 |
| structure_element_initialization_list structure_element_initialization |
136 | 3083 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in structure element initialization list in structure initialization."); yynerrs++;} |
131 | 3084 |
| structure_element_initialization_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3085 |
{$$ = $1; |
136 | 3086 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no structure element initialization defined in structure initialization.");} |
3087 |
else {print_err_msg(locf(@3), locl(@3), "invalid structure element initialization in structure initialization."); yyclearin;} |
|
131 | 3088 |
yyerrok; |
3089 |
} |
|
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3090 |
*/ |
131 | 3091 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3092 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3093 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3094 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3095 |
structure_element_initialization: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3096 |
structure_element_name ASSIGN constant |
68 | 3097 |
{$$ = new structure_element_initialization_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3098 |
| structure_element_name ASSIGN enumerated_value |
68 | 3099 |
{$$ = new structure_element_initialization_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3100 |
| structure_element_name ASSIGN array_initialization |
68 | 3101 |
{$$ = new structure_element_initialization_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3102 |
| structure_element_name ASSIGN structure_initialization |
68 | 3103 |
{$$ = new structure_element_initialization_c($1, $3, locloc(@$));} |
131 | 3104 |
/* ERROR_CHECK_BEGIN */ |
3105 |
| structure_element_name constant |
|
136 | 3106 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in structure element initialization."); yynerrs++;} |
3107 |
| structure_element_name enumerated_value |
|
3108 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in enumerated structure element initialization."); yynerrs++;} |
|
3109 |
| structure_element_name array_initialization |
|
3110 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in array structure element initialization."); yynerrs++;} |
|
3111 |
| structure_element_name structure_initialization |
|
3112 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in structured structure element initialization."); yynerrs++;} |
|
3113 |
| structure_element_name ASSIGN error |
|
131 | 3114 |
{$$ = NULL; |
136 | 3115 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in structured structure element initialization.");} |
3116 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in structured structure element initialization."); yyclearin;} |
|
3117 |
yyerrok; |
|
131 | 3118 |
} |
3119 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3120 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3121 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3122 |
/* NOTE: in order to remove a reduce/reduce conflict, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3123 |
* all occurences of string_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3124 |
* have been replaced with identifier! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3125 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3126 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3127 |
string_type_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3128 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3129 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3130 |
string_type_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3131 |
/* string_type_name ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3132 |
identifier ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init |
68 | 3133 |
{$$ = new string_type_declaration_c($1, $3, $4, $5, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3134 |
library_element_symtable.insert($1, prev_declared_string_type_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3135 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3136 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3137 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3138 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3139 |
/* helper symbol for string_type_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3140 |
string_type_declaration_size: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3141 |
'[' integer ']' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3142 |
{$$ = $2;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3143 |
/* REMOVED !! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3144 |
//| /* empty */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3145 |
// {$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3146 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3147 |
/* The syntax contains a reduce/reduce conflict. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3148 |
* The optional '[' <size> ']' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3149 |
* has been changed to become mandatory to remove the conflict. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3150 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3151 |
* The conflict arises because |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3152 |
* new_str_type : STRING := "hello!" |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3153 |
* may be reduced to a string_type_declaration OR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3154 |
* a simple_type_declaration. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3155 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3156 |
* Our change forces it to be reduced to a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3157 |
* simple_type_declaration! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3158 |
* We chose this option because changing the definition |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3159 |
* of simple_spec_init would force us to change all the other |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3160 |
* rules in which it appears. The change we made has no |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3161 |
* side-effects! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3162 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3163 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3164 |
/* helper symbol for string_type_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3165 |
string_type_declaration_init: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3166 |
/* empty */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3167 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3168 |
| ASSIGN character_string |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3169 |
{$$ = $2;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3170 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3171 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3172 |
|
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3173 |
/* Taken fron IEC 61131-3 v3 |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3174 |
* // Table 14 - Reference operations |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3175 |
* Ref_Type_Decl : Ref_Type_Name ':' Ref_Spec_Init ; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3176 |
* Ref_Spec_Init : Ref_Spec ( ':=' Ref_Value )? ; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3177 |
* Ref_Spec : 'REF_TO' Non_Gen_Type_Name ; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3178 |
* Ref_Type_Name : Identifier ; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3179 |
* Ref_Name : Identifier ; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3180 |
* Ref_Value : Ref_Addr | 'NULL' ; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3181 |
* Ref_Addr : 'REF' '(' (Symbolic_Variable | FB_Name | Class_Instance_Name ) ')' ; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3182 |
* Ref_Assign : Ref_Name ':=' (Ref_Name | Ref_Deref | Ref_Value ) ; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3183 |
* Ref_Deref : 'DREF' '(' Ref_Name ')' ; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3184 |
*/ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3185 |
|
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3186 |
/* NOTE: in IEC 61131-3 v3, the formal syntax definition does not define non_generic_type_name to include FB type names. |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3187 |
* However, in section "6.3.4.10 References", example 4 includes a REF_TO a FB type! |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3188 |
* We have therefore explicitly added the "REF_TO function_block_type_name" to this rule! |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3189 |
*/ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3190 |
ref_spec: /* defined in IEC 61131-3 v3 */ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3191 |
REF_TO non_generic_type_name |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3192 |
{$$ = new ref_spec_c($2, locloc(@$));} |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3193 |
| REF_TO function_block_type_name |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3194 |
{$$ = new ref_spec_c($2, locloc(@$));} |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3195 |
/* The following line is actually not included in IEC 61131-3, but we add it anyway otherwise it will not be possible to |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3196 |
* define a REF_TO datatype as an alias to an already previously declared REF_TO datatype. |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3197 |
* For example: |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3198 |
* TYPE |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3199 |
* ref1: REF_TO INT; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3200 |
* ref2: ref1; <-- without the following rule, this would not be allowed!! |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3201 |
* END_TYPE |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3202 |
* |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3203 |
* This extra rule also makes it possible to declare variables using a previously declared REF_TO datatype |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3204 |
* For example: |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3205 |
* VAR refvar: ref1; END_VAR |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3206 |
*/ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3207 |
| prev_declared_ref_type_name |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3208 |
; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3209 |
|
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3210 |
|
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3211 |
ref_spec_init: /* defined in IEC 61131-3 v3 */ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3212 |
ref_spec /* For the moment, we do not support initialising reference data types */ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3213 |
; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3214 |
|
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3215 |
ref_type_decl: /* defined in IEC 61131-3 v3 */ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3216 |
identifier ':' ref_spec_init |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3217 |
{$$ = new ref_type_decl_c($1, $3, locloc(@$)); |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3218 |
library_element_symtable.insert($1, prev_declared_ref_type_name_token); |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3219 |
} |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3220 |
; |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3221 |
|
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3222 |
|
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3223 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3224 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3225 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3226 |
/* B 1.4 - Variables */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3227 |
/*********************/ |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3228 |
/* NOTE: The standard is erroneous in it's definition of 'variable' because: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3229 |
* - The standard considers 'ENO' as a keyword... |
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3230 |
* - ...=> which means that it may never be parsed as an 'identifier'... |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3231 |
* - ...=> and therefore may never be used as the name of a variable inside an expression. |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3232 |
* - However, a function/FB must be able to assign the ENO parameter |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3233 |
* it's value, doing it in an assignment statement, and therefore using the 'ENO' |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3234 |
* character sequence as an identifier! |
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3235 |
* The obvious solution is to also allow the ENO keyword to be |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3236 |
* used as the name of a variable. Note that this variable may be used |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3237 |
* even though it is not explicitly declared as a function/FB variable, |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3238 |
* as the standard requires us to define it implicitly in this case! |
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3239 |
* There are three ways of achieving this: |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3240 |
* (i) simply not define EN and ENO as keywords in flex (lexical analyser) |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3241 |
* and let them be considered 'identifiers'. Aditionally, add some code |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3242 |
* so that if they are not explicitly declared, we add them automatically to |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3243 |
* the declaration of each Functions and FB, where they would then be parsed |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3244 |
* as a previously_declared_variable. |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3245 |
* This approach has the advantage the EN and ENO would automatically be valid |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3246 |
* in every location where it needs to be valid, namely in the explicit declaration |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3247 |
* of these same variables, or when they are used within expressions. |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3248 |
* However, this approach has the drawback that |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3249 |
* EN and ENO could then also be used anywhere a standard identifier is allowed, |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3250 |
* including in the naming of Functions, FBs, Programs, Configurations, Resources, |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3251 |
* SFC Actions, SFC Steps, etc... |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3252 |
* This would mean that we would then have to add a lexical analysis check |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3253 |
* within the bison code (syntax analyser) to all the above constructs to make sure |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3254 |
* that the identifier being used is not EN or ENO. |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3255 |
* (ii) The other approach is to define EN and ENO as keywords / tokens in flex |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3256 |
* (lexical analyser) and then change the syntax in bison to acomodate |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3257 |
* these tokens wherever they could correctly appear. |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3258 |
* This has the drawback that we need to do some changes to the synax defintion. |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3259 |
* (iii) Yet a another option is to mix the above two methods. |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3260 |
* Define EN and ENO as tokens in flex, but change (only) the syntax for |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3261 |
* variable declaration to allow these tokens to also be used in declaring variables. |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3262 |
* From this point onwards these tokens are then considered a previously_declared_variable, |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3263 |
* since flex will first check for this before even checking for tokens. |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3264 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3265 |
* I (Mario) cuurretnly (2011) believe the cleanest method of achieving this goal |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3266 |
* is to use option (iii) |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3267 |
* However, considering that: |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3268 |
* - I have already previously implemented option (ii); |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3269 |
* - option (iii) requires that flex parse the previously_declared_variable |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3270 |
* before parsing any token. We already support this (remeber that this is |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3271 |
* used mainly to allow some IL operators as well as PRIORITY, etc. tokens |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3272 |
* to be used as identifiers, since the standard does not define them as keywords), |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3273 |
* but this part of the code in flex is often commented out as usually people do not expect |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3274 |
* us to follow the standard in the strict sense, but rather consider those |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3275 |
* tokens as keywords; |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3276 |
* considering the above, we currently carry on using option (ii). |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3277 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3278 |
variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3279 |
symbolic_variable |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
3280 |
| prev_declared_direct_variable |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3281 |
| eno_identifier |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3282 |
{$$ = new symbolic_variable_c($1, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3283 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3284 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3285 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3286 |
symbolic_variable: |
68 | 3287 |
/* NOTE: To be entirely correct, variable_name must be replacemed by |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3288 |
* prev_declared_variable_name | prev_declared_fb_name | prev_declared_global_var_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3289 |
*/ |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
3290 |
prev_declared_fb_name |
68 | 3291 |
{$$ = new symbolic_variable_c($1, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3292 |
| prev_declared_global_var_name |
68 | 3293 |
{$$ = new symbolic_variable_c($1, locloc(@$));} |
13 | 3294 |
| prev_declared_variable_name |
68 | 3295 |
{$$ = new symbolic_variable_c($1, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3296 |
| multi_element_variable |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
3297 |
/* |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
3298 |
| identifier |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
3299 |
{$$ = new symbolic_variable_c($1, locloc(@$));} |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
3300 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3301 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3302 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3303 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3304 |
/* NOTE: in section B 1.7, when configuring a program, symbolic_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3305 |
* is used. Nevertheless, during the parsing of a configuration, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3306 |
* the variables in question are out of scope, so we should |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3307 |
* be allowing any_identifier instead of prev_declared_variable_name! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3308 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3309 |
* We therefore need a new any_symbolic_variable construct that |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3310 |
* allows the use of any_identifier instead of previously declared |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3311 |
* variables, function blocks, etc... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3312 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3313 |
any_symbolic_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3314 |
// variable_name -> replaced by any_identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3315 |
any_identifier |
68 | 3316 |
{$$ = new symbolic_variable_c($1, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3317 |
| any_multi_element_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3318 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3319 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3320 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3321 |
/* for yet undeclared variable names ! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3322 |
variable_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3323 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3324 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3325 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3326 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3327 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3328 |
/********************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3329 |
/* B.1.4.1 Directly Represented Variables */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3330 |
/********************************************/ |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
3331 |
prev_declared_direct_variable: prev_declared_direct_variable_token {$$ = new direct_variable_c($1, locloc(@$));}; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3332 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3333 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3334 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3335 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3336 |
/*************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3337 |
/* B.1.4.2 Multi-element Variables */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3338 |
/*************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3339 |
multi_element_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3340 |
array_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3341 |
| structured_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3342 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3343 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3344 |
/* please see note above any_symbolic_variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3345 |
any_multi_element_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3346 |
any_array_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3347 |
| any_structured_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3348 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3349 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3350 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3351 |
array_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3352 |
subscripted_variable '[' subscript_list ']' |
68 | 3353 |
{$$ = new array_variable_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3354 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3355 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3356 |
/* please see note above any_symbolic_variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3357 |
any_array_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3358 |
any_subscripted_variable '[' subscript_list ']' |
68 | 3359 |
{$$ = new array_variable_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3360 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3361 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3362 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3363 |
subscripted_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3364 |
symbolic_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3365 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3366 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3367 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3368 |
/* please see note above any_symbolic_variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3369 |
any_subscripted_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3370 |
any_symbolic_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3371 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3372 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3373 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3374 |
subscript_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3375 |
subscript |
68 | 3376 |
{$$ = new subscript_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3377 |
| subscript_list ',' subscript |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3378 |
{$$ = $1; $$->add_element($3);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3379 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3380 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3381 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3382 |
subscript: expression; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3383 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3384 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3385 |
structured_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3386 |
record_variable '.' field_selector |
68 | 3387 |
{$$ = new structured_variable_c($1, $3, locloc(@$));} |
382
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
3388 |
| record_variable '.' il_simple_operator_clash3 |
469
9fe6c4633ed6
Fix bug in building structured variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
453
diff
changeset
|
3389 |
{$$ = new structured_variable_c($1, il_operator_c_2_identifier_c($3), locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3390 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3391 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3392 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3393 |
/* please see note above any_symbolic_variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3394 |
any_structured_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3395 |
any_record_variable '.' field_selector |
68 | 3396 |
{$$ = new structured_variable_c($1, $3, locloc(@$));} |
382
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
3397 |
| any_record_variable '.' il_simple_operator_clash3 |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
3398 |
{$$ = new structured_variable_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3399 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3400 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3401 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3402 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3403 |
record_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3404 |
symbolic_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3405 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3406 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3407 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3408 |
/* please see note above any_symbolic_variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3409 |
any_record_variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3410 |
any_symbolic_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3411 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3412 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3413 |
|
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3414 |
field_selector: |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3415 |
any_identifier |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3416 |
| eno_identifier |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3417 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3418 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3419 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3420 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3421 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3422 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3423 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3424 |
/******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3425 |
/* B 1.4.3 - Declaration & Initialisation */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3426 |
/******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3427 |
input_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3428 |
VAR_INPUT input_declaration_list END_VAR |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3429 |
{$$ = new input_declarations_c(NULL, $2, new explicit_definition_c(), locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3430 |
| VAR_INPUT RETAIN input_declaration_list END_VAR |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3431 |
{$$ = new input_declarations_c(new retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3432 |
| VAR_INPUT NON_RETAIN input_declaration_list END_VAR |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3433 |
{$$ = new input_declarations_c(new non_retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));} |
95 | 3434 |
/* ERROR_CHECK_BEGIN */ |
131 | 3435 |
| VAR_INPUT END_VAR |
136 | 3436 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in input variable(s) declaration."); yynerrs++;} |
131 | 3437 |
| VAR_INPUT RETAIN END_VAR |
136 | 3438 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive input variable(s) declaration."); yynerrs++;} |
131 | 3439 |
| VAR_INPUT NON_RETAIN END_VAR |
136 | 3440 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in non-retentive input variable(s) declaration."); yynerrs++;} |
131 | 3441 |
| VAR_INPUT error input_declaration_list END_VAR |
136 | 3442 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_INPUT' in input variable(s) declaration."); yyerrok;} |
131 | 3443 |
| VAR_INPUT RETAIN error input_declaration_list END_VAR |
136 | 3444 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive input variable(s) declaration."); yyerrok;} |
131 | 3445 |
| VAR_INPUT NON_RETAIN error input_declaration_list END_VAR |
136 | 3446 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive input variable(s) declaration."); yyerrok;} |
3447 |
| VAR_INPUT input_declaration_list error END_OF_INPUT |
|
3448 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed input variable(s) declaration."); yyerrok;} |
|
3449 |
| VAR_INPUT RETAIN input_declaration_list error END_OF_INPUT |
|
3450 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive input variable(s) declaration."); yyerrok;} |
|
3451 |
| VAR_INPUT NON_RETAIN input_declaration_list error END_OF_INPUT |
|
3452 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive input variable(s) declaration."); yyerrok;} |
|
95 | 3453 |
| VAR_INPUT error END_VAR |
136 | 3454 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in input variable(s) declaration."); yyerrok;} |
131 | 3455 |
| VAR_INPUT RETAIN error END_VAR |
136 | 3456 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive input variable(s) declaration."); yyerrok;} |
131 | 3457 |
| VAR_INPUT NON_RETAIN error END_VAR |
136 | 3458 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non-retentive input variable(s) declaration."); yyerrok;} |
95 | 3459 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3460 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3461 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3462 |
/* helper symbol for input_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3463 |
input_declaration_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3464 |
input_declaration ';' |
68 | 3465 |
{$$ = new input_declaration_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3466 |
| input_declaration_list input_declaration ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3467 |
{$$ = $1; $$->add_element($2);} |
131 | 3468 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3469 |
| error ';' |
136 | 3470 |
{$$ = new input_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid input variable(s) declaration."); yyerrok;} |
131 | 3471 |
| input_declaration error |
136 | 3472 |
{$$ = new input_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of input variable(s) declaration."); yyerrok;} |
131 | 3473 |
| input_declaration_list input_declaration error |
136 | 3474 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of input variable(s) declaration."); yyerrok;} |
133 | 3475 |
| input_declaration_list error ';' |
136 | 3476 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid input variable(s) declaration."); yyerrok;} |
131 | 3477 |
| input_declaration_list ';' |
136 | 3478 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after input variable(s) declaration."); yynerrs++;} |
131 | 3479 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3480 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3481 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3482 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3483 |
/* NOTE: The formal definition of 'input_declaration' as defined in the standard is erroneous, |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3484 |
* as it does not allow a user defined 'EN' input parameter. However, |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3485 |
* The semantic description of the languages clearly states that this is allowed. |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3486 |
* We have added the 'en_param_declaration' clause to cover for this. |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3487 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3488 |
input_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3489 |
var_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3490 |
| edge_declaration |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3491 |
| en_param_declaration |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3492 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3493 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3494 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3495 |
edge_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3496 |
var1_list ':' BOOL R_EDGE |
68 | 3497 |
{$$ = new edge_declaration_c(new raising_edge_option_c(locloc(@3)), $1, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3498 |
| var1_list ':' BOOL F_EDGE |
68 | 3499 |
{$$ = new edge_declaration_c(new falling_edge_option_c(locloc(@3)), $1, locloc(@$));} |
131 | 3500 |
/* ERROR_CHECK_BEGIN */ |
3501 |
| var1_list BOOL R_EDGE |
|
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3502 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;} |
131 | 3503 |
| var1_list BOOL F_EDGE |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3504 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;} |
131 | 3505 |
| var1_list ':' BOOL R_EDGE F_EDGE |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3506 |
{$$ = NULL; print_err_msg(locl(@5), locf(@5), "'R_EDGE' and 'F_EDGE' can't be present at the same time in edge declaration."); yynerrs++;} |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3507 |
| var1_list ':' BOOL F_EDGE R_EDGE |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3508 |
{$$ = NULL; print_err_msg(locl(@5), locf(@5), "'R_EDGE' and 'F_EDGE' can't be present at the same time in edge declaration."); yynerrs++;} |
131 | 3509 |
| var1_list ':' R_EDGE |
136 | 3510 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;} |
131 | 3511 |
| var1_list ':' F_EDGE |
136 | 3512 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;} |
131 | 3513 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3514 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3515 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3516 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3517 |
/* NOTE: The formal definition of the standard is erroneous, as it simply does not |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3518 |
* consider the EN and ENO keywords! |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3519 |
* The semantic description of the languages clearly states that these may be |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3520 |
* used in several ways. One of them is to declare an EN input parameter. |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3521 |
* We have added the 'en_param_declaration' clause to cover for this. |
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3522 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3523 |
* Please read the comment above the definition of 'variable' in section B1.4 for details. |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3524 |
*/ |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3525 |
en_param_declaration: |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3526 |
en_identifier ':' BOOL ASSIGN boolean_literal |
805
b737cfc92614
Use simple_spec_init_c inside en_param_declaration_c (will reduce need to handle it as a special case in the future).
Mario de Sousa <msousa@fe.up.pt>
parents:
761
diff
changeset
|
3527 |
{$$ = new en_param_declaration_c($1, new simple_spec_init_c(new bool_type_name_c(locloc(@3)), $5, locf(@3), locl(@5)), new explicit_definition_c(), locloc(@$));} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3528 |
| en_identifier ':' BOOL ASSIGN integer |
805
b737cfc92614
Use simple_spec_init_c inside en_param_declaration_c (will reduce need to handle it as a special case in the future).
Mario de Sousa <msousa@fe.up.pt>
parents:
761
diff
changeset
|
3529 |
{$$ = new en_param_declaration_c($1, new simple_spec_init_c(new bool_type_name_c(locloc(@3)), $5, locf(@3), locl(@5)), new explicit_definition_c(), locloc(@$));} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3530 |
/* ERROR_CHECK_BEGIN */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3531 |
| en_identifier BOOL ASSIGN boolean_literal |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3532 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in EN declaration."); yynerrs++;} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3533 |
| en_identifier BOOL ASSIGN integer |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3534 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in EN declaration."); yynerrs++;} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3535 |
| en_identifier ':' ASSIGN boolean_literal |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3536 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in EN declaration."); yynerrs++;} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3537 |
| en_identifier ':' ASSIGN integer |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3538 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in EN declaration."); yynerrs++;} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3539 |
| en_identifier ':' BOOL ASSIGN error |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3540 |
{$$ = NULL; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3541 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in EN declaration.");} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3542 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in EN declaration."); yyclearin;} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3543 |
yyerrok; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3544 |
} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3545 |
/* ERROR_CHECK_END */ |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3546 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3547 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3548 |
var_init_decl: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3549 |
var1_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3550 |
| array_var_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3551 |
| structured_var_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3552 |
| fb_name_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3553 |
| string_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3554 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3555 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3556 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3557 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3558 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3559 |
var1_init_decl: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3560 |
var1_list ':' simple_spec_init |
68 | 3561 |
{$$ = new var1_init_decl_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3562 |
| var1_list ':' subrange_spec_init |
68 | 3563 |
{$$ = new var1_init_decl_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3564 |
| var1_list ':' enumerated_spec_init |
68 | 3565 |
{$$ = new var1_init_decl_c($1, $3, locloc(@$));} |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3566 |
| var1_list ':' ref_spec_init /* defined in IEC 61131-3 v3 (REF_TO ...)*/ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3567 |
{$$ = new var1_init_decl_c($1, $3, locloc(@$));} |
131 | 3568 |
/* ERROR_CHECK_BEGIN */ |
3569 |
| var1_list simple_spec_init |
|
136 | 3570 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and simple specification."); yynerrs++;} |
131 | 3571 |
| var1_list subrange_spec_init |
136 | 3572 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and subrange specification."); yynerrs++;} |
131 | 3573 |
| var1_list enumerated_spec_init |
136 | 3574 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and enumerated specification."); yynerrs++;} |
131 | 3575 |
| var1_list ':' error |
3576 |
{$$ = NULL; |
|
136 | 3577 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in variable declaration.");} |
3578 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in variable declaration."); yyclearin;} |
|
131 | 3579 |
yyerrok; |
3580 |
} |
|
3581 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3582 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3583 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3584 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3585 |
/* NOTE: |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3586 |
* The syntax |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3587 |
* variable_name DOTDOT |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3588 |
* is an extension to the standard!!! |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3589 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3590 |
* In order to be able to handle extensible standard functions |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3591 |
* (i.e. standard functions that may have a variable number of |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3592 |
* input parameters, such as AND(word#33, word#44, word#55, word#66), |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3593 |
* we have extended the acceptable syntax to allow var_name '..' |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3594 |
* in an input variable declaration. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3595 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3596 |
* This allows us to parse the declaration of standard |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3597 |
* extensible functions and load their interface definition |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3598 |
* into the abstract syntax tree just like we do to other |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3599 |
* user defined functions. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3600 |
* This has the advantage that we can later do semantic |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3601 |
* checking of calls to functions (be it a standard or user defined |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3602 |
* function) in (almost) exactly the same way. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3603 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3604 |
* Of course, we have a flag that disables this syntax when parsing user |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3605 |
* written code, so we only allow this extra syntax while parsing the |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3606 |
* 'header' file that declares all the standard IEC 61131-3 functions. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3607 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3608 |
var1_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3609 |
variable_name |
68 | 3610 |
{$$ = new var1_list_c(locloc(@$)); $$->add_element($1); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3611 |
variable_name_symtable.insert($1, prev_declared_variable_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3612 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3613 |
| variable_name integer DOTDOT |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3614 |
{$$ = new var1_list_c(locloc(@$)); $$->add_element(new extensible_input_parameter_c($1, $2, locloc(@$))); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3615 |
variable_name_symtable.insert($1, prev_declared_variable_name_token); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3616 |
if (!allow_extensible_function_parameters) print_err_msg(locf(@1), locl(@2), "invalid syntax in variable name declaration."); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3617 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3618 |
| var1_list ',' variable_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3619 |
{$$ = $1; $$->add_element($3); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3620 |
variable_name_symtable.insert($3, prev_declared_variable_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3621 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3622 |
| var1_list ',' variable_name integer DOTDOT |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3623 |
{$$ = $1; $$->add_element(new extensible_input_parameter_c($3, $4, locloc(@$))); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3624 |
variable_name_symtable.insert($3, prev_declared_variable_name_token); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3625 |
if (!allow_extensible_function_parameters) print_err_msg(locf(@1), locl(@2), "invalid syntax in variable name declaration."); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3626 |
} |
131 | 3627 |
/* ERROR_CHECK_BEGIN */ |
3628 |
| var1_list variable_name |
|
136 | 3629 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in variable list."); yynerrs++;} |
131 | 3630 |
| var1_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3631 |
{$$ = $1; |
136 | 3632 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no variable name defined in variable declaration.");} |
3633 |
else {print_err_msg(locf(@3), locl(@3), "invalid variable name in variable declaration."); yyclearin;} |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3634 |
yyerrok; |
131 | 3635 |
} |
3636 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3637 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3638 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3639 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3640 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3641 |
array_var_init_decl: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3642 |
var1_list ':' array_spec_init |
68 | 3643 |
{$$ = new array_var_init_decl_c($1, $3, locloc(@$));} |
131 | 3644 |
/* ERROR_CHECK_BEGIN */ |
3645 |
| var1_list array_spec_init |
|
136 | 3646 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and array specification."); yynerrs++;} |
131 | 3647 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3648 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3649 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3650 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3651 |
structured_var_init_decl: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3652 |
var1_list ':' initialized_structure |
68 | 3653 |
{$$ = new structured_var_init_decl_c($1, $3, locloc(@$));} |
131 | 3654 |
/* ERROR_CHECK_BEGIN */ |
3655 |
| var1_list initialized_structure |
|
136 | 3656 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and structured specification."); yynerrs++;} |
131 | 3657 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3658 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3659 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3660 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3661 |
/* NOTE: see notes above fb_name_list and var1_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3662 |
* for reason why ':' was removed from this rule! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3663 |
* In essence, to remove a shift/reduce conflict, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3664 |
* the ':' was moved to var1_list and fb_name_list! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3665 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3666 |
fb_name_decl: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3667 |
/* fb_name_list ':' function_block_type_name */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3668 |
fb_name_list_with_colon function_block_type_name |
810
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
805
diff
changeset
|
3669 |
{$$ = new fb_name_decl_c($1, new fb_spec_init_c($2, NULL,locloc(@2)), locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3670 |
/*| fb_name_list ':' function_block_type_name ASSIGN structure_initialization */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3671 |
| fb_name_list_with_colon function_block_type_name ASSIGN structure_initialization |
810
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
805
diff
changeset
|
3672 |
{$$ = new fb_name_decl_c($1, new fb_spec_init_c($2, $4, locf(@2), locl(@4)), locloc(@$));} |
131 | 3673 |
/* ERROR_CHECK_BEGIN */ |
3674 |
| fb_name_list_with_colon ASSIGN structure_initialization |
|
136 | 3675 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block type name defined in function block declaration with initialization."); yynerrs++;} |
131 | 3676 |
| fb_name_list_with_colon function_block_type_name structure_initialization |
136 | 3677 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':=' missing in function block declaration with initialization."); yynerrs++;} |
131 | 3678 |
| fb_name_list_with_colon function_block_type_name ASSIGN error |
3679 |
{$$ = NULL; |
|
136 | 3680 |
if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no initialization defined in function block declaration.");} |
3681 |
else {print_err_msg(locf(@4), locl(@4), "invalid initialization in function block declaration."); yyclearin;} |
|
131 | 3682 |
yyerrok; |
3683 |
} |
|
3684 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3685 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3686 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3687 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3688 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3689 |
/* NOTE: In order to remove a reduce/reduce conflict between |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3690 |
* var1_list and fb_name_list, which are identical to each |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3691 |
* other, fb_name_list has been redefined to be a var1_list. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3692 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3693 |
* In order to remove a further shift/reduce conflict, var1_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3694 |
* is imediately transfomred into var1_list_with_colon |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3695 |
* (i.e. it includes the ':' following the list), which |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3696 |
* means that fb_name_list is built from a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3697 |
* var1_list_with_colon after all! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3698 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3699 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3700 |
fb_name_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3701 |
(* fb_name *) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3702 |
identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3703 |
{$$ = new fb_name_list_c($1); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3704 |
variable_name_symtable.insert($1, prev_declared_fb_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3705 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3706 |
(* | fb_name_list ',' fb_name *) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3707 |
| fb_name_list ',' identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3708 |
{$$ = $1; $$->add_element($3); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3709 |
variable_name_symtable.insert($3, prev_declared_fb_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3710 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3711 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3712 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3713 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3714 |
fb_name_list_with_colon: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3715 |
var1_list_with_colon |
68 | 3716 |
{$$ = new fb_name_list_c(locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3717 |
/* fill up the new fb_name_list_c object with the references |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3718 |
* contained in the var1_list_c object. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3719 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3720 |
FOR_EACH_ELEMENT(elem, $1, {$$->add_element(elem);}); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3721 |
delete $1; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3722 |
/* change the tokens associated with the symbols stored in |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3723 |
* the variable name symbol table from prev_declared_variable_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3724 |
* to prev_declared_fb_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3725 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3726 |
FOR_EACH_ELEMENT(elem, $$, {variable_name_symtable.set(elem, prev_declared_fb_name_token);}); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3727 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3728 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3729 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3730 |
/* helper symbol for fb_name_list_with_colon */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3731 |
var1_list_with_colon: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3732 |
var1_list ':' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3733 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3734 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3735 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3736 |
// fb_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3737 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3738 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3739 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3740 |
output_declarations: |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3741 |
VAR_OUTPUT var_output_init_decl_list END_VAR |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3742 |
{$$ = new output_declarations_c(NULL, $2, new explicit_definition_c(), locloc(@$));} |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3743 |
| VAR_OUTPUT RETAIN var_output_init_decl_list END_VAR |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3744 |
{$$ = new output_declarations_c(new retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));} |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3745 |
| VAR_OUTPUT NON_RETAIN var_output_init_decl_list END_VAR |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3746 |
{$$ = new output_declarations_c(new non_retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));} |
96 | 3747 |
/* ERROR_CHECK_BEGIN */ |
131 | 3748 |
| VAR_OUTPUT END_VAR |
136 | 3749 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in output variable(s) declaration."); yynerrs++;} |
131 | 3750 |
| VAR_OUTPUT RETAIN END_VAR |
136 | 3751 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive output variable(s) declaration."); yynerrs++;} |
131 | 3752 |
| VAR_OUTPUT NON_RETAIN END_VAR |
136 | 3753 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in non-retentive output variable(s) declaration."); yynerrs++;} |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3754 |
| VAR_OUTPUT error var_output_init_decl_list END_VAR |
136 | 3755 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_OUPUT' in output variable(s) declaration."); yyerrok;} |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3756 |
| VAR_OUTPUT RETAIN error var_output_init_decl_list END_VAR |
136 | 3757 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive output variable(s) declaration."); yyerrok;} |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3758 |
| VAR_OUTPUT NON_RETAIN error var_output_init_decl_list END_VAR |
136 | 3759 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive output variable(s) declaration."); yyerrok;} |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3760 |
| VAR_OUTPUT var_output_init_decl_list error END_OF_INPUT |
136 | 3761 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed output variable(s) declaration."); yyerrok;} |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3762 |
| VAR_OUTPUT RETAIN var_output_init_decl_list error END_OF_INPUT |
136 | 3763 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive output variable(s) declaration."); yyerrok;} |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3764 |
| VAR_OUTPUT NON_RETAIN var_output_init_decl_list error END_OF_INPUT |
136 | 3765 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive output variable(s) declaration."); yyerrok;} |
96 | 3766 |
| VAR_OUTPUT error END_VAR |
136 | 3767 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in output variable(s) declaration."); yyerrok;} |
131 | 3768 |
| VAR_OUTPUT RETAIN error END_VAR |
136 | 3769 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive output variable(s) declaration."); yyerrok;} |
131 | 3770 |
| VAR_OUTPUT NON_RETAIN error END_VAR |
136 | 3771 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non-retentive output variable(s) declaration."); yyerrok;} |
96 | 3772 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3773 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3774 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3775 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3776 |
/* NOTE: The formal definition of 'var_output_init_decl' as defined in the standard is erroneous, |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3777 |
* as it does not allow a user defined 'ENO' output parameter. However, |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3778 |
* The semantic description of the languages clearly states that this is allowed. |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3779 |
* We have added the 'eno_param_declaration' clause to cover for this. |
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3780 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3781 |
* Please read the comment above the definition of 'variable' in section B1.4 for details. |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3782 |
*/ |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3783 |
var_output_init_decl: |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3784 |
var_init_decl |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3785 |
| eno_param_declaration |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3786 |
; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3787 |
|
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3788 |
var_output_init_decl_list: |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3789 |
var_output_init_decl ';' |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3790 |
{$$ = new var_init_decl_list_c(locloc(@$)); $$->add_element($1);} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3791 |
| var_output_init_decl_list var_output_init_decl ';' |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3792 |
{$$ = $1; $$->add_element($2);} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3793 |
/* ERROR_CHECK_BEGIN */ |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3794 |
| var_output_init_decl_list var_output_init_decl error |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3795 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of variable(s) declaration."); yyerrok;} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3796 |
| var_output_init_decl_list error ';' |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3797 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid variable(s) declaration."); yyerrok;} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3798 |
/* ERROR_CHECK_END */ |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3799 |
; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3800 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3801 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3802 |
/* NOTE: The formal definition of the standard is erroneous, as it simply does not |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3803 |
* consider the EN and ENO keywords! |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3804 |
* The semantic description of the languages clearly states that these may be |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3805 |
* used in several ways. One of them is to declare an ENO output parameter. |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3806 |
* We have added the 'eno_param_declaration' clause to cover for this. |
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3807 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3808 |
* Please read the comment above the definition of 'variable' in section B1.4 for details. |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3809 |
*/ |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3810 |
eno_param_declaration: |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3811 |
eno_identifier ':' BOOL |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3812 |
/* NOTE We do _NOT_ include this variable in the previously_declared_variable symbol table! |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3813 |
* Please read the comment above the definition of 'variable' for the reason for this. |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3814 |
*/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3815 |
{$$ = new eno_param_declaration_c($1, new bool_type_name_c(locloc(@$)), new explicit_definition_c(), locloc(@$));} |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3816 |
/* ERROR_CHECK_BEGIN */ |
207 | 3817 |
| eno_identifier BOOL |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3818 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in ENO declaration."); yynerrs++;} |
207 | 3819 |
| eno_identifier ':' error |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3820 |
{$$ = NULL; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3821 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in ENO declaration.");} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3822 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in ENO declaration."); yyclearin;} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3823 |
yyerrok; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3824 |
} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3825 |
/* ERROR_CHECK_END */ |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3826 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3827 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3828 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3829 |
input_output_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3830 |
VAR_IN_OUT var_declaration_list END_VAR |
68 | 3831 |
{$$ = new input_output_declarations_c($2, locloc(@$));} |
96 | 3832 |
/* ERROR_CHECK_BEGIN */ |
131 | 3833 |
| VAR_IN_OUT END_VAR |
136 | 3834 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in in_out variable(s) declaration."); yynerrs++;} |
3835 |
| VAR_IN_OUT error var_declaration_list END_VAR |
|
3836 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_IN_OUT' in in_out variable(s) declaration."); yyerrok;} |
|
3837 |
| VAR_IN_OUT var_declaration_list error END_OF_INPUT |
|
3838 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed in_out variable(s) declaration."); yyerrok;} |
|
96 | 3839 |
| VAR_IN_OUT error END_VAR |
136 | 3840 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in in_out variable(s) declaration."); yyerrok;} |
96 | 3841 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3842 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3843 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3844 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3845 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3846 |
/* helper symbol for input_output_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3847 |
var_declaration_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3848 |
var_declaration ';' |
68 | 3849 |
{$$ = new var_declaration_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3850 |
| var_declaration_list var_declaration ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3851 |
{$$ = $1; $$->add_element($2);} |
131 | 3852 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3853 |
| error ';' |
136 | 3854 |
{$$ = new var_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid variable(s) declaration."); yyerrok;} |
131 | 3855 |
| var_declaration error |
136 | 3856 |
{$$ = new var_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of variable(s) declaration."); yyerrok;} |
131 | 3857 |
| var_declaration_list var_declaration error |
136 | 3858 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of variable(s) declaration."); yyerrok;} |
133 | 3859 |
| var_declaration_list error ';' |
136 | 3860 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid variable(s) declaration."); yyerrok;} |
131 | 3861 |
| var_declaration_list ';' |
136 | 3862 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after variable(s) declaration."); yynerrs++;} |
131 | 3863 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3864 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3865 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3866 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3867 |
var_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3868 |
temp_var_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3869 |
| fb_name_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3870 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3871 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3872 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3873 |
temp_var_decl: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3874 |
var1_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3875 |
| array_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3876 |
| structured_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3877 |
| string_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3878 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3879 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3880 |
var1_declaration: |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3881 |
var1_list ':' simple_specification |
68 | 3882 |
{$$ = new var1_init_decl_c($1, $3, locloc(@$));} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3883 |
| var1_list ':' subrange_specification |
68 | 3884 |
{$$ = new var1_init_decl_c($1, $3, locloc(@$));} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3885 |
| var1_list ':' enumerated_specification |
68 | 3886 |
{$$ = new var1_init_decl_c($1, $3, locloc(@$));} |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3887 |
| var1_list ':' ref_spec /* defined in IEC 61131-3 v3 (REF_TO ...)*/ |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
3888 |
{$$ = new var1_init_decl_c($1, $3, locloc(@$));} |
131 | 3889 |
/* ERROR_CHECK_BEGIN */ |
3890 |
| var1_list simple_specification |
|
136 | 3891 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and simple specification."); yynerrs++;} |
131 | 3892 |
| var1_list subrange_specification |
136 | 3893 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and subrange specification."); yynerrs++;} |
131 | 3894 |
| var1_list enumerated_specification |
136 | 3895 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and enumerated specification."); yynerrs++;} |
131 | 3896 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3897 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3898 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3899 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3900 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3901 |
array_var_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3902 |
var1_list ':' array_specification |
68 | 3903 |
{$$ = new array_var_declaration_c($1, $3, locloc(@$));} |
131 | 3904 |
/* ERROR_CHECK_BEGIN */ |
3905 |
| var1_list array_specification |
|
136 | 3906 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and array specification."); yynerrs++;} |
131 | 3907 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3908 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3909 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3910 |
structured_var_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3911 |
var1_list ':' prev_declared_structure_type_name |
68 | 3912 |
{$$ = new structured_var_declaration_c($1, $3, locloc(@$));} |
131 | 3913 |
/* ERROR_CHECK_BEGIN */ |
3914 |
| var1_list prev_declared_structure_type_name |
|
136 | 3915 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and structured specification."); yynerrs++;} |
131 | 3916 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3917 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3918 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3919 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3920 |
var_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3921 |
VAR var_init_decl_list END_VAR |
68 | 3922 |
{$$ = new var_declarations_c(NULL, $2, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3923 |
| VAR CONSTANT var_init_decl_list END_VAR |
68 | 3924 |
{$$ = new var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));} |
131 | 3925 |
/* ERROR_CHECK_BEGIN */ |
3926 |
| VAR END_VAR |
|
136 | 3927 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in variable(s) declaration."); yynerrs++;} |
131 | 3928 |
| VAR CONSTANT END_VAR |
136 | 3929 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in constant variable(s) declaration."); yynerrs++;} |
131 | 3930 |
| VAR error var_init_decl_list END_VAR |
136 | 3931 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "unexpected token after 'VAR' in variable(s) declaration."); yyerrok;} |
131 | 3932 |
| VAR CONSTANT error var_init_decl_list END_VAR |
136 | 3933 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant variable(s) declaration."); yyerrok;} |
3934 |
| VAR var_init_decl_list error END_OF_INPUT |
|
3935 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed variable(s) declaration."); yyerrok;} |
|
3936 |
| VAR CONSTANT var_init_decl_list error END_OF_INPUT |
|
3937 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant variable(s) declaration."); yyerrok;} |
|
131 | 3938 |
| VAR error END_VAR |
136 | 3939 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in variable(s) declaration."); yyerrok;} |
131 | 3940 |
| VAR CONSTANT error END_VAR |
136 | 3941 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant variable(s) declaration."); yyerrok;} |
131 | 3942 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3943 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3944 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3945 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3946 |
retentive_var_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3947 |
VAR RETAIN var_init_decl_list END_VAR |
68 | 3948 |
{$$ = new retentive_var_declarations_c($3, locloc(@$));} |
96 | 3949 |
/* ERROR_CHECK_BEGIN */ |
131 | 3950 |
| VAR RETAIN END_VAR |
136 | 3951 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive variable(s) declaration."); yynerrs++;} |
131 | 3952 |
| VAR RETAIN error var_init_decl_list END_VAR |
136 | 3953 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive variable(s) declaration."); yyerrok;} |
3954 |
| VAR RETAIN var_init_decl_list error END_OF_INPUT |
|
3955 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive variable(s) declaration."); yyerrok;} |
|
96 | 3956 |
| VAR RETAIN error END_VAR |
136 | 3957 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive variable(s) declaration."); yyerrok;} |
96 | 3958 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3959 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3960 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3961 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3962 |
located_var_declarations: |
131 | 3963 |
VAR located_var_decl_list END_VAR |
68 | 3964 |
{$$ = new located_var_declarations_c(NULL, $2, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3965 |
| VAR CONSTANT located_var_decl_list END_VAR |
68 | 3966 |
{$$ = new located_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3967 |
| VAR RETAIN located_var_decl_list END_VAR |
68 | 3968 |
{$$ = new located_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3969 |
| VAR NON_RETAIN located_var_decl_list END_VAR |
68 | 3970 |
{$$ = new located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));} |
131 | 3971 |
/* ERROR_CHECK_BEGIN */ |
3972 |
| VAR NON_RETAIN END_VAR |
|
136 | 3973 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in non-retentive located variable(s) declaration."); yynerrs++;} |
131 | 3974 |
| VAR error located_var_decl_list END_VAR |
136 | 3975 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR' in located variable(s) declaration."); yyerrok;} |
131 | 3976 |
| VAR CONSTANT error located_var_decl_list END_VAR |
136 | 3977 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant located variable(s) declaration."); yyerrok;} |
131 | 3978 |
| VAR RETAIN error located_var_decl_list END_VAR |
136 | 3979 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive located variable(s) declaration."); yyerrok;} |
131 | 3980 |
| VAR NON_RETAIN error located_var_decl_list END_VAR |
136 | 3981 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive located variable(s) declaration."); yyerrok;} |
3982 |
| VAR located_var_decl_list error END_OF_INPUT |
|
3983 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed located variable(s) declaration."); yyerrok;} |
|
3984 |
| VAR CONSTANT located_var_decl_list error END_OF_INPUT |
|
3985 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant located variable(s) declaration."); yyerrok;} |
|
3986 |
| VAR RETAIN located_var_decl_list error END_OF_INPUT |
|
3987 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive located variable(s) declaration."); yyerrok;} |
|
3988 |
| VAR NON_RETAIN located_var_decl_list error END_OF_INPUT |
|
3989 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive located variable(s) declaration."); yyerrok;} |
|
131 | 3990 |
| VAR NON_RETAIN error END_VAR |
136 | 3991 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non retentive variable(s) declaration."); yyerrok;} |
131 | 3992 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3993 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3994 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3995 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3996 |
/* helper symbol for located_var_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3997 |
located_var_decl_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3998 |
located_var_decl ';' |
68 | 3999 |
{$$ = new located_var_decl_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4000 |
| located_var_decl_list located_var_decl ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4001 |
{$$ = $1; $$->add_element($2);} |
131 | 4002 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4003 |
| error ';' |
136 | 4004 |
{$$ = new located_var_decl_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid located variable declaration."); yyerrok;} |
131 | 4005 |
| located_var_decl error |
136 | 4006 |
{$$ = new located_var_decl_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of located variable declaration."); yyerrok;} |
131 | 4007 |
| located_var_decl_list located_var_decl error |
136 | 4008 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of located variable declaration."); yyerrok;} |
133 | 4009 |
| located_var_decl_list error ';' |
136 | 4010 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid located variable declaration."); yyerrok;} |
131 | 4011 |
| located_var_decl_list ';' |
136 | 4012 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after located variable declaration."); yynerrs++;} |
131 | 4013 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4014 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4015 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4016 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4017 |
located_var_decl: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4018 |
variable_name location ':' located_var_spec_init |
68 | 4019 |
{$$ = new located_var_decl_c($1, $2, $4, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4020 |
variable_name_symtable.insert($1, prev_declared_variable_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4021 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4022 |
| location ':' located_var_spec_init |
68 | 4023 |
{$$ = new located_var_decl_c(NULL, $1, $3, locloc(@$));} |
131 | 4024 |
/* ERROR_CHECK_BEGIN */ |
4025 |
| variable_name location located_var_spec_init |
|
136 | 4026 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between located variable location and specification."); yynerrs++;} |
131 | 4027 |
| location located_var_spec_init |
136 | 4028 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between located variable location and specification."); yynerrs++;} |
131 | 4029 |
| variable_name location ':' error |
4030 |
{$$ = NULL; |
|
136 | 4031 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in located variable declaration.");} |
4032 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in located variable declaration."); yyclearin;} |
|
131 | 4033 |
yyerrok; |
4034 |
} |
|
4035 |
| location ':' error |
|
4036 |
{$$ = NULL; |
|
136 | 4037 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in located variable declaration.");} |
4038 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in located variable declaration."); yyclearin;} |
|
131 | 4039 |
yyerrok; |
4040 |
} |
|
4041 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4042 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4043 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4044 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4045 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4046 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4047 |
external_var_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4048 |
VAR_EXTERNAL external_declaration_list END_VAR |
68 | 4049 |
{$$ = new external_var_declarations_c(NULL, $2, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4050 |
| VAR_EXTERNAL CONSTANT external_declaration_list END_VAR |
68 | 4051 |
{$$ = new external_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));} |
96 | 4052 |
/* ERROR_CHECK_BEGIN */ |
131 | 4053 |
| VAR_EXTERNAL END_VAR |
136 | 4054 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in external variable(s) declaration."); yynerrs++;} |
131 | 4055 |
| VAR_EXTERNAL CONSTANT END_VAR |
136 | 4056 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in constant external variable(s) declaration."); yynerrs++;} |
131 | 4057 |
| VAR_EXTERNAL error external_declaration_list END_VAR |
136 | 4058 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_EXTERNAL' in external variable(s) declaration."); yyerrok;} |
131 | 4059 |
| VAR_EXTERNAL CONSTANT error external_declaration_list END_VAR |
136 | 4060 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant external variable(s) declaration."); yyerrok;} |
4061 |
| VAR_EXTERNAL external_declaration_list error END_OF_INPUT |
|
4062 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed external variable(s) declaration."); yyerrok;} |
|
4063 |
| VAR_EXTERNAL CONSTANT external_declaration_list error END_OF_INPUT |
|
4064 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant external variable(s) declaration."); yyerrok;} |
|
96 | 4065 |
| VAR_EXTERNAL error END_VAR |
136 | 4066 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in external variable(s) declaration."); yyerrok;} |
131 | 4067 |
| VAR_EXTERNAL CONSTANT error END_VAR |
136 | 4068 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant external variable(s) declaration."); yyerrok;} |
96 | 4069 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4070 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4071 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4072 |
/* helper symbol for external_var_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4073 |
external_declaration_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4074 |
external_declaration ';' |
68 | 4075 |
{$$ = new external_declaration_list_c(locloc(@$)); $$->add_element($1);} |
131 | 4076 |
| external_declaration_list external_declaration ';' |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4077 |
{$$ = $1; $$->add_element($2);} |
131 | 4078 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4079 |
| error ';' |
136 | 4080 |
{$$ = new external_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid external variable declaration."); yyerrok;} |
131 | 4081 |
| external_declaration error |
136 | 4082 |
{$$ = new external_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of external variable declaration."); yyerrok;} |
131 | 4083 |
| external_declaration_list external_declaration error |
136 | 4084 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of external variable declaration."); yyerrok;} |
133 | 4085 |
| external_declaration_list error ';' |
136 | 4086 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid external variable declaration."); yyerrok;} |
131 | 4087 |
| external_declaration_list ';' |
136 | 4088 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after external variable declaration."); yynerrs++;} |
131 | 4089 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4090 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4091 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4092 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4093 |
external_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4094 |
global_var_name ':' simple_specification |
68 | 4095 |
{$$ = new external_declaration_c($1, $3, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4096 |
variable_name_symtable.insert($1, prev_declared_variable_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4097 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4098 |
| global_var_name ':' subrange_specification |
68 | 4099 |
{$$ = new external_declaration_c($1, $3, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4100 |
variable_name_symtable.insert($1, prev_declared_variable_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4101 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4102 |
| global_var_name ':' enumerated_specification |
68 | 4103 |
{$$ = new external_declaration_c($1, $3, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4104 |
variable_name_symtable.insert($1, prev_declared_variable_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4105 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4106 |
| global_var_name ':' array_specification |
68 | 4107 |
{$$ = new external_declaration_c($1, $3, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4108 |
variable_name_symtable.insert($1, prev_declared_variable_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4109 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4110 |
| global_var_name ':' prev_declared_structure_type_name |
68 | 4111 |
{$$ = new external_declaration_c($1, $3, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4112 |
variable_name_symtable.insert($1, prev_declared_variable_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4113 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4114 |
| global_var_name ':' function_block_type_name |
810
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
805
diff
changeset
|
4115 |
{$$ = new external_declaration_c($1, new fb_spec_init_c($3, NULL, locloc(@3)), locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4116 |
variable_name_symtable.insert($1, prev_declared_fb_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4117 |
} |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
4118 |
| global_var_name ':' ref_spec /* defined in IEC 61131-3 v3 (REF_TO ...)*/ |
891
58109ca87903
Fix typo in as yet dormant code (related to REF_TO keyword, that is not yet active)
mjsousa
parents:
876
diff
changeset
|
4119 |
{$$ = new external_declaration_c($1, $3, locloc(@$)); |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
4120 |
variable_name_symtable.insert($1, prev_declared_fb_name_token); |
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
4121 |
} |
131 | 4122 |
/* ERROR_CHECK_BEGIN */ |
4123 |
| global_var_name simple_specification |
|
136 | 4124 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and simple specification."); yynerrs++;} |
131 | 4125 |
| global_var_name subrange_specification |
136 | 4126 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and subrange specification."); yynerrs++;} |
131 | 4127 |
| global_var_name enumerated_specification |
136 | 4128 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and enumerated specification."); yynerrs++;} |
131 | 4129 |
| global_var_name array_specification |
136 | 4130 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and array specification."); yynerrs++;} |
131 | 4131 |
| global_var_name prev_declared_structure_type_name |
136 | 4132 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and structured specification."); yynerrs++;} |
131 | 4133 |
| global_var_name function_block_type_name |
136 | 4134 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and function block type specification."); yynerrs++;} |
131 | 4135 |
| global_var_name ':' error |
4136 |
{$$ = NULL; |
|
136 | 4137 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in external variable declaration.");} |
4138 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in external variable declaration."); yyclearin;} |
|
131 | 4139 |
yyerrok; |
4140 |
} |
|
4141 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4142 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4143 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4144 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4145 |
global_var_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4146 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4147 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4148 |
global_var_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4149 |
VAR_GLOBAL global_var_decl_list END_VAR |
68 | 4150 |
{$$ = new global_var_declarations_c(NULL, $2, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4151 |
| VAR_GLOBAL CONSTANT global_var_decl_list END_VAR |
68 | 4152 |
{$$ = new global_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4153 |
| VAR_GLOBAL RETAIN global_var_decl_list END_VAR |
68 | 4154 |
{$$ = new global_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));} |
96 | 4155 |
/* ERROR_CHECK_BEGIN */ |
131 | 4156 |
| VAR_GLOBAL END_VAR |
136 | 4157 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in global variable(s) declaration."); yynerrs++;} |
131 | 4158 |
| VAR_GLOBAL CONSTANT END_VAR |
136 | 4159 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in constant global variable(s) declaration."); yynerrs++;} |
131 | 4160 |
| VAR_GLOBAL RETAIN END_VAR |
136 | 4161 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive global variable(s) declaration."); yynerrs++;} |
131 | 4162 |
| VAR_GLOBAL error global_var_decl_list END_VAR |
136 | 4163 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_GLOBAL' in global variable(s) declaration."); yyerrok;} |
131 | 4164 |
| VAR_GLOBAL CONSTANT error global_var_decl_list END_VAR |
136 | 4165 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant global variable(s) declaration."); yyerrok;} |
131 | 4166 |
| VAR_GLOBAL RETAIN error global_var_decl_list END_VAR |
136 | 4167 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive global variable(s) declaration."); yyerrok;} |
4168 |
| VAR_GLOBAL global_var_decl_list error END_OF_INPUT |
|
4169 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed global variable(s) declaration."); yyerrok;} |
|
4170 |
| VAR_GLOBAL CONSTANT global_var_decl_list error END_OF_INPUT |
|
4171 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant global variable(s) declaration."); yyerrok;} |
|
4172 |
| VAR_GLOBAL RETAIN global_var_decl_list error END_OF_INPUT |
|
4173 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive global variable(s) declaration."); yyerrok;} |
|
96 | 4174 |
| VAR_GLOBAL error END_VAR |
136 | 4175 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in global variable(s) declaration."); yyerrok;} |
131 | 4176 |
| VAR_GLOBAL CONSTANT error END_VAR |
136 | 4177 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant global variable(s) declaration."); yyerrok;} |
131 | 4178 |
| VAR_GLOBAL RETAIN error END_VAR |
136 | 4179 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant global variable(s) declaration."); yyerrok;} |
96 | 4180 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4181 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4182 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4183 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4184 |
/* helper symbol for global_var_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4185 |
global_var_decl_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4186 |
global_var_decl ';' |
68 | 4187 |
{$$ = new global_var_decl_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4188 |
| global_var_decl_list global_var_decl ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4189 |
{$$ = $1; $$->add_element($2);} |
131 | 4190 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4191 |
| error ';' |
136 | 4192 |
{$$ = new global_var_decl_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid global variable(s) declaration."); yyerrok;} |
131 | 4193 |
| global_var_decl error |
136 | 4194 |
{$$ = new global_var_decl_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of global variable(s) declaration."); yyerrok;} |
131 | 4195 |
| global_var_decl_list global_var_decl error |
136 | 4196 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "';' missing at end of global variable(s) declaration."); yyerrok;} |
133 | 4197 |
| global_var_decl_list error ';' |
136 | 4198 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid global variable(s) declaration."); yyerrok;} |
131 | 4199 |
| global_var_decl_list ';' |
136 | 4200 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after global variable(s) declaration."); yynerrs++;} |
131 | 4201 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4202 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4203 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4204 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4205 |
global_var_decl: |
131 | 4206 |
/* NOTE : This possibility defined in standard has no sense and generate a conflict (disabled) |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4207 |
global_var_spec ':' |
68 | 4208 |
{$$ = new global_var_decl_c($1, NULL, locloc(@$));} |
131 | 4209 |
*/ |
4210 |
global_var_spec ':' located_var_spec_init |
|
68 | 4211 |
{$$ = new global_var_decl_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4212 |
| global_var_spec ':' function_block_type_name |
810
d9c48ad646f1
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
Mario de Sousa <msousa@fe.up.pt>
parents:
805
diff
changeset
|
4213 |
{$$ = new global_var_decl_c($1, new fb_spec_init_c($3, NULL, locloc(@3)), locloc(@$));} |
131 | 4214 |
/* ERROR_CHECK_BEGIN */ |
4215 |
| global_var_list located_var_spec_init |
|
136 | 4216 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between global variable list and type specification."); yynerrs++;} |
131 | 4217 |
| global_var_name location located_var_spec_init |
136 | 4218 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between global variable specification and type specification."); yynerrs++;} |
131 | 4219 |
| global_var_spec function_block_type_name |
136 | 4220 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between global variable specification and function block type specification."); yynerrs++;} |
131 | 4221 |
| global_var_spec ':' error |
4222 |
{$$ = NULL; |
|
136 | 4223 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in global variable declaration.");} |
4224 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in global variable declaration."); yyclearin;} |
|
131 | 4225 |
yyerrok; |
4226 |
} |
|
4227 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4228 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4229 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4230 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4231 |
global_var_spec: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4232 |
global_var_list {$$ = $1;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4233 |
| location |
68 | 4234 |
{$$ = new global_var_spec_c(NULL, $1, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4235 |
| global_var_name location |
68 | 4236 |
{$$ = new global_var_spec_c($1, $2, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4237 |
variable_name_symtable.insert($1, prev_declared_global_var_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4238 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4239 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4240 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4241 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4242 |
located_var_spec_init: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4243 |
simple_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4244 |
| subrange_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4245 |
| enumerated_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4246 |
| array_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4247 |
| initialized_structure |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4248 |
| single_byte_string_spec |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4249 |
| double_byte_string_spec |
876
e2c4f6f4abe2
Add support for parsing of REF_TO keyword (defined in IEC61131-3 v3). This support is currently inactive (in flex) until we get to add C code generation later on.
mjsousa
parents:
873
diff
changeset
|
4250 |
| ref_spec_init /* defined in IEC 61131-3 v3 (REF_TO ...) */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4251 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4252 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4253 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4254 |
location: |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
4255 |
AT direct_variable_token |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
4256 |
{$$ = new location_c(new direct_variable_c($2, locloc(@$)), locloc(@$)); |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
4257 |
direct_variable_symtable.insert($2, prev_declared_direct_variable_token); |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
4258 |
} |
131 | 4259 |
/* ERROR_CHECK_BEGIN */ |
4260 |
| AT error |
|
4261 |
{$$ = NULL; |
|
136 | 4262 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no location defined in location declaration.");} |
4263 |
else {print_err_msg(locf(@2), locl(@2), "invalid location in global location declaration."); yyclearin;} |
|
131 | 4264 |
yyerrok; |
4265 |
} |
|
4266 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4267 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4268 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4269 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4270 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4271 |
global_var_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4272 |
global_var_name |
68 | 4273 |
{$$ = new global_var_list_c(locloc(@$)); $$->add_element($1); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4274 |
variable_name_symtable.insert($1, prev_declared_global_var_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4275 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4276 |
| global_var_list ',' global_var_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4277 |
{$$ = $1; $$->add_element($3); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4278 |
variable_name_symtable.insert($3, prev_declared_global_var_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4279 |
} |
131 | 4280 |
/* ERROR_CHECK_BEGIN */ |
4281 |
| global_var_list global_var_name |
|
136 | 4282 |
{$$ = new global_var_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "',' missing in global variable list."); yynerrs++;} |
131 | 4283 |
| global_var_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4284 |
{$$ = $1; |
136 | 4285 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no variable name defined in global variable declaration.");} |
4286 |
else {print_err_msg(locf(@3), locl(@3), "invalid variable name in global variable declaration."); yyclearin;} |
|
131 | 4287 |
yyerrok; |
4288 |
} |
|
4289 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4290 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4291 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4292 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4293 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4294 |
string_var_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4295 |
single_byte_string_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4296 |
| double_byte_string_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4297 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4298 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4299 |
single_byte_string_var_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4300 |
var1_list ':' single_byte_string_spec |
68 | 4301 |
{$$ = new single_byte_string_var_declaration_c($1, $3, locloc(@$));} |
131 | 4302 |
/* ERROR_CHECK_BEGIN */ |
4303 |
| var1_list single_byte_string_spec |
|
136 | 4304 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and string type specification."); yynerrs++;} |
131 | 4305 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4306 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4307 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4308 |
/* NOTE: The constructs |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4309 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4310 |
* [W]STRING |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4311 |
* and |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4312 |
* [W]STRING ASSIGN single_byte_character_string |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4313 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4314 |
* were removed as they are already contained |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4315 |
* within a other constructs. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4316 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4317 |
* single_byte_string_spec is used in: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4318 |
* - single_byte_string_var_declaration -> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4319 |
* -> string_var_declaration ---> var_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4320 |
* |--> temp_var_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4321 |
* |--> var2_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4322 |
* - located_var_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4323 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4324 |
* STRING [ASSIGN string_constant] -> elementary_string_type_name -> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4325 |
* -> simple_spec -> simple_specification -> simple_spec_init -> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4326 |
* -> located_var_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4327 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4328 |
* STRING [ASSIGN string_constant] -> elementary_string_type_name -> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4329 |
* -> simple_spec -> simple_specification -> simple_spec_init -> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4330 |
* -> var1_init_decl -> var_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4331 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4332 |
* STRING [ASSIGN string_constant] -> elementary_string_type_name -> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4333 |
* -> simple_spec -> simple_specification -> simple_spec_init -> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4334 |
* -> var1_init_decl -> var2_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4335 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4336 |
* STRING [ASSIGN string_constant] -> elementary_string_type_name -> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4337 |
* -> simple_spec -> simple_specification -> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4338 |
* -> var1_declaration -> temp_var_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4339 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4340 |
single_byte_string_spec: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4341 |
/* STRING |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4342 |
{$$ = new single_byte_string_spec_c(NULL, NULL);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4343 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4344 |
STRING '[' integer ']' |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4345 |
{$$ = new single_byte_string_spec_c(new single_byte_limited_len_string_spec_c(new string_type_name_c(locloc(@1)), $3, locloc(@$)), NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4346 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4347 |
| STRING ASSIGN single_byte_character_string |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4348 |
{$$ = new single_byte_string_spec_c($1, NULL, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4349 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4350 |
| STRING '[' integer ']' ASSIGN single_byte_character_string |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4351 |
{$$ = new single_byte_string_spec_c(new single_byte_limited_len_string_spec_c(new string_type_name_c(locloc(@1)), $3, locloc(@$)), $6, locloc(@$));} |
131 | 4352 |
/* ERROR_CHECK_BEGIN */ |
4353 |
| STRING '[' error ']' |
|
136 | 4354 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited string type specification."); yyerrok;} |
131 | 4355 |
| STRING '[' error ']' ASSIGN single_byte_character_string |
136 | 4356 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited string type specification."); yyerrok;} |
131 | 4357 |
| STRING '[' ']' |
136 | 4358 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited string type specification."); yynerrs++;} |
131 | 4359 |
| STRING '[' ']' ASSIGN single_byte_character_string |
136 | 4360 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited string type specification."); yynerrs++;} |
131 | 4361 |
| STRING '[' integer error |
136 | 4362 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "expecting ']' after length definition for limited string type specification."); yyerrok;} |
131 | 4363 |
| STRING '[' integer ']' single_byte_character_string |
136 | 4364 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "':=' missing before limited string type initialization."); yynerrs++;} |
131 | 4365 |
| STRING '[' integer ']' ASSIGN error |
4366 |
{$$ = NULL; |
|
136 | 4367 |
if (is_current_syntax_token()) {print_err_msg(locl(@5), locf(@6), "no initial value defined in limited string type initialization.");} |
4368 |
else {print_err_msg(locf(@6), locl(@6), "invalid initial value in limited string type initialization."); yyclearin;} |
|
131 | 4369 |
yyerrok; |
4370 |
} |
|
4371 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4372 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4373 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4374 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4375 |
double_byte_string_var_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4376 |
var1_list ':' double_byte_string_spec |
68 | 4377 |
{$$ = new double_byte_string_var_declaration_c($1, $3, locloc(@$));} |
131 | 4378 |
/* ERROR_CHECK_BEGIN */ |
4379 |
| var1_list double_byte_string_spec |
|
136 | 4380 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and double byte string type specification."); yynerrs++;} |
131 | 4381 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4382 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4383 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4384 |
double_byte_string_spec: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4385 |
/* WSTRING |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4386 |
{$$ = new double_byte_string_spec_c($1, NULL, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4387 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4388 |
WSTRING '[' integer ']' |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4389 |
{$$ = new double_byte_string_spec_c(new double_byte_limited_len_string_spec_c(new wstring_type_name_c(locloc(@1)), $3, locloc(@$)), NULL, locloc(@$));} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4390 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4391 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4392 |
| WSTRING ASSIGN double_byte_character_string |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4393 |
{$$ = new double_byte_string_spec_c($1, NULL, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4394 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4395 |
| WSTRING '[' integer ']' ASSIGN double_byte_character_string |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4396 |
{$$ = new double_byte_string_spec_c(new double_byte_limited_len_string_spec_c(new wstring_type_name_c(locloc(@1)), $3, locloc(@$)), $6, locloc(@$));} |
131 | 4397 |
/* ERROR_CHECK_BEGIN */ |
4398 |
| WSTRING '[' error ']' |
|
136 | 4399 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited double byte string type specification."); yyerrok;} |
131 | 4400 |
| WSTRING '[' error ']' ASSIGN single_byte_character_string |
136 | 4401 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited double byte string type specification."); yyerrok;} |
131 | 4402 |
| WSTRING '[' ']' |
136 | 4403 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited double byte string type specification."); yynerrs++;} |
131 | 4404 |
| WSTRING '[' ']' ASSIGN single_byte_character_string |
136 | 4405 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited double byte string type specification."); yynerrs++;} |
131 | 4406 |
| WSTRING '[' integer error |
136 | 4407 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "expecting ']' after length definition for limited double byte string type specification."); yyerrok;} |
131 | 4408 |
| WSTRING '[' integer ']' single_byte_character_string |
136 | 4409 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "':=' missing before limited double byte string type initialization."); yynerrs++;} |
131 | 4410 |
| WSTRING '[' integer ']' ASSIGN error |
4411 |
{$$ = NULL; |
|
136 | 4412 |
if (is_current_syntax_token()) {print_err_msg(locl(@5), locf(@6), "no initial value defined double byte in limited string type initialization.");} |
4413 |
else {print_err_msg(locf(@6), locl(@6), "invalid initial value in limited double byte string type initialization."); yyclearin;} |
|
131 | 4414 |
yyerrok; |
4415 |
} |
|
4416 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4417 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4418 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4419 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4420 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4421 |
incompl_located_var_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4422 |
VAR incompl_located_var_decl_list END_VAR |
68 | 4423 |
{$$ = new incompl_located_var_declarations_c(NULL, $2, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4424 |
| VAR RETAIN incompl_located_var_decl_list END_VAR |
68 | 4425 |
{$$ = new incompl_located_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4426 |
| VAR NON_RETAIN incompl_located_var_decl_list END_VAR |
68 | 4427 |
{$$ = new incompl_located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));} |
131 | 4428 |
/* ERROR_CHECK_BEGIN */ |
136 | 4429 |
| VAR incompl_located_var_decl_list error END_OF_INPUT |
4430 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed incomplete located variable(s) declaration."); yyerrok;} |
|
4431 |
| VAR RETAIN incompl_located_var_decl_list error END_OF_INPUT |
|
4432 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed incomplete retentive located variable(s) declaration."); yyerrok;} |
|
4433 |
| VAR NON_RETAIN incompl_located_var_decl_list error END_OF_INPUT |
|
4434 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed incomplete non-retentive located variable(s) declaration."); yyerrok;} |
|
131 | 4435 |
| VAR error incompl_located_var_decl_list END_VAR |
136 | 4436 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR' in incomplete located variable(s) declaration."); yyerrok;} |
131 | 4437 |
| VAR RETAIN error incompl_located_var_decl_list END_VAR |
136 | 4438 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive located variable(s) declaration."); yyerrok;} |
131 | 4439 |
| VAR NON_RETAIN error incompl_located_var_decl_list END_VAR |
136 | 4440 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive located variable(s) declaration."); yyerrok;} |
131 | 4441 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4442 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4443 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4444 |
/* helper symbol for incompl_located_var_declarations */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4445 |
incompl_located_var_decl_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4446 |
incompl_located_var_decl ';' |
68 | 4447 |
{$$ = new incompl_located_var_decl_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4448 |
| incompl_located_var_decl_list incompl_located_var_decl ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4449 |
{$$ = $1; $$->add_element($2);} |
131 | 4450 |
/* ERROR_CHECK_BEGIN */ |
4451 |
| incompl_located_var_decl error |
|
136 | 4452 |
{$$ = new incompl_located_var_decl_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of incomplete located variable declaration."); yyerrok;} |
131 | 4453 |
| incompl_located_var_decl_list incompl_located_var_decl error |
136 | 4454 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of incomplete located variable declaration."); yyerrok;} |
133 | 4455 |
| incompl_located_var_decl_list error ';' |
136 | 4456 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid incomplete located variable declaration."); yyerrok;} |
131 | 4457 |
| incompl_located_var_decl_list ';' |
136 | 4458 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after incomplete located variable declaration."); yynerrs++;} |
131 | 4459 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4460 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4461 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4462 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4463 |
incompl_located_var_decl: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4464 |
variable_name incompl_location ':' var_spec |
68 | 4465 |
{$$ = new incompl_located_var_decl_c($1, $2, $4, locloc(@$));} |
131 | 4466 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4467 |
| variable_name incompl_location var_spec |
136 | 4468 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between incomplete located variable and type specification."); yynerrs++; |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4469 |
} |
131 | 4470 |
| variable_name incompl_location ':' error |
4471 |
{$$ = NULL; |
|
136 | 4472 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in incomplete located variable declaration.");} |
4473 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in incomplete located variable declaration."); yyclearin;} |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4474 |
yyerrok; |
131 | 4475 |
} |
4476 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4477 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4478 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4479 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4480 |
incompl_location: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4481 |
AT incompl_location_token |
68 | 4482 |
{$$ = new incompl_location_c($2, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4483 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4484 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4485 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4486 |
var_spec: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4487 |
simple_specification |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4488 |
| subrange_specification |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4489 |
| enumerated_specification |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4490 |
| array_specification |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4491 |
| prev_declared_structure_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4492 |
| string_spec |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4493 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4494 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4495 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4496 |
/* helper symbol for var_spec */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4497 |
string_spec: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4498 |
/* STRING |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4499 |
{$$ = new single_byte_limited_len_string_spec_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4500 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4501 |
STRING '[' integer ']' |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4502 |
{$$ = new single_byte_limited_len_string_spec_c(new string_type_name_c(locloc(@1)), $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4503 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4504 |
| WSTRING |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4505 |
{$$ = new double_byte_limited_len_string_spec_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4506 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4507 |
| WSTRING '[' integer ']' |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4508 |
{$$ = new double_byte_limited_len_string_spec_c(new wstring_type_name_c(locloc(@1)), $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4509 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4510 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4511 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4512 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4513 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4514 |
/* intermediate helper symbol for: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4515 |
* - non_retentive_var_decls |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4516 |
* - var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4517 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4518 |
var_init_decl_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4519 |
var_init_decl ';' |
68 | 4520 |
{$$ = new var_init_decl_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4521 |
| var_init_decl_list var_init_decl ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4522 |
{$$ = $1; $$->add_element($2);} |
131 | 4523 |
/* ERROR_CHECK_BEGIN */ |
4524 |
| var_init_decl_list var_init_decl error |
|
136 | 4525 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of variable(s) declaration."); yyerrok;} |
133 | 4526 |
| var_init_decl_list error ';' |
136 | 4527 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid variable(s) declaration."); yyerrok;} |
131 | 4528 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4529 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4530 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4531 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4532 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4533 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4534 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4535 |
/* B 1.5.1 - Functions */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4536 |
/***********************/ |
68 | 4537 |
/* |
4538 |
function_name: |
|
4539 |
prev_declared_derived_function_name |
|
4540 |
| standard_function_name |
|
4541 |
; |
|
4542 |
*/ |
|
4543 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4544 |
/* The following rules should be set such as: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4545 |
* function_name: function_name_no_clashes | function_name_simpleop_clashes | function_name_expression_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4546 |
* function_name: function_name_no_NOT_clashes | function_name_NOT_clashes; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4547 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4548 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4549 |
function_name_no_clashes: prev_declared_derived_function_name | standard_function_name_no_clashes; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4550 |
function_name_simpleop_clashes: standard_function_name_simpleop_clashes; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4551 |
//function_name_expression_clashes: standard_function_name_expression_clashes; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4552 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4553 |
function_name_no_NOT_clashes: prev_declared_derived_function_name | standard_function_name_no_NOT_clashes; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4554 |
//function_name_NOT_clashes: standard_function_name_NOT_clashes; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4555 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4556 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4557 |
/* NOTE: The list of standard function names |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4558 |
* includes the standard functions MOD(), NOT() |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4559 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4560 |
* Strangely enough, MOD and NOT are reserved keywords, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4561 |
* so shouldn't be used for function names. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4562 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4563 |
* The specification contradicts itself! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4564 |
* Our workaround is to treat MOD as a token, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4565 |
* but to include this token as a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4566 |
* standard_function_name. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4567 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4568 |
* The names of all other standard functions get |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4569 |
* preloaded into the library_element_symbol_table |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4570 |
* with the token value of |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4571 |
* standard_function_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4572 |
* Actually, simply for completeness, MOD is also |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4573 |
* loaded into the library_element_symbol_table, but |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4574 |
* it is irrelevant since flex will catch MOD as a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4575 |
* token, before it interprets it as an identifier, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4576 |
* and looks in the library_element_symbol_table to check |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4577 |
* whether it has been previously declared. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4578 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4579 |
* NOTE: The same as the above also occurs with the IL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4580 |
* operators NOT AND OR XOR ADD SUB MUL DIV MOD |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4581 |
* GT GE EQ LT LE NE. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4582 |
* Note that MOD is once again in the list! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4583 |
* Anyway, we give these the same treatement as |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4584 |
* MOD, since we are writing a parser for ST and |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4585 |
* IL simultaneously. If this were not the case, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4586 |
* the ST parser would not need the tokens NOT AND ... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4587 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4588 |
* NOTE: Note that 'NOT' is special, as it conflicts |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4589 |
* with two operators: the IL 'NOT' operator, and |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4590 |
* the unary operator 'NOT' in ST!! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4591 |
* |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
4592 |
* NOTE: The IL language is ambiguous, since using NOT, AND, ... |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4593 |
* may be interpreted as either an IL operator, or |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4594 |
* as a standard function call! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4595 |
* I (Mario) opted to interpret it as an IL operator. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4596 |
* This requires changing the syntax for IL language |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4597 |
* function calling, to exclude all function with |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4598 |
* names that clash with IL operators. I therefore |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4599 |
* created the constructs |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4600 |
* function_name_without_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4601 |
* standard_function_name_without_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4602 |
* to include all function names, except those that clash |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4603 |
* with IL operators. These constructs are only used |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4604 |
* within the IL language! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4605 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4606 |
/* The following rules should be set such as: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4607 |
* standard_function_name: standard_function_name_no_clashes | standard_function_name_simpleop_clashes | standard_function_name_expression_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4608 |
* standard_function_name: standard_function_name_no_NOT_clashes | standard_function_name_NOT_clashes; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4609 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4610 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4611 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4612 |
standard_function_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4613 |
standard_function_name_no_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4614 |
| standard_function_name_expression_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4615 |
| standard_function_name_NOT_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4616 |
//| standard_function_name_simpleop_only_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4617 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4618 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4619 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4620 |
standard_function_name_no_NOT_clashes: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4621 |
standard_function_name_no_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4622 |
| standard_function_name_expression_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4623 |
//| standard_function_name_simpleop_only_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4624 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4625 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4626 |
standard_function_name_no_clashes: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4627 |
standard_function_name_token |
68 | 4628 |
{$$ = new identifier_c($1, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4629 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4630 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4631 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4632 |
standard_function_name_simpleop_clashes: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4633 |
standard_function_name_NOT_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4634 |
//| standard_function_name_simpleop_only_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4635 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4636 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4637 |
standard_function_name_NOT_clashes: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4638 |
NOT |
68 | 4639 |
{$$ = new identifier_c(strdup("NOT"), locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4640 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4641 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4642 |
/* Add here any other IL simple operators that collide |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4643 |
* with standard function names! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4644 |
* Don't forget to uncomment the equivalent lines in |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4645 |
* - standard_function_name_simpleop_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4646 |
* - standard_function_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4647 |
* - standard_function_name_no_NOT_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4648 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4649 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4650 |
standard_function_name_simpleop_only_clashes: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4651 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4652 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4653 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4654 |
standard_function_name_expression_clashes: |
91 | 4655 |
AND {$$ = new identifier_c(strdup("AND"), locloc(@$));} |
4656 |
| OR {$$ = new identifier_c(strdup("OR"), locloc(@$));} |
|
4657 |
| XOR {$$ = new identifier_c(strdup("XOR"), locloc(@$));} |
|
4658 |
| ADD {$$ = new identifier_c(strdup("ADD"), locloc(@$));} |
|
4659 |
| SUB {$$ = new identifier_c(strdup("SUB"), locloc(@$));} |
|
4660 |
| MUL {$$ = new identifier_c(strdup("MUL"), locloc(@$));} |
|
4661 |
| DIV {$$ = new identifier_c(strdup("DIV"), locloc(@$));} |
|
4662 |
| MOD {$$ = new identifier_c(strdup("MOD"), locloc(@$));} |
|
4663 |
| GT {$$ = new identifier_c(strdup("GT"), locloc(@$));} |
|
4664 |
| GE {$$ = new identifier_c(strdup("GE"), locloc(@$));} |
|
4665 |
| EQ {$$ = new identifier_c(strdup("EQ"), locloc(@$));} |
|
4666 |
| LT {$$ = new identifier_c(strdup("LT"), locloc(@$));} |
|
4667 |
| LE {$$ = new identifier_c(strdup("LE"), locloc(@$));} |
|
4668 |
| NE {$$ = new identifier_c(strdup("NE"), locloc(@$));} |
|
4669 |
/* |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4670 |
AND_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4671 |
//NOTE: AND2 (corresponding to the source code string '&') does not clash |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4672 |
// with a standard function name, so should be commented out! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4673 |
//| AND2_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4674 |
| OR_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4675 |
| XOR_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4676 |
| ADD_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4677 |
| SUB_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4678 |
| MUL_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4679 |
| DIV_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4680 |
| MOD_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4681 |
| GT_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4682 |
| GE_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4683 |
| EQ_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4684 |
| LT_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4685 |
| LE_operator {$$ = il_operator_c_2_identifier_c($1);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4686 |
| NE_operator {$$ = il_operator_c_2_identifier_c($1);} |
91 | 4687 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4688 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4689 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4690 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4691 |
derived_function_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4692 |
identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4693 |
| prev_declared_derived_function_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4694 |
{$$ = $1; |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4695 |
if (!allow_function_overloading) { |
77 | 4696 |
fprintf(stderr, "Function overloading not allowed. Invalid identifier %s\n", ((token_c *)($1))->value); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4697 |
ERROR; |
77 | 4698 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4699 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4700 |
| AND |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4701 |
{$$ = new identifier_c("AND", locloc(@$)); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4702 |
if (!allow_function_overloading) print_err_msg(locloc(@1), "Function overloading \"AND\" not allowed. Invalid identifier\n"); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4703 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4704 |
| OR |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4705 |
{$$ = new identifier_c("OR", locloc(@$)); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4706 |
if (!allow_function_overloading) print_err_msg(locloc(@1), "Function overloading \"OR\" not allowed. Invalid identifier\n"); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4707 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4708 |
| XOR |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4709 |
{$$ = new identifier_c("XOR", locloc(@$)); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4710 |
if (!allow_function_overloading) print_err_msg(locloc(@1), "Function overloading \"XOR\" not allowed. Invalid identifier\n"); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4711 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4712 |
| NOT |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4713 |
{$$ = new identifier_c("NOT", locloc(@$)); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4714 |
if (!allow_function_overloading) print_err_msg(locloc(@1), "Function overloading \"NOT\" not allowed. Invalid identifier\n"); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4715 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4716 |
| MOD |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4717 |
{$$ = new identifier_c("MOD", locloc(@$)); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4718 |
if (!allow_function_overloading) print_err_msg(locloc(@1), "Function overloading \"MOD\" not allowed. Invalid identifier\n"); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4719 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4720 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4721 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4722 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4723 |
function_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4724 |
/* FUNCTION derived_function_name ':' elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4725 |
function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION |
68 | 4726 |
{$$ = new function_declaration_c($1, $3, $4, $5, locloc(@$)); |
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
4727 |
add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4728 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
4729 |
direct_variable_symtable.pop(); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4730 |
if (allow_function_overloading) { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4731 |
switch (library_element_symtable.find_value($1)) { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4732 |
case prev_declared_derived_function_name_token: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4733 |
/* do nothing, already in map. */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4734 |
break; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4735 |
case BOGUS_TOKEN_ID: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4736 |
/* Not yet in map. Must insert...*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4737 |
library_element_symtable.insert($1, prev_declared_derived_function_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4738 |
break; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4739 |
default: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4740 |
/* Already in map but associated with something else other than a funtion name! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4741 |
ERROR; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4742 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4743 |
} else { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4744 |
library_element_symtable.insert($1, prev_declared_derived_function_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4745 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4746 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4747 |
/* | FUNCTION derived_function_name ':' derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4748 |
| function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION |
68 | 4749 |
{$$ = new function_declaration_c($1, $3, $4, $5, locloc(@$)); |
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
4750 |
add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4751 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
4752 |
direct_variable_symtable.pop(); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4753 |
if (allow_function_overloading) { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4754 |
switch (library_element_symtable.find_value($1)) { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4755 |
case prev_declared_derived_function_name_token: /* do nothing, already in map. */ break; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4756 |
case BOGUS_TOKEN_ID: library_element_symtable.insert($1, prev_declared_derived_function_name_token); break; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4757 |
default: ERROR; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4758 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4759 |
} else { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4760 |
library_element_symtable.insert($1, prev_declared_derived_function_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4761 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4762 |
} |
68 | 4763 |
/* ERROR_CHECK_BEGIN */ |
131 | 4764 |
| function_name_declaration elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION |
136 | 4765 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after function name in function declaration."); yynerrs++;} |
131 | 4766 |
| function_name_declaration derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION |
136 | 4767 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after function name in function declaration."); yynerrs++;} |
131 | 4768 |
| function_name_declaration ':' io_OR_function_var_declarations_list function_body END_FUNCTION |
136 | 4769 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no return type defined in function declaration."); yynerrs++;} |
131 | 4770 |
| function_name_declaration ':' error io_OR_function_var_declarations_list function_body END_FUNCTION |
136 | 4771 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid return type defined in function declaration."); yyerrok;} |
131 | 4772 |
| function_name_declaration ':' elementary_type_name function_body END_FUNCTION |
136 | 4773 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared in function declaration."); yynerrs++;} |
131 | 4774 |
| function_name_declaration ':' derived_type_name function_body END_FUNCTION |
136 | 4775 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared in function declaration."); yynerrs++;} |
131 | 4776 |
| function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list END_FUNCTION |
136 | 4777 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no body defined in function declaration."); yynerrs++;} |
131 | 4778 |
| function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list END_FUNCTION |
136 | 4779 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no body defined in function declaration."); yynerrs++;} |
131 | 4780 |
| function_name_declaration ':' elementary_type_name END_FUNCTION |
136 | 4781 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared and body defined in function declaration."); yynerrs++;} |
131 | 4782 |
| function_name_declaration ':' derived_type_name END_FUNCTION |
136 | 4783 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared and body defined in function declaration."); yynerrs++;} |
4784 |
| function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list function_body END_OF_INPUT |
|
4785 |
{$$ = NULL; print_err_msg(locf(@1), locf(@3), "unclosed function declaration."); yynerrs++;} |
|
4786 |
| function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list function_body END_OF_INPUT |
|
4787 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed function declaration."); yynerrs++;} |
|
131 | 4788 |
| function_name_declaration error END_FUNCTION |
136 | 4789 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in function declaration."); yyerrok;} |
68 | 4790 |
/* ERROR_CHECK_END */ |
4791 |
; |
|
4792 |
||
4793 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4794 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4795 |
/* helper symbol for function_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4796 |
/* NOTE: due to reduce/reduce conflicts between identifiers |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4797 |
* being reduced to either a variable or an enumerator value, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4798 |
* we were forced to keep a symbol table of the names |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4799 |
* of all declared variables. Variables are no longer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4800 |
* created from simple identifier_token, but from |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4801 |
* prev_declared_variable_name_token. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4802 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4803 |
* BUT, in functions the function name itself may be used as |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4804 |
* a variable! In order to be able to parse this correctly, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4805 |
* the token parser (flex) must return a prev_declared_variable_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4806 |
* when it comes across the function name, while parsing |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4807 |
* the function itself. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4808 |
* We do this by inserting the function name into the variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4809 |
* symbol table, and having flex return a prev_declared_variable_name_token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4810 |
* whenever it comes across it. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4811 |
* When we finish parsing the function the variable name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4812 |
* symbol table is cleared of all entries, and the function |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4813 |
* name is inserted into the library element symbol table. This |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4814 |
* means that from then onwards flex will return a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4815 |
* derived_function_name_token whenever it comes across the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4816 |
* function name. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4817 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4818 |
* In order to insert the function name into the variable_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4819 |
* symbol table BEFORE the function body gets parsed, we |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4820 |
* need the parser to reduce a construct that contains the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4821 |
* the function name. That is why we created this extra |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4822 |
* construct (function_name_declaration), i.e. to force |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4823 |
* the parser to reduce it, before parsing the function body! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4824 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4825 |
function_name_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4826 |
FUNCTION derived_function_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4827 |
{$$ = $2; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4828 |
/* the function name functions as a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4829 |
* variable within the function itself! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4830 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4831 |
* Remember that the variable_name_symtable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4832 |
* is cleared once the end of the function |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4833 |
* is parsed. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4834 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4835 |
variable_name_symtable.insert($2, prev_declared_variable_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4836 |
} |
131 | 4837 |
/* ERROR_CHECK_BEGIN */ |
4838 |
| FUNCTION error |
|
4839 |
{$$ = NULL; |
|
136 | 4840 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no function name defined in function declaration.");} |
4841 |
else {print_err_msg(locf(@2), locl(@2), "invalid function name in function declaration."); yyclearin;} |
|
131 | 4842 |
yyerrok; |
4843 |
} |
|
4844 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4845 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4846 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4847 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4848 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4849 |
/* intermediate helper symbol for function_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4850 |
io_OR_function_var_declarations_list: |
131 | 4851 |
io_var_declarations |
4852 |
{$$ = new var_declarations_list_c(locloc(@1));$$->add_element($1);} |
|
4853 |
| function_var_decls |
|
4854 |
{$$ = new var_declarations_list_c(locloc(@1));$$->add_element($1);} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4855 |
| io_OR_function_var_declarations_list io_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4856 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4857 |
| io_OR_function_var_declarations_list function_var_decls |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4858 |
{$$ = $1; $$->add_element($2);} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4859 |
/* ERROR_CHECK_BEGIN */ |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4860 |
| io_OR_function_var_declarations_list retentive_var_declarations |
136 | 4861 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected retentive variable(s) declaration in function declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4862 |
| io_OR_function_var_declarations_list located_var_declarations |
136 | 4863 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected located variable(s) declaration in function declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4864 |
| io_OR_function_var_declarations_list external_var_declarations |
136 | 4865 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected external variable(s) declaration in function declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4866 |
| io_OR_function_var_declarations_list global_var_declarations |
136 | 4867 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected global variable(s) declaration in function declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4868 |
| io_OR_function_var_declarations_list incompl_located_var_declarations |
136 | 4869 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected incomplete located variable(s) declaration in function declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4870 |
| io_OR_function_var_declarations_list temp_var_decls |
136 | 4871 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected temporary located variable(s) declaration in function declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4872 |
| io_OR_function_var_declarations_list non_retentive_var_decls |
136 | 4873 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected non-retentive variable(s) declaration in function declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4874 |
/*| io_OR_function_var_declarations_list access_declarations |
136 | 4875 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected access variable(s) declaration in function declaration."); yynerrs++;}*/ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4876 |
| io_OR_function_var_declarations_list instance_specific_initializations |
136 | 4877 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected instance specific initialization(s) in function declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4878 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4879 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4880 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4881 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4882 |
io_var_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4883 |
input_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4884 |
| output_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4885 |
| input_output_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4886 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4887 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4888 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4889 |
function_var_decls: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4890 |
VAR CONSTANT var2_init_decl_list END_VAR |
68 | 4891 |
{$$ = new function_var_decls_c(new constant_option_c(locloc(@2)), $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4892 |
| VAR var2_init_decl_list END_VAR |
68 | 4893 |
{$$ = new function_var_decls_c(NULL, $2, locloc(@$));} |
131 | 4894 |
/* ERROR_CHECK_BEGIN */ |
136 | 4895 |
| VAR error var2_init_decl_list END_VAR |
4896 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR' in function variable(s) declaration."); yyerrok;} |
|
4897 |
| VAR CONSTANT error var2_init_decl_list END_VAR |
|
4898 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant function variable(s) declaration."); yyerrok;} |
|
4899 |
| VAR var2_init_decl_list error END_OF_INPUT |
|
4900 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed function variable(s) declaration."); yyerrok;} |
|
4901 |
| VAR CONSTANT var2_init_decl_list error END_OF_INPUT |
|
4902 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant function variable(s) declaration."); yyerrok;} |
|
131 | 4903 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4904 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4905 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4906 |
/* intermediate helper symbol for function_var_decls */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4907 |
var2_init_decl_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4908 |
var2_init_decl ';' |
68 | 4909 |
{$$ = new var2_init_decl_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4910 |
| var2_init_decl_list var2_init_decl ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4911 |
{$$ = $1; $$->add_element($2);} |
131 | 4912 |
/* ERROR_CHECK_BEGIN */ |
4913 |
| var2_init_decl error |
|
136 | 4914 |
{$$ = new var2_init_decl_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of function variable(s) declaration."); yyerrok;} |
131 | 4915 |
| var2_init_decl_list var2_init_decl error |
136 | 4916 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of function variable(s) declaration."); yyerrok;} |
133 | 4917 |
| var2_init_decl_list error ';' |
136 | 4918 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid function variable(s) declaration."); yyerrok;} |
131 | 4919 |
| var2_init_decl_list ';' |
136 | 4920 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after function variable(s) declaration."); yynerrs++;} |
131 | 4921 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4922 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4923 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4924 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4925 |
function_body: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4926 |
statement_list {$$ = $1;} /* if we leave it for the default action we get a type clash! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4927 |
| instruction_list {$$ = $1;} /* if we leave it for the default action we get a type clash! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4928 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4929 |
| ladder_diagram |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4930 |
| function_block_diagram |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4931 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4932 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4933 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4934 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4935 |
var2_init_decl: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4936 |
var1_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4937 |
| array_var_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4938 |
| structured_var_init_decl |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4939 |
| string_var_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4940 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4941 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4942 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4943 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4944 |
/*****************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4945 |
/* B 1.5.2 - Function Blocks */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4946 |
/*****************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4947 |
function_block_type_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4948 |
prev_declared_derived_function_block_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4949 |
| standard_function_block_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4950 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4951 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4952 |
|
68 | 4953 |
standard_function_block_name: standard_function_block_name_token {$$ = new identifier_c($1, locloc(@$));}; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4954 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4955 |
derived_function_block_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4956 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4957 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4958 |
function_block_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4959 |
FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK |
68 | 4960 |
{$$ = new function_block_declaration_c($2, $3, $4, locloc(@$)); |
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
4961 |
add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4962 |
library_element_symtable.insert($2, prev_declared_derived_function_block_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4963 |
/* Clear the variable_name_symtable. Since |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4964 |
* we have finished parsing the function block, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4965 |
* the variable names are now out of scope, so |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4966 |
* are no longer valid! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4967 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4968 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
4969 |
direct_variable_symtable.pop(); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4970 |
} |
68 | 4971 |
/* ERROR_CHECK_BEGIN */ |
131 | 4972 |
| FUNCTION_BLOCK io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK |
136 | 4973 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in function block declaration."); yynerrs++;} |
131 | 4974 |
| FUNCTION_BLOCK error io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK |
136 | 4975 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name in function block declaration."); yyerrok;} |
131 | 4976 |
| FUNCTION_BLOCK derived_function_block_name function_block_body END_FUNCTION_BLOCK |
136 | 4977 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared in function declaration."); yynerrs++;} |
131 | 4978 |
| FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list END_FUNCTION_BLOCK |
136 | 4979 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no body defined in function block declaration."); yynerrs++;} |
131 | 4980 |
| FUNCTION_BLOCK derived_function_block_name END_FUNCTION_BLOCK |
136 | 4981 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared and body defined in function block declaration."); yynerrs++;} |
4982 |
| FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list function_block_body END_OF_INPUT |
|
4983 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "no variable(s) declared and body defined in function block declaration."); yynerrs++;} |
|
68 | 4984 |
| FUNCTION_BLOCK error END_FUNCTION_BLOCK |
136 | 4985 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in function block declaration."); yyerrok;} |
68 | 4986 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4987 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4988 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4989 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4990 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4991 |
/* intermediate helper symbol for function_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4992 |
/* { io_var_declarations | other_var_declarations } */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4993 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4994 |
* NOTE: we re-use the var_declarations_list_c |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4995 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4996 |
io_OR_other_var_declarations_list: |
131 | 4997 |
io_var_declarations |
4998 |
{$$ = new var_declarations_list_c(locloc(@$));$$->add_element($1);} |
|
4999 |
| other_var_declarations |
|
5000 |
{$$ = new var_declarations_list_c(locloc(@$));$$->add_element($1);} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5001 |
| io_OR_other_var_declarations_list io_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5002 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5003 |
| io_OR_other_var_declarations_list other_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5004 |
{$$ = $1; $$->add_element($2);} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5005 |
/* ERROR_CHECK_BEGIN */ |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5006 |
| io_OR_other_var_declarations_list located_var_declarations |
136 | 5007 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected located variable(s) declaration in function block declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5008 |
| io_OR_other_var_declarations_list global_var_declarations |
136 | 5009 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected global variable(s) declaration in function block declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5010 |
/*| io_OR_other_var_declarations_list access_declarations |
136 | 5011 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected access variable(s) declaration in function block declaration."); yynerrs++;}*/ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5012 |
| io_OR_other_var_declarations_list instance_specific_initializations |
136 | 5013 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected instance specific initialization(s) in function block declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5014 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5015 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5016 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5017 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5018 |
* The IEC specification gives the following definition: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5019 |
* other_var_declarations ::= |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5020 |
* external_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5021 |
* | var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5022 |
* | retentive_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5023 |
* | non_retentive_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5024 |
* | temp_var_decls |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5025 |
* | incompl_located_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5026 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5027 |
* Nvertheless, the symbol non_retentive_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5028 |
* is not defined in the spec. This seems to me (Mario) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5029 |
* to be a typo, so non_retentive_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5030 |
* has been replaced with non_retentive_var_decls |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5031 |
* in the following rule! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5032 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5033 |
other_var_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5034 |
temp_var_decls |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5035 |
| non_retentive_var_decls |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5036 |
| external_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5037 |
| var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5038 |
| retentive_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5039 |
| incompl_located_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5040 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5041 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5042 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5043 |
temp_var_decls: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5044 |
VAR_TEMP temp_var_decls_list END_VAR |
68 | 5045 |
{$$ = new temp_var_decls_c($2, locloc(@$));} |
131 | 5046 |
/* ERROR_CHECK_BEGIN */ |
5047 |
| VAR_TEMP END_VAR |
|
136 | 5048 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in temporary variable(s) declaration."); yynerrs++;} |
5049 |
| VAR_TEMP temp_var_decls_list error END_OF_INPUT |
|
5050 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "unclosed temporary variable(s) declaration."); yyerrok;} |
|
131 | 5051 |
| VAR_TEMP error temp_var_decls_list END_VAR |
136 | 5052 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_TEMP' in function variable(s) declaration."); yyerrok;} |
131 | 5053 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5054 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5055 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5056 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5057 |
/* intermediate helper symbol for temp_var_decls */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5058 |
temp_var_decls_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5059 |
temp_var_decl ';' |
68 | 5060 |
{$$ = new temp_var_decls_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5061 |
| temp_var_decls_list temp_var_decl ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5062 |
{$$ = $1; $$->add_element($2);} |
131 | 5063 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5064 |
| error ';' |
136 | 5065 |
{$$ = new temp_var_decls_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid temporary variable(s) declaration."); yyerrok;} |
131 | 5066 |
| temp_var_decl error |
136 | 5067 |
{$$ = new temp_var_decls_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of temporary variable(s) declaration."); yyerrok;} |
131 | 5068 |
| temp_var_decls_list temp_var_decl error |
136 | 5069 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of temporary variable(s) declaration."); yyerrok;} |
133 | 5070 |
| temp_var_decls_list error ';' |
136 | 5071 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid temporary variable(s) declaration."); yyerrok;} |
131 | 5072 |
| temp_var_decls_list ';' |
136 | 5073 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after temporary variable(s) declaration."); yynerrs++;} |
131 | 5074 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5075 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5076 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5077 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5078 |
non_retentive_var_decls: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5079 |
VAR NON_RETAIN var_init_decl_list END_VAR |
68 | 5080 |
{$$ = new non_retentive_var_decls_c($3, locloc(@$));} |
131 | 5081 |
/* ERROR_CHECK_BEGIN */ |
136 | 5082 |
| VAR NON_RETAIN var_init_decl_list error END_OF_INPUT |
5083 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unclosed non-retentive temporary variable(s) declaration."); yyerrok;} |
|
131 | 5084 |
| VAR NON_RETAIN error var_init_decl_list END_VAR |
136 | 5085 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive temporary variable(s) declaration."); yyerrok;} |
131 | 5086 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5087 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5088 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5089 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5090 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5091 |
function_block_body: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5092 |
statement_list {$$ = $1;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5093 |
| instruction_list {$$ = $1;} |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5094 |
| sequential_function_chart {$$ = $1;} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5095 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5096 |
| ladder_diagram |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5097 |
| function_block_diagram |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5098 |
| <other languages> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5099 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5100 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5101 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5102 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5103 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5104 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5105 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5106 |
/* B 1.5.3 - Programs */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5107 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5108 |
program_type_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5109 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5110 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5111 |
program_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5112 |
PROGRAM program_type_name program_var_declarations_list function_block_body END_PROGRAM |
68 | 5113 |
{$$ = new program_declaration_c($2, $3, $4, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5114 |
library_element_symtable.insert($2, prev_declared_program_type_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5115 |
/* Clear the variable_name_symtable. Since |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5116 |
* we have finished parsing the program declaration, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5117 |
* the variable names are now out of scope, so |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5118 |
* are no longer valid! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5119 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5120 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5121 |
direct_variable_symtable.pop(); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5122 |
} |
68 | 5123 |
/* ERROR_CHECK_BEGIN */ |
131 | 5124 |
| PROGRAM program_var_declarations_list function_block_body END_PROGRAM |
136 | 5125 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no program name defined in program declaration.");} |
131 | 5126 |
| PROGRAM error program_var_declarations_list function_block_body END_PROGRAM |
136 | 5127 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid program name in program declaration."); yyerrok;} |
131 | 5128 |
| PROGRAM program_type_name function_block_body END_PROGRAM |
136 | 5129 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared in program declaration."); yynerrs++;} |
131 | 5130 |
| PROGRAM program_type_name program_var_declarations_list END_PROGRAM |
136 | 5131 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no body defined in program declaration."); yynerrs++;} |
131 | 5132 |
| PROGRAM program_type_name END_PROGRAM |
136 | 5133 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared and body defined in program declaration."); yynerrs++;} |
5134 |
| PROGRAM program_type_name program_var_declarations_list function_block_body END_OF_INPUT |
|
5135 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed program declaration."); yynerrs++;} |
|
68 | 5136 |
| PROGRAM error END_PROGRAM |
136 | 5137 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in program declaration."); yyerrok;} |
68 | 5138 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5139 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5140 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5141 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5142 |
/* helper symbol for program_declaration */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5143 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5144 |
* NOTE: we re-use the var_declarations_list_c |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5145 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5146 |
program_var_declarations_list: |
131 | 5147 |
io_var_declarations |
5148 |
{$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);} |
|
5149 |
| other_var_declarations |
|
5150 |
{$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);} |
|
5151 |
| located_var_declarations |
|
5152 |
{$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5153 |
| program_var_declarations_list io_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5154 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5155 |
| program_var_declarations_list other_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5156 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5157 |
| program_var_declarations_list located_var_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5158 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5159 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5160 |
| program_var_declarations_list program_access_decls |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5161 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5162 |
*/ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5163 |
/* ERROR_CHECK_BEGIN */ |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5164 |
| program_var_declarations_list global_var_declarations |
136 | 5165 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected global variable(s) declaration in function block declaration."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5166 |
/*| program_var_declarations_list access_declarations |
136 | 5167 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected access variable(s) declaration in function block declaration."); yynerrs++;}*/ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5168 |
| program_var_declarations_list instance_specific_initializations |
136 | 5169 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected instance specific initialization(s) in function block declaration."); yynerrs++; |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5170 |
} |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5171 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5172 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5173 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5174 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5175 |
/* TODO ... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5176 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5177 |
program_access_decls: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5178 |
VAR_ACCESS program_access_decl_list END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5179 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5180 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5181 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5182 |
/* helper symbol for program_access_decls */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5183 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5184 |
program_access_decl_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5185 |
program_access_decl ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5186 |
| program_access_decl_list program_access_decl ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5187 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5188 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5189 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5190 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5191 |
program_access_decl: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5192 |
access_name ':' symbolic_variable ':' non_generic_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5193 |
| access_name ':' symbolic_variable ':' non_generic_type_name direction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5194 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5195 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5196 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5197 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5198 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5199 |
/********************************************/ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5200 |
/* B 1.6 Sequential Function Chart elements * |
3 | 5201 |
/********************************************/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5202 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5203 |
sequential_function_chart: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5204 |
sfc_network |
68 | 5205 |
{$$ = new sequential_function_chart_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5206 |
| sequential_function_chart sfc_network |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5207 |
{$$ = $1; $$->add_element($2);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5208 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5209 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5210 |
sfc_network: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5211 |
initial_step |
68 | 5212 |
{$$ = new sfc_network_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5213 |
| sfc_network step |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5214 |
{$$ = $1; $$->add_element($2);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5215 |
| sfc_network transition |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5216 |
{$$ = $1; $$->add_element($2);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5217 |
| sfc_network action |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5218 |
{$$ = $1; $$->add_element($2);} |
131 | 5219 |
/* ERROR_CHECK_BEGIN */ |
5220 |
| sfc_network error |
|
136 | 5221 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "unexpected token after SFC network in sequencial function chart."); yyerrok;} |
131 | 5222 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5223 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5224 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5225 |
initial_step: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5226 |
INITIAL_STEP step_name ':' action_association_list END_STEP |
13 | 5227 |
// INITIAL_STEP identifier ':' action_association_list END_STEP |
616
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5228 |
{$$ = new initial_step_c($2, $4, locloc(@$)); |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5229 |
variable_name_symtable.insert($2, prev_declared_variable_name_token); // A step name may later be used as a structured variable!! |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5230 |
} |
131 | 5231 |
/* ERROR_CHECK_BEGIN */ |
5232 |
| INITIAL_STEP ':' action_association_list END_STEP |
|
136 | 5233 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "no step name defined in initial step declaration."); yynerrs++;} |
131 | 5234 |
| INITIAL_STEP error ':' action_association_list END_STEP |
136 | 5235 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid step name defined in initial step declaration."); yyerrok;} |
131 | 5236 |
| INITIAL_STEP step_name action_association_list END_STEP |
136 | 5237 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':' missing after step name in initial step declaration."); yynerrs++;} |
131 | 5238 |
| INITIAL_STEP step_name ':' error END_STEP |
136 | 5239 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid action association list in initial step declaration."); yyerrok;} |
5240 |
| INITIAL_STEP step_name ':' action_association_list END_OF_INPUT |
|
5241 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed initial step declaration."); yynerrs++;} |
|
131 | 5242 |
| INITIAL_STEP error END_STEP |
136 | 5243 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in initial step declaration."); yyerrok;} |
131 | 5244 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5245 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5246 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5247 |
step: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5248 |
STEP step_name ':' action_association_list END_STEP |
13 | 5249 |
// STEP identifier ':' action_association_list END_STEP |
616
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5250 |
{$$ = new step_c($2, $4, locloc(@$)); |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5251 |
variable_name_symtable.insert($2, prev_declared_variable_name_token); // A step name may later be used as a structured variable!! |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5252 |
} |
131 | 5253 |
/* ERROR_CHECK_BEGIN */ |
5254 |
| STEP ':' action_association_list END_STEP |
|
136 | 5255 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no step name defined in step declaration."); yynerrs++;} |
131 | 5256 |
| STEP error ':' action_association_list END_STEP |
136 | 5257 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid step name defined in step declaration."); yyerrok;} |
131 | 5258 |
| STEP step_name action_association_list END_STEP |
136 | 5259 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':' missing after step name in step declaration."); yynerrs++;} |
131 | 5260 |
| STEP step_name ':' error END_STEP |
136 | 5261 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid action association list in step declaration."); yyerrok;} |
5262 |
| STEP step_name ':' action_association_list END_OF_INPUT |
|
5263 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "invalid action association list in step declaration."); yynerrs++;} |
|
131 | 5264 |
| STEP error END_STEP |
136 | 5265 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in step declaration."); yyerrok;} |
131 | 5266 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5267 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5268 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5269 |
/* helper symbol for: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5270 |
* - initial_step |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5271 |
* - step |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5272 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5273 |
action_association_list: |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5274 |
/* empty */ |
68 | 5275 |
{$$ = new action_association_list_c(locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5276 |
| action_association_list action_association ';' |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5277 |
{$$ = $1; $$->add_element($2);} |
131 | 5278 |
/* ERROR_CHECK_BEGIN */ |
5279 |
| action_association_list action_association error |
|
136 | 5280 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of action association declaration."); yyerrok;} |
131 | 5281 |
| action_association_list ';' |
136 | 5282 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after action association declaration."); yynerrs++;} |
131 | 5283 |
/* ERROR_CHECK_END */ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5284 |
; |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5285 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5286 |
|
13 | 5287 |
// step_name: identifier; |
5288 |
step_name: any_identifier; |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5289 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5290 |
action_association: |
295
e7ce7c6bbb5d
Adding missing semicolons.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
5291 |
action_name '(' {cmd_goto_sfc_qualifier_state();} action_qualifier {cmd_pop_state();} indicator_name_list ')' |
68 | 5292 |
{$$ = new action_association_c($1, $4, $6, locloc(@$));} |
131 | 5293 |
/* ERROR_CHECK_BEGIN */ |
136 | 5294 |
/*| action_name '(' error ')' |
5295 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid qualifier defined in action association."); yyerrok;}*/ |
|
131 | 5296 |
/* ERROR_CHECK_END */ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5297 |
; |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5298 |
|
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5299 |
/* helper symbol for action_association */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5300 |
indicator_name_list: |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5301 |
/* empty */ |
68 | 5302 |
{$$ = new indicator_name_list_c(locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5303 |
| indicator_name_list ',' indicator_name |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5304 |
{$$ = $1; $$->add_element($3);} |
131 | 5305 |
/* ERROR_CHECK_BEGIN */ |
5306 |
| indicator_name_list indicator_name |
|
136 | 5307 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing at end of action association declaration."); yynerrs++;} |
131 | 5308 |
| indicator_name_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5309 |
{$$ = $1; |
136 | 5310 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no indicator defined in indicator list.");} |
5311 |
else {print_err_msg(locf(@3), locl(@3), "invalid indicator in indicator list."); yyclearin;} |
|
131 | 5312 |
yyerrok; |
5313 |
} |
|
5314 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5315 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5316 |
|
13 | 5317 |
// action_name: identifier; |
5318 |
action_name: any_identifier; |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5319 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5320 |
action_qualifier: |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5321 |
/* empty */ |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5322 |
{$$ = NULL;} |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5323 |
| qualifier |
68 | 5324 |
{$$ = new action_qualifier_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5325 |
| timed_qualifier ',' action_time |
68 | 5326 |
{$$ = new action_qualifier_c($1, $3, locloc(@$));} |
131 | 5327 |
/* ERROR_CHECK_BEGIN */ |
5328 |
| timed_qualifier action_time |
|
136 | 5329 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "',' missing between timed qualifier and action time in action qualifier."); yynerrs++;} |
131 | 5330 |
| timed_qualifier ',' error |
5331 |
{$$ = NULL; |
|
136 | 5332 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no action time defined in action qualifier.");} |
5333 |
else {print_err_msg(locf(@3), locl(@3), "invalid action time in action qualifier."); yyclearin;} |
|
131 | 5334 |
yyerrok; |
5335 |
} |
|
5336 |
/* ERROR_CHECK_END */ |
|
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5337 |
; |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5338 |
|
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5339 |
qualifier: |
94 | 5340 |
N {$$ = new qualifier_c(strdup("N"), locloc(@$));} |
68 | 5341 |
| R {$$ = new qualifier_c(strdup("R"), locloc(@$));} |
5342 |
| S {$$ = new qualifier_c(strdup("S"), locloc(@$));} |
|
5343 |
| P {$$ = new qualifier_c(strdup("P"), locloc(@$));} |
|
627
e7caa7d32ef5
Adding support for P0 and P1 qualifiers and fixing code generated for SL qualifier
Laurent Bessard
parents:
616
diff
changeset
|
5344 |
| P0 {$$ = new qualifier_c(strdup("P0"), locloc(@$));} |
e7caa7d32ef5
Adding support for P0 and P1 qualifiers and fixing code generated for SL qualifier
Laurent Bessard
parents:
616
diff
changeset
|
5345 |
| P1 {$$ = new qualifier_c(strdup("P1"), locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5346 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5347 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5348 |
timed_qualifier: |
94 | 5349 |
L {$$ = new timed_qualifier_c(strdup("L"), locloc(@$));} |
68 | 5350 |
| D {$$ = new timed_qualifier_c(strdup("D"), locloc(@$));} |
5351 |
| SD {$$ = new timed_qualifier_c(strdup("SD"), locloc(@$));} |
|
5352 |
| DS {$$ = new timed_qualifier_c(strdup("DS"), locloc(@$));} |
|
5353 |
| SL {$$ = new timed_qualifier_c(strdup("SL"), locloc(@$));} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5354 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5355 |
|
616
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5356 |
/* NOTE: A step_name may be used as a structured vaqriable, in order to access the status bit (e.g. Step1.X) |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5357 |
* or the time it has been active (e.g. Step1.T). |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5358 |
* In order to allow the step name to be used as a variable inside ST expressions (only ST expressions ??) |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5359 |
* when defining transitions, we need to add the step_name to the list of previously declared variables. |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5360 |
* This allows the step name to be used as a variable inside all transition expressions, as the user |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5361 |
* can clearly define the transition _after_ the step itself has been defined/declared, so the |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5362 |
* 'variable' is previously 'declared'. |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5363 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5364 |
* However, when defining/declaring a step, a variable name can also be used to define a timed |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5365 |
* action association. In this case, we may have a circular reference: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5366 |
* e.g. |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5367 |
* ... |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5368 |
* STEP step1: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5369 |
* action1 (D,t#100ms); |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5370 |
* end_step |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5371 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5372 |
* STEP step2: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5373 |
* action1 (D,step3.T); <---- forward reference to step3.T !!!!!! |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5374 |
* end_step |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5375 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5376 |
* STEP step3: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5377 |
* action1 (D,step2.T); <---- back reference to step2.T |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5378 |
* end_step |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5379 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5380 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5381 |
* There is no way the user can always use the step3.T variable only after it has |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5382 |
* been 'declared'. So adding the steps to the list of previously declared variables |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5383 |
* when the steps are declared is not a solution to the above situation. |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5384 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5385 |
* Fortunately, the standard does not allow ST expressions in the above syntax |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5386 |
* (i.e. when defining the delay of a timed actions), but only either a |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5387 |
* Time literal, or a variable. |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5388 |
* This is why we change the definition of action_time from |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5389 |
* action_time: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5390 |
* duration |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5391 |
* | variable |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5392 |
* ; |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5393 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5394 |
* to: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5395 |
* action_time: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5396 |
* duration |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5397 |
* | any_symbolic_variable |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5398 |
* ; |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5399 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5400 |
* NOTE that this same problem does not occur with the 'indicator_name': it does not |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5401 |
* make sense to set/indicate a step1.X variable, as these variables are read-only! |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5402 |
*/ |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5403 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5404 |
action_time: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5405 |
duration |
616
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5406 |
//| variable |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5407 |
| any_symbolic_variable |
10 | 5408 |
; |
5409 |
||
5410 |
indicator_name: variable; |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5411 |
|
13 | 5412 |
// transition_name: identifier; |
5413 |
transition_name: any_identifier; |
|
5414 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5415 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5416 |
steps: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5417 |
step_name |
68 | 5418 |
{$$ = new steps_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5419 |
| '(' step_name_list ')' |
68 | 5420 |
{$$ = new steps_c(NULL, $2, locloc(@$));} |
131 | 5421 |
/* ERROR_CHECK_BEGIN */ |
5422 |
| '(' step_name_list error |
|
136 | 5423 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "expecting ')' at the end of step list in transition declaration."); yyerrok;} |
131 | 5424 |
| '(' error ')' |
136 | 5425 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid step list in transition declaration."); yyerrok;} |
131 | 5426 |
/* ERROR_CHECK_END */ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5427 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5428 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5429 |
step_name_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5430 |
step_name ',' step_name |
68 | 5431 |
{$$ = new step_name_list_c(locloc(@$)); $$->add_element($1); $$->add_element($3);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5432 |
| step_name_list ',' step_name |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5433 |
{$$ = $1; $$->add_element($3);} |
131 | 5434 |
/* ERROR_CHECK_BEGIN */ |
5435 |
| step_name_list step_name |
|
136 | 5436 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in step list."); yynerrs++;} |
131 | 5437 |
| step_name_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5438 |
{$$ = $1; |
136 | 5439 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no step name defined in step list.");} |
5440 |
else {print_err_msg(locf(@3), locl(@3), "invalid step name in step list."); yyclearin;} |
|
131 | 5441 |
yyerrok; |
5442 |
} |
|
5443 |
/* ERROR_CHECK_END */ |
|
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5444 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5445 |
|
13 | 5446 |
|
85 | 5447 |
/* NOTE: flex will automatically pop() out of body_state to previous state. |
94 | 5448 |
* We do not need to give a command from bison to return to previous flex state, |
5449 |
* after forcing flex to go to body_state. |
|
85 | 5450 |
*/ |
5451 |
transition: |
|
131 | 5452 |
TRANSITION transition_priority |
85 | 5453 |
FROM steps TO steps |
5454 |
{cmd_goto_body_state();} transition_condition |
|
5455 |
END_TRANSITION |
|
131 | 5456 |
{$$ = new transition_c(NULL, $2, $4, $6, $8, locloc(@$));} |
85 | 5457 |
//| TRANSITION identifier FROM steps TO steps ... |
131 | 5458 |
| TRANSITION transition_name transition_priority |
85 | 5459 |
FROM steps TO steps |
5460 |
{cmd_goto_body_state();} transition_condition |
|
5461 |
END_TRANSITION |
|
131 | 5462 |
{$$ = new transition_c($2, $3, $5, $7, $9, locloc(@$));} |
5463 |
/* ERROR_CHECK_BEGIN */ |
|
5464 |
| TRANSITION error transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
|
136 | 5465 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid transition name defined in transition declaration."); yyerrok;} |
131 | 5466 |
| TRANSITION transition_name error FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5467 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid transition priority defined in transition declaration."); yyerrok;} |
131 | 5468 |
| TRANSITION transition_priority FROM TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5469 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no origin step(s) defined in transition declaration."); yynerrs++;} |
131 | 5470 |
| TRANSITION transition_name transition_priority FROM TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5471 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no origin step(s) defined in transition declaration."); yynerrs++;} |
131 | 5472 |
| TRANSITION transition_priority FROM error TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5473 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid origin step(s) defined in transition declaration."); yyerrok;} |
131 | 5474 |
| TRANSITION transition_name transition_priority FROM error TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5475 |
{$$ = NULL; print_err_msg(locf(@5), locl(@5), "invalid origin step(s) defined in transition declaration."); yyerrok;} |
131 | 5476 |
| TRANSITION transition_priority FROM steps steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5477 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "'TO' missing between origin step(s) and destination step(s) in transition declaration."); yynerrs++;} |
131 | 5478 |
| TRANSITION transition_name transition_priority FROM steps steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5479 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "'TO' missing between origin step(s) and destination step(s) in transition declaration."); yynerrs++;} |
131 | 5480 |
| TRANSITION transition_priority FROM steps TO {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5481 |
{$$ = NULL; print_err_msg(locl(@5), locf(@7), "no destination step(s) defined in transition declaration."); yynerrs++;} |
131 | 5482 |
| TRANSITION transition_name transition_priority FROM steps TO {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5483 |
{$$ = NULL; print_err_msg(locl(@6), locf(@8), "no destination step(s) defined in transition declaration."); yynerrs++;} |
131 | 5484 |
| TRANSITION transition_priority FROM steps TO error {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5485 |
{$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid destination step(s) defined in transition declaration."); yyerrok;} |
131 | 5486 |
| TRANSITION transition_name transition_priority FROM steps TO error {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5487 |
{$$ = NULL; print_err_msg(locf(@7), locl(@7), "invalid destination step(s) defined in transition declaration."); yyerrok;} |
131 | 5488 |
| TRANSITION transition_priority {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5489 |
{$$ = NULL; print_err_msg(locl(@2), locf(@4), "no origin and destination step(s) defined in transition declaration."); yynerrs++;} |
131 | 5490 |
| TRANSITION transition_name transition_priority {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5491 |
{$$ = NULL; print_err_msg(locl(@3), locf(@5), "no origin and destination step(s) defined in transition declaration."); yynerrs++;} |
5492 |
/*| TRANSITION transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition error END_OF_INPUT |
|
5493 |
{$$ = NULL; print_err_msg(locf(@1), locl(@6), "unclosed transition declaration."); yyerrok;} |
|
5494 |
| TRANSITION transition_name transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition error END_OF_INPUT |
|
5495 |
{$$ = NULL; print_err_msg(locf(@1), locl(@7), "unclosed transition declaration."); yyerrok;}*/ |
|
131 | 5496 |
| TRANSITION error END_TRANSITION |
136 | 5497 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in transition declaration."); yyerrok;} |
131 | 5498 |
/* ERROR_CHECK_END */ |
5499 |
; |
|
5500 |
||
5501 |
transition_priority: |
|
5502 |
/* empty */ |
|
5503 |
{$$ = NULL;} |
|
5504 |
| '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')' |
|
5505 |
{$$ = $6;} |
|
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
5506 |
/* ERROR_CHECK_BEGIN */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
5507 |
/* The following error checking rules have been intentionally commented out. */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
5508 |
/* |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5509 |
| '(' ASSIGN integer ')' |
136 | 5510 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'PRIORITY' missing between '(' and ':=' in transition declaration with priority."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5511 |
| '(' error ASSIGN integer ')' |
136 | 5512 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "expecting 'PRIORITY' between '(' and ':=' in transition declaration with priority."); yyerrok;} |
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
5513 |
*/ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
5514 |
/* ERROR_CHECK_END */ |
131 | 5515 |
; |
85 | 5516 |
|
5517 |
||
5518 |
transition_condition: |
|
10 | 5519 |
':' eol_list simple_instr_list |
88 | 5520 |
{$$ = new transition_condition_c($3, NULL, locloc(@$));} |
85 | 5521 |
| ASSIGN expression ';' |
88 | 5522 |
{$$ = new transition_condition_c(NULL, $2, locloc(@$));} |
131 | 5523 |
/* ERROR_CHECK_BEGIN */ |
5524 |
| eol_list simple_instr_list |
|
136 | 5525 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing before IL condition in transition declaration."); yynerrs++;} |
131 | 5526 |
| ':' eol_list error |
5527 |
{$$ = NULL; |
|
136 | 5528 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no instructions defined in IL condition of transition declaration.");} |
5529 |
else {print_err_msg(locf(@3), locl(@3), "invalid instructions in IL condition of transition declaration."); yyclearin;} |
|
131 | 5530 |
yyerrok; |
5531 |
} |
|
5532 |
| ASSIGN ';' |
|
136 | 5533 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no expression defined in ST condition of transition declaration."); yynerrs++;} |
131 | 5534 |
| ASSIGN error ';' |
136 | 5535 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid expression defined in ST condition of transition declaration."); yyerrok;} |
131 | 5536 |
| ASSIGN expression error |
136 | 5537 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "expecting ';' after expression defined in ST condition of transition declaration."); yyerrok;} |
131 | 5538 |
/* ERROR_CHECK_END */ |
10 | 5539 |
; |
3 | 5540 |
|
68 | 5541 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5542 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5543 |
action: |
85 | 5544 |
// ACTION identifier ':' ... |
151 | 5545 |
ACTION action_name {cmd_goto_body_state();} action_body END_ACTION |
5546 |
{$$ = new action_c($2, $4, locloc(@$));} |
|
5547 |
/* ERROR_CHECK_BEGIN */ |
|
5548 |
| ACTION {cmd_goto_body_state();} action_body END_ACTION |
|
5549 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "no action name defined in action declaration."); yynerrs++;} |
|
5550 |
| ACTION error {cmd_goto_body_state();} action_body END_ACTION |
|
136 | 5551 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid action name defined in action declaration."); yyerrok;} |
131 | 5552 |
| ACTION action_name {cmd_goto_body_state();} function_block_body END_ACTION |
136 | 5553 |
{$$ = NULL; print_err_msg(locl(@2), locf(@4), "':' missing after action name in action declaration."); yynerrs++;} |
151 | 5554 |
/*| ACTION action_name {cmd_goto_body_state();} action_body END_OF_INPUT |
5555 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed action declaration."); yyerrok;}*/ |
|
131 | 5556 |
| ACTION error END_ACTION |
136 | 5557 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in action declaration."); yyerrok;} |
131 | 5558 |
/* ERROR_CHECK_END */ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5559 |
; |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5560 |
|
151 | 5561 |
action_body: |
5562 |
':' function_block_body |
|
5563 |
{$$ = $2;} |
|
5564 |
/* ERROR_CHECK_BEGIN */ |
|
5565 |
| ':' error |
|
5566 |
{$$ = NULL; |
|
5567 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no body defined in action declaration.");} |
|
5568 |
else {print_err_msg(locf(@2), locl(@2), "invalid body defined in action declaration."); yyclearin;} |
|
5569 |
yyerrok; |
|
5570 |
} |
|
5571 |
/* ERROR_CHECK_END */ |
|
5572 |
; |
|
5573 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5574 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5575 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5576 |
/* B 1.7 Configuration elements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5577 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5578 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5579 |
* It is not clear from reading the specification to which namespace |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5580 |
* the names of resources, tasks and programs belong to. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5581 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5582 |
* The following syntax assumes that resource and program names belong to the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5583 |
* same namespace as the variables defined within |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5584 |
* the resource/configuration (i.e. VAR_GLOBAL). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5585 |
* Task names belong to a namespace all of their own, since they don't |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5586 |
* produce conflicts in the syntax parser, so we might just as well |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5587 |
* leave them be! ;-) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5588 |
* The above decision was made taking into |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5589 |
* account that inside a VAR_CONFIG declaration global variables |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5590 |
* may be referenced starting off from the resource name as: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5591 |
* resource_name.program_name.variable_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5592 |
* Notice how resource names and program names are used in a very similar |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5593 |
* manner as are variable names. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5594 |
* Using a single namespace for all the above mentioned names |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5595 |
* also makes it easier to write the syntax parser!! ;-) Using a private |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5596 |
* namespace for each of the name types (resource names, program names, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5597 |
* global varaiable names), i.e. letting the names be re-used across |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5598 |
* each of the groups (resource, program, global variables), produces |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5599 |
* reduce/reduce conflicts in the syntax parser. Actually, it is only |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5600 |
* the resource names that need to be distinguished into a |
131 | 5601 |
* prev_declared_resource_name so as not to conflict with [gloabl] variable |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5602 |
* names in the 'data' construct. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5603 |
* The program names are only tracked to make sure that two programs do not |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5604 |
* get the same name. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5605 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5606 |
* Using a single namespace does have the drawback that the user will |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5607 |
* not be able to re-use names for resources or programs if these |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5608 |
* have already been used to name a variable! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5609 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5610 |
* If it ever becomes necessary to change this interpretation of |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5611 |
* the syntax, then this section of the syntax parser must be updated! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5612 |
*/ |
68 | 5613 |
prev_declared_global_var_name: prev_declared_global_var_name_token {$$ = new identifier_c($1, locloc(@$));}; |
5614 |
prev_declared_resource_name: prev_declared_resource_name_token {$$ = new identifier_c($1, locloc(@$));}; |
|
5615 |
prev_declared_program_name: prev_declared_program_name_token {$$ = new identifier_c($1, locloc(@$));}; |
|
5616 |
// prev_declared_task_name: prev_declared_task_name_token {$$ = new identifier_c($1, locloc(@$));}; |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5617 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5618 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5619 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5620 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5621 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5622 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5623 |
configuration_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5624 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5625 |
/* NOTE: The specification states that valid resource type names |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5626 |
* are implementation defined, i.e. each implementaion will define |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5627 |
* what resource types it supports. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5628 |
* We are implementing this syntax parser to be used by any |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5629 |
* implementation, so at the moment we accept any identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5630 |
* as a resource type name. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5631 |
* This implementation should probably be changed in the future. We |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5632 |
* should probably have a resource_type_name_token, and let the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5633 |
* implementation load the global symbol library with the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5634 |
* accepted resource type names before parsing the code. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5635 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5636 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5637 |
resource_type_name: any_identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5638 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5639 |
configuration_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5640 |
CONFIGURATION configuration_name |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5641 |
global_var_declarations_list |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5642 |
single_resource_declaration |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5643 |
{variable_name_symtable.pop(); |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5644 |
direct_variable_symtable.pop();} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5645 |
optional_access_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5646 |
optional_instance_specific_initializations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5647 |
END_CONFIGURATION |
68 | 5648 |
{$$ = new configuration_declaration_c($2, $3, $4, $6, $7, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5649 |
library_element_symtable.insert($2, prev_declared_configuration_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5650 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5651 |
direct_variable_symtable.pop(); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5652 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5653 |
| CONFIGURATION configuration_name |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5654 |
global_var_declarations_list |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5655 |
resource_declaration_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5656 |
optional_access_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5657 |
optional_instance_specific_initializations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5658 |
END_CONFIGURATION |
68 | 5659 |
{$$ = new configuration_declaration_c($2, $3, $4, $5, $6, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5660 |
library_element_symtable.insert($2, prev_declared_configuration_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5661 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5662 |
direct_variable_symtable.pop(); |
85 | 5663 |
} |
68 | 5664 |
/* ERROR_CHECK_BEGIN */ |
131 | 5665 |
| CONFIGURATION |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5666 |
global_var_declarations_list |
131 | 5667 |
single_resource_declaration |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5668 |
{variable_name_symtable.pop(); |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5669 |
direct_variable_symtable.pop();} |
131 | 5670 |
optional_access_declarations |
5671 |
optional_instance_specific_initializations |
|
5672 |
END_CONFIGURATION |
|
136 | 5673 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no configuration name defined in configuration declaration."); yynerrs++;} |
131 | 5674 |
| CONFIGURATION |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5675 |
global_var_declarations_list |
131 | 5676 |
resource_declaration_list |
5677 |
optional_access_declarations |
|
5678 |
optional_instance_specific_initializations |
|
5679 |
END_CONFIGURATION |
|
136 | 5680 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no configuration name defined in configuration declaration."); yynerrs++;} |
131 | 5681 |
| CONFIGURATION error |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5682 |
global_var_declarations_list |
131 | 5683 |
single_resource_declaration |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5684 |
{variable_name_symtable.pop(); |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5685 |
direct_variable_symtable.pop();} |
131 | 5686 |
optional_access_declarations |
5687 |
optional_instance_specific_initializations |
|
5688 |
END_CONFIGURATION |
|
136 | 5689 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid configuration name defined in configuration declaration."); yyerrok;} |
131 | 5690 |
| CONFIGURATION error |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5691 |
global_var_declarations_list |
131 | 5692 |
resource_declaration_list |
5693 |
optional_access_declarations |
|
5694 |
optional_instance_specific_initializations |
|
5695 |
END_CONFIGURATION |
|
136 | 5696 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid configuration name defined in configuration declaration."); yyerrok;} |
131 | 5697 |
| CONFIGURATION configuration_name |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5698 |
global_var_declarations_list |
131 | 5699 |
optional_access_declarations |
5700 |
optional_instance_specific_initializations |
|
5701 |
END_CONFIGURATION |
|
136 | 5702 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no resource(s) defined in configuration declaration."); yynerrs++;} |
131 | 5703 |
| CONFIGURATION configuration_name |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5704 |
global_var_declarations_list |
131 | 5705 |
error |
5706 |
optional_access_declarations |
|
5707 |
optional_instance_specific_initializations |
|
5708 |
END_CONFIGURATION |
|
136 | 5709 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid resource(s) defined in configuration declaration."); yyerrok;} |
5710 |
/*| CONFIGURATION configuration_name |
|
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5711 |
global_var_declarations_list |
136 | 5712 |
single_resource_declaration |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5713 |
{variable_name_symtable.pop(); |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5714 |
direct_variable_symtable.pop();} |
136 | 5715 |
optional_access_declarations |
5716 |
optional_instance_specific_initializations |
|
5717 |
END_OF_INPUT |
|
5718 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed configuration declaration."); yyerrok;}*/ |
|
5719 |
| CONFIGURATION configuration_name |
|
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5720 |
global_var_declarations_list |
136 | 5721 |
resource_declaration_list |
5722 |
optional_access_declarations |
|
5723 |
optional_instance_specific_initializations |
|
5724 |
END_OF_INPUT |
|
5725 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed configuration declaration."); yyerrok;} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5726 |
| CONFIGURATION error END_CONFIGURATION |
136 | 5727 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in configuration declaration."); yyerrok;} |
68 | 5728 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5729 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5730 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5731 |
// helper symbol for |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5732 |
// - configuration_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5733 |
// - resource_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5734 |
// |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5735 |
/* NOTE: The IEC 61131-3 v2 standard defines this list as being: [global_var_declarations] |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5736 |
* e.g.: |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5737 |
* 'CONFIGURATION' configuration_name [global_var_declarations] ... |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5738 |
* |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5739 |
* However, this means that a single VAR_GLOBAL ... END_VAR construct is allowed |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5740 |
* in each CONFIGURATION or RESOURCE declaration. If the user wishes to have global |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5741 |
* variables with distinct properties (e.g. some with RETAIN, others with CONSTANT, |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5742 |
* and yet other variables with none of these qualifiers), the syntax defined in the |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5743 |
* standard does not allow this. |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5744 |
* Amazingly, IEC 61131-3 v3 also does not seem to allow it either!! |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5745 |
* Since this is most likely a bug in the standard, we are changing the syntax slightly |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5746 |
* to become: |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5747 |
* 'CONFIGURATION' configuration_name {global_var_declarations} ... |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5748 |
* |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5749 |
* Remember that: |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5750 |
* {S}, closure, meaning zero or more concatenations of S. |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5751 |
* [S], option, meaning zero or one occurrence of S. |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5752 |
*/ |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5753 |
global_var_declarations_list: |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5754 |
// empty |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5755 |
{$$ = new global_var_declarations_list_c(locloc(@$));} |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5756 |
| global_var_declarations_list global_var_declarations |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5757 |
{$$ = $1; $$->add_element($2);} |
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5758 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5759 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5760 |
// helper symbol for configuration_declaration // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5761 |
optional_access_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5762 |
// empty |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5763 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5764 |
//| access_declarations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5765 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5766 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5767 |
// helper symbol for configuration_declaration // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5768 |
optional_instance_specific_initializations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5769 |
// empty |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5770 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5771 |
| instance_specific_initializations |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5772 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5773 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5774 |
// helper symbol for configuration_declaration // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5775 |
resource_declaration_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5776 |
resource_declaration |
68 | 5777 |
{$$ = new resource_declaration_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5778 |
| resource_declaration_list resource_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5779 |
{$$ = $1; $$->add_element($2);} |
131 | 5780 |
/* ERROR_CHECK_BEGIN */ |
5781 |
| resource_declaration_list error |
|
136 | 5782 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected token after resource declaration."); yyerrok;} |
131 | 5783 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5784 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5785 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5786 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5787 |
resource_declaration: |
811
970c582885bf
Allow variables declared inside resources to be referenced by res_name.var_name
Mario de Sousa <msousa@fe.up.pt>
parents:
810
diff
changeset
|
5788 |
RESOURCE {variable_name_symtable.push();direct_variable_symtable.push();} resource_name {variable_name_symtable.insert($3, prev_declared_resource_name_token);} ON resource_type_name |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5789 |
global_var_declarations_list |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5790 |
single_resource_declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5791 |
END_RESOURCE |
811
970c582885bf
Allow variables declared inside resources to be referenced by res_name.var_name
Mario de Sousa <msousa@fe.up.pt>
parents:
810
diff
changeset
|
5792 |
{$$ = new resource_declaration_c($3, $6, $7, $8, locloc(@$)); |
13 | 5793 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5794 |
direct_variable_symtable.pop(); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5795 |
variable_name_symtable.insert($3, prev_declared_resource_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5796 |
} |
131 | 5797 |
/* ERROR_CHECK_BEGIN */ |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5798 |
| RESOURCE {variable_name_symtable.push();direct_variable_symtable.push();} ON resource_type_name |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5799 |
global_var_declarations_list |
131 | 5800 |
single_resource_declaration |
5801 |
END_RESOURCE |
|
136 | 5802 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "no resource name defined in resource declaration."); yynerrs++;} |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5803 |
/*| RESOURCE {variable_name_symtable.push();direct_variable_symtable.push();} resource_name ON resource_type_name |
862
2b6b1202f8a8
Fix bug in standard: standard does not allow multiple VAR_GLOBAL ... END_VAR constructs in configurations and resources. This is probably a bug, so we allow it.
mjsousa
parents:
823
diff
changeset
|
5804 |
global_var_declarations_list |
136 | 5805 |
single_resource_declaration |
5806 |
END_OF_INPUT |
|
5807 |
{$$ = NULL; print_err_msg(locf(@1), locl(@5), "unclosed resource declaration."); yyerrok;}*/ |
|
131 | 5808 |
| RESOURCE error END_RESOURCE |
136 | 5809 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in resource declaration."); yyerrok;} |
131 | 5810 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5811 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5812 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5813 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5814 |
single_resource_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5815 |
task_configuration_list program_configuration_list |
68 | 5816 |
{$$ = new single_resource_declaration_c($1, $2, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5817 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5818 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5819 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5820 |
// helper symbol for single_resource_declaration // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5821 |
task_configuration_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5822 |
// empty |
68 | 5823 |
{$$ = new task_configuration_list_c(locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5824 |
| task_configuration_list task_configuration ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5825 |
{$$ = $1; $$->add_element($2);} |
131 | 5826 |
/* ERROR_CHECK_BEGIN */ |
5827 |
| task_configuration_list task_configuration error |
|
136 | 5828 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "';' missing at the end of task configuration in resource declaration."); yyerrok;} |
131 | 5829 |
| task_configuration_list ';' |
136 | 5830 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after task configuration in resource declaration."); yynerrs++;} |
131 | 5831 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5832 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5833 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5834 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5835 |
// helper symbol for single_resource_declaration // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5836 |
program_configuration_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5837 |
program_configuration ';' |
68 | 5838 |
{$$ = new program_configuration_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5839 |
| program_configuration_list program_configuration ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5840 |
{$$ = $1; $$->add_element($2);} |
131 | 5841 |
/* ERROR_CHECK_BEGIN */ |
5842 |
| program_configuration error |
|
136 | 5843 |
{$$ = new program_configuration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at the end of program configuration in resource declaration."); yyerrok;} |
131 | 5844 |
| program_configuration_list program_configuration error |
136 | 5845 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at the end of program configuration in resource declaration."); yyerrok;} |
133 | 5846 |
| program_configuration_list error ';' |
136 | 5847 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid program configuration in resource declaration."); yyerrok;} |
131 | 5848 |
| program_configuration_list ';' |
136 | 5849 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after program configuration in resource declaration."); yynerrs++;} |
131 | 5850 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5851 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5852 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5853 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5854 |
resource_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5855 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5856 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5857 |
access_declarations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5858 |
VAR_ACCESS access_declaration_list END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5859 |
{$$ = NULL;} |
131 | 5860 |
// ERROR_CHECK_BEGIN // |
5861 |
| VAR_ACCESS END_VAR |
|
136 | 5862 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in access variable(s) declaration."); yynerrs++;} |
131 | 5863 |
| VAR_ACCESS error access_declaration_list END_VAR |
136 | 5864 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_ACCESS' in access variable(s) declaration."); yyerrok;} |
5865 |
| VAR_ACCESS access_declaration_list error END_VAR |
|
5866 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed access variable(s) declaration."); yyerrok;} |
|
131 | 5867 |
| VAR_ACCESS error END_VAR |
136 | 5868 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in access variable(s) declaration."); yyerrok;} |
131 | 5869 |
// ERROR_CHECK_END // |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5870 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5871 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5872 |
// helper symbol for access_declarations // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5873 |
access_declaration_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5874 |
access_declaration ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5875 |
| access_declaration_list access_declaration ';' |
131 | 5876 |
// ERROR_CHECK_BEGIN // |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5877 |
| error ';' |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5878 |
{$$ = // create a new list //; |
136 | 5879 |
print_err_msg(locf(@1), locl(@1), "invalid access variable declaration."); yyerrok;} |
131 | 5880 |
| access_declaration error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5881 |
{$$ = // create a new list //; |
136 | 5882 |
print_err_msg(locl(@1), locf(@2), "';' missing at the end of access variable declaration."); yyerrok;} |
131 | 5883 |
| access_declaration_list access_declaration error |
136 | 5884 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at the end of access variable declaration."); yyerrok;} |
133 | 5885 |
| access_declaration_list error ';' |
136 | 5886 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid access variable declaration."); yyerrok;} |
131 | 5887 |
| access_declaration_list ';' |
136 | 5888 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after access variable declaration."); yynerrs++;} |
131 | 5889 |
// ERROR_CHECK_END // |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5890 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5891 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5892 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5893 |
access_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5894 |
access_name ':' access_path ':' non_generic_type_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5895 |
| access_name ':' access_path ':' non_generic_type_name direction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5896 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5897 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5898 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5899 |
access_path: |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5900 |
prev_declared_direct_variable |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5901 |
| prev_declared_resource_name '.' prev_declared_direct_variable |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5902 |
| any_fb_name_list symbolic_variable |
131 | 5903 |
| prev_declared_resource_name '.' any_fb_name_list symbolic_variable |
5904 |
| prev_declared_program_name '.' any_fb_name_list symbolic_variable |
|
5905 |
| prev_declared_resource_name '.' prev_declared_program_name '.' any_fb_name_list symbolic_variable |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5906 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5907 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5908 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5909 |
// helper symbol for |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5910 |
// - access_path |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5911 |
// - instance_specific_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5912 |
// |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5913 |
/* NOTE: The fb_name_list refers to funtion block variables |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5914 |
* that have been declared in a scope outside the one we are |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5915 |
* currently parsing, so we must accept them to be any_identifier! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5916 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5917 |
* Beware that other locations of this syntax parser also require |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5918 |
* a fb_name_list. In those locations the function blocks are being declared, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5919 |
* so only currently un-used identifiers (i.e. identifier) may be accepted. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5920 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5921 |
* In order to distinguish the two, here we use any_fb_name_list, while |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5922 |
* in the the locations we simply use fb_name_list! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5923 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5924 |
any_fb_name_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5925 |
// empty |
68 | 5926 |
{$$ = new any_fb_name_list_c(locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5927 |
//| fb_name_list fb_name '.' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5928 |
| any_fb_name_list any_identifier '.' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5929 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5930 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5931 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5932 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5933 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5934 |
global_var_reference: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5935 |
// [resource_name '.'] global_var_name ['.' structure_element_name] // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5936 |
prev_declared_global_var_name |
68 | 5937 |
{$$ = new global_var_reference_c(NULL, $1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5938 |
| prev_declared_global_var_name '.' structure_element_name |
68 | 5939 |
{$$ = new global_var_reference_c(NULL, $1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5940 |
| prev_declared_resource_name '.' prev_declared_global_var_name |
68 | 5941 |
{$$ = new global_var_reference_c($1, $3, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5942 |
| prev_declared_resource_name '.' prev_declared_global_var_name '.' structure_element_name |
68 | 5943 |
{$$ = new global_var_reference_c($1, $3, $5, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5944 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5945 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5946 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5947 |
//access_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5948 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5949 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5950 |
program_output_reference: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5951 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5952 |
* program_output_reference is merely used within data_source. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5953 |
* data_source is merely used within task_initialization |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5954 |
* task_initialization appears in a configuration declaration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5955 |
* _before_ the programs are declared, so we cannot use |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5956 |
* prev_declared_program_name, as what might seem correct at first. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5957 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5958 |
* The semantic checker must later check whether the identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5959 |
* used really refers to a program declared after the task |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5960 |
* initialization! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5961 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5962 |
// prev_declared_program_name '.' symbolic_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5963 |
program_name '.' symbolic_variable |
68 | 5964 |
{$$ = new program_output_reference_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5965 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5966 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5967 |
program_name: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5968 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5969 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5970 |
direction: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5971 |
READ_WRITE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5972 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5973 |
| READ_ONLY |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5974 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5975 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5976 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5977 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5978 |
task_configuration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5979 |
TASK task_name task_initialization |
68 | 5980 |
{$$ = new task_configuration_c($2, $3, locloc(@$));} |
131 | 5981 |
/* ERROR_CHECK_BEGIN */ |
5982 |
| TASK task_initialization |
|
136 | 5983 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no task name defined in task declaration."); yynerrs++;} |
131 | 5984 |
| TASK error task_initialization |
136 | 5985 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid task name defined in task declaration."); yyerrok;} |
131 | 5986 |
| TASK task_name error |
5987 |
{$$ = NULL; |
|
136 | 5988 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no task initialization defined in task declaration.");} |
5989 |
else {print_err_msg(locf(@3), locl(@3), "invalid task initialization in task declaration."); yyclearin;} |
|
131 | 5990 |
yyerrok; |
5991 |
} |
|
5992 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5993 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5994 |
|
75 | 5995 |
/* NOTE: The specification does not mention the namespace to which task names |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5996 |
* should belong to. Unlike resource and program names, for the moment we |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5997 |
* let the task names belong to their own private namespace, as they do not |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5998 |
* produce any conflicts in the syntax parser. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5999 |
* If in the future our interpretation of the spec. turns out to be incorrect, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6000 |
* the definition of task_name may have to be changed! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6001 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6002 |
task_name: any_identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6003 |
|
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6004 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6005 |
task_initialization: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6006 |
// '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' // |
75 | 6007 |
'(' {cmd_goto_task_init_state();} task_initialization_single task_initialization_interval task_initialization_priority ')' |
6008 |
{$$ = new task_initialization_c($3, $4, $5, locloc(@$));} |
|
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6009 |
; |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6010 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6011 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6012 |
task_initialization_single: |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6013 |
// [SINGLE ASSIGN data_source ','] |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6014 |
/* empty */ |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6015 |
{$$ = NULL;} |
75 | 6016 |
| SINGLE ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} |
6017 |
{$$ = $4;} |
|
131 | 6018 |
/* ERROR_CHECK_BEGIN */ |
6019 |
| SINGLE {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} |
|
136 | 6020 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "':=' missing after 'SINGLE' in task initialization."); yynerrs++;} |
131 | 6021 |
| SINGLE ASSIGN {cmd_pop_state();} ',' {cmd_goto_task_init_state();} |
136 | 6022 |
{$$ = NULL; print_err_msg(locl(@2), locf(@4), "no data source defined in 'SINGLE' statement of task initialization."); yynerrs++;} |
131 | 6023 |
| SINGLE ASSIGN {cmd_pop_state();} error ',' {cmd_goto_task_init_state();} |
136 | 6024 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid data source defined in 'SINGLE' statement of task initialization."); yyerrok;} |
131 | 6025 |
/* ERROR_CHECK_END */ |
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6026 |
; |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6027 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6028 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6029 |
task_initialization_interval: |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6030 |
// [INTERVAL ASSIGN data_source ','] |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6031 |
/* empty */ |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6032 |
{$$ = NULL;} |
75 | 6033 |
| INTERVAL ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} |
6034 |
{$$ = $4;} |
|
131 | 6035 |
/* ERROR_CHECK_BEGIN */ |
6036 |
| INTERVAL {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} |
|
136 | 6037 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "':=' missing after 'INTERVAL' in task initialization.");} |
131 | 6038 |
| INTERVAL ASSIGN {cmd_pop_state();} ',' {cmd_goto_task_init_state();} |
136 | 6039 |
{$$ = NULL; print_err_msg(locl(@2), locf(@4), "no data source defined in 'INTERVAL' statement of task initialization."); yynerrs++;} |
131 | 6040 |
| INTERVAL ASSIGN {cmd_pop_state();} error ',' {cmd_goto_task_init_state();} |
136 | 6041 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid data source defined in 'INTERVAL' statement of task initialization."); yyerrok;} |
131 | 6042 |
/* ERROR_CHECK_END */ |
75 | 6043 |
; |
6044 |
||
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6045 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6046 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6047 |
task_initialization_priority: |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6048 |
// PRIORITY ASSIGN integer |
75 | 6049 |
PRIORITY ASSIGN {cmd_pop_state();} integer |
6050 |
{$$ = $4;} |
|
131 | 6051 |
/* ERROR_CHECK_BEGIN */ |
6052 |
| PRIORITY {cmd_pop_state();} integer |
|
136 | 6053 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "':=' missing after 'PRIORITY' in task initialization."); yynerrs++;} |
131 | 6054 |
| PRIORITY ASSIGN {cmd_pop_state();} error |
6055 |
{$$ = NULL; |
|
136 | 6056 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@4), "no priority number defined in 'PRIORITY' statement of task initialization.");} |
6057 |
else {print_err_msg(locf(@4), locl(@4), "invalid priority number in 'PRIORITY' statement of task initialization."); yyclearin;} |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
6058 |
yyerrok; |
131 | 6059 |
} |
6060 |
/* ERROR_CHECK_END */ |
|
75 | 6061 |
; |
6062 |
||
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6063 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6064 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6065 |
data_source: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6066 |
constant |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6067 |
| global_var_reference |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6068 |
| program_output_reference |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6069 |
| prev_declared_direct_variable |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6070 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6071 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6072 |
program_configuration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6073 |
// PROGRAM [RETAIN | NON_RETAIN] program_name [WITH task_name] ':' program_type_name ['(' prog_conf_elements ')'] // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6074 |
PROGRAM program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
68 | 6075 |
{$$ = new program_configuration_c(NULL, $2, $3, $5, $6, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6076 |
variable_name_symtable.insert($2, prev_declared_program_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6077 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6078 |
| PROGRAM RETAIN program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
68 | 6079 |
{$$ = new program_configuration_c(new retain_option_c(locloc(@2)), $3, $4, $6, $7, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6080 |
variable_name_symtable.insert($3, prev_declared_program_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6081 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6082 |
| PROGRAM NON_RETAIN program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
68 | 6083 |
{$$ = new program_configuration_c(new non_retain_option_c(locloc(@2)), $3, $4, $6, $7, locloc(@$)); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6084 |
variable_name_symtable.insert($3, prev_declared_program_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6085 |
} |
131 | 6086 |
/* ERROR_CHECK_BEGIN */ |
6087 |
| PROGRAM program_name optional_task_name ':' identifier optional_prog_conf_elements |
|
136 | 6088 |
{$$ = NULL; print_err_msg(locf(@5), locl(@5), "invalid program type name after ':' in program configuration."); yynerrs++;} |
131 | 6089 |
| PROGRAM RETAIN program_name optional_task_name ':' identifier optional_prog_conf_elements |
136 | 6090 |
{$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid program type name after ':' in program configuration."); yynerrs++;} |
131 | 6091 |
| PROGRAM NON_RETAIN program_name optional_task_name ':' identifier optional_prog_conf_elements |
136 | 6092 |
{$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid program type name after ':' in program configuration."); yynerrs++;} |
131 | 6093 |
| PROGRAM error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6094 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'PROGRAM' in program configuration."); yyerrok;} |
131 | 6095 |
| PROGRAM RETAIN error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6096 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive program configuration."); yyerrok;} |
131 | 6097 |
| PROGRAM NON_RETAIN error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6098 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive program configuration."); yyerrok;} |
131 | 6099 |
| PROGRAM optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6100 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no program name defined in program configuration."); yynerrs++;} |
131 | 6101 |
| PROGRAM RETAIN optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6102 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no program name defined in retentive program configuration."); yynerrs++;} |
131 | 6103 |
| PROGRAM NON_RETAIN optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6104 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no program name defined in non-retentive program configuration."); yynerrs++;} |
131 | 6105 |
| PROGRAM error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6106 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid program name defined in program configuration."); yyerrok;} |
131 | 6107 |
| PROGRAM RETAIN error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6108 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid program name defined in retentive program configuration."); yyerrok;} |
131 | 6109 |
| PROGRAM NON_RETAIN error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6110 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid program name defined in non-retentive program configuration."); yyerrok;} |
131 | 6111 |
| PROGRAM program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements |
136 | 6112 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "':' missing after program name or optional task name in program configuration."); yynerrs++;} |
131 | 6113 |
| PROGRAM RETAIN program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements |
136 | 6114 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "':' missing after program name or optional task name in retentive program configuration."); yynerrs++;} |
131 | 6115 |
| PROGRAM NON_RETAIN program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements |
136 | 6116 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "':' missing after program name or optional task name in non-retentive program configuration."); yynerrs++;} |
131 | 6117 |
| PROGRAM program_name optional_task_name ':' optional_prog_conf_elements |
136 | 6118 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no program type defined in program configuration."); yynerrs++;} |
131 | 6119 |
| PROGRAM RETAIN program_name optional_task_name ':' optional_prog_conf_elements |
136 | 6120 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "no program type defined in retentive program configuration."); yynerrs++;} |
131 | 6121 |
| PROGRAM NON_RETAIN program_name optional_task_name ':' optional_prog_conf_elements |
136 | 6122 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "no program type defined in non-retentive program configuration."); yynerrs++;} |
131 | 6123 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6124 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6125 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6126 |
// helper symbol for program_configuration // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6127 |
optional_task_name: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6128 |
// empty // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6129 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6130 |
| WITH task_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6131 |
{$$ = $2;} |
131 | 6132 |
/* ERROR_CHECK_BEGIN */ |
6133 |
| WITH error |
|
6134 |
{$$ = NULL; |
|
136 | 6135 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no task name defined in optional task name of program configuration.");} |
6136 |
else {print_err_msg(locf(@2), locl(@2), "invalid task name in optional task name of program configuration."); yyclearin;} |
|
131 | 6137 |
yyerrok; |
6138 |
} |
|
6139 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6140 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6141 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6142 |
// helper symbol for program_configuration // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6143 |
optional_prog_conf_elements: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6144 |
// empty // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6145 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6146 |
| '(' prog_conf_elements ')' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6147 |
{$$ = $2;} |
131 | 6148 |
/* ERROR_CHECK_BEGIN */ |
6149 |
| '(' error ')' |
|
136 | 6150 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid program configuration elements in program configuration."); yyerrok;} |
131 | 6151 |
| '(' prog_conf_elements error |
136 | 6152 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of program configuration elements in program configuration."); yyerrok;} |
131 | 6153 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6154 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6155 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6156 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6157 |
prog_conf_elements: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6158 |
prog_conf_element |
68 | 6159 |
{$$ = new prog_conf_elements_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6160 |
| prog_conf_elements ',' prog_conf_element |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6161 |
{$$ = $1; $$->add_element($3);} |
131 | 6162 |
/* ERROR_CHECK_BEGIN */ |
6163 |
| prog_conf_elements prog_conf_element |
|
136 | 6164 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in program configuration elements list."); yynerrs++;} |
131 | 6165 |
| prog_conf_elements ',' error |
136 | 6166 |
{$$ = $1; |
6167 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for program configuration element in program configuration list.");} |
|
6168 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for program configuration element in program configuration list."); yyclearin;} |
|
131 | 6169 |
yyerrok; |
6170 |
} |
|
6171 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6172 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6173 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6174 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6175 |
prog_conf_element: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6176 |
fb_task |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6177 |
| prog_cnxn |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6178 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6179 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6180 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6181 |
fb_task: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6182 |
// fb_name WITH task_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6183 |
/* NOTE: The fb_name refers to funtion block variables |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6184 |
* that have been declared in a scope outside the one we are |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6185 |
* currently parsing, so we must accept them to be any_identifier! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6186 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6187 |
any_identifier WITH task_name |
68 | 6188 |
{$$ = new fb_task_c($1, $3, locloc(@$));} |
131 | 6189 |
/* ERROR_CHECK_BEGIN */ |
6190 |
| any_identifier WITH error |
|
6191 |
{$$ = NULL; |
|
136 | 6192 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no task name defined in function block configuration.");} |
6193 |
else {print_err_msg(locf(@3), locl(@3), "invalid task name in function block configuration."); yyclearin;} |
|
131 | 6194 |
yyerrok; |
6195 |
} |
|
6196 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6197 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6198 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6199 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6200 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6201 |
* The semantics of configuring a program are rather confusing, so here is |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6202 |
* my (Mario) understanding on the issue... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6203 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6204 |
* A function/program may have as its input variables a simple variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6205 |
* (BYTE, WORD, etc...), an array (ARRAY [1 .. 3] OF BYTE, ...) , or a structure. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6206 |
* Nevertheless, when calling this function from within a st or il language statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6207 |
* it is not possible to allocate a value to a single element of the array or structure |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6208 |
* typed input variable, as the accepted syntax is simply '(' variable_name ':=' variable ')' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6209 |
* Notice how the variable_name does not include things such as 'a.elem1' or 'a[1]'! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6210 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6211 |
* Nevertheless, when configuring a program from within a configuration, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6212 |
* it becomes possible to allocate values to individual elements of the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6213 |
* array or structured type input variable, as the syntax is now |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6214 |
* '(' symbolic_variable ':=' data_sink|prog_data_source ')' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6215 |
* Notice how the symbolic_variable _does_ include things such as 'a.elem1' or 'a[1]'! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6216 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6217 |
* Conclusion: Unlike other locations in the syntax where SENDTO appears, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6218 |
* here it is not valid to replace symbolic_variable with any_identifier! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6219 |
* Nevertheless, it is also not correct to leave symbolic_variable as it is, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6220 |
* as we have defined it to only include previously declared variables, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6221 |
* which is not the case in this situation. Here symbolic_variable is refering |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6222 |
* to variables that were defined within the scope of the program that is being |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6223 |
* called, and _not_ within the scope of the configuration that is calling the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6224 |
* program, so the variables in question are not declared in the current scope! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6225 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6226 |
* We therefore need to define a new symbolic_variable, that accepts any_identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6227 |
* instead of previosuly declared variable names, to be used in the definition of |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6228 |
* prog_cnxn! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6229 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6230 |
prog_cnxn: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6231 |
any_symbolic_variable ASSIGN prog_data_source |
68 | 6232 |
{$$ = new prog_cnxn_assign_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6233 |
| any_symbolic_variable SENDTO data_sink |
68 | 6234 |
{$$ = new prog_cnxn_sendto_c($1, $3, locloc(@$));} |
131 | 6235 |
/* ERROR_CHECK_BEGIN */ |
6236 |
| any_symbolic_variable constant |
|
136 | 6237 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing between parameter and value in program configuration element."); yynerrs++;} |
131 | 6238 |
| any_symbolic_variable enumerated_value |
136 | 6239 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing between parameter and value in program configuration element."); yynerrs++;} |
131 | 6240 |
| any_symbolic_variable data_sink |
136 | 6241 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' or '=>' missing between parameter and variable in program configuration element."); yynerrs++;} |
131 | 6242 |
| any_symbolic_variable ASSIGN error |
6243 |
{$$ = NULL; |
|
136 | 6244 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value or variable defined in program configuration assignment element.");} |
6245 |
else {print_err_msg(locf(@3), locl(@3), "invalid value or variable in program configuration assignment element."); yyclearin;} |
|
131 | 6246 |
yyerrok; |
6247 |
} |
|
6248 |
| any_symbolic_variable SENDTO error |
|
6249 |
{$$ = NULL; |
|
136 | 6250 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no variable defined in program configuration sendto element.");} |
6251 |
else {print_err_msg(locf(@3), locl(@3), "invalid variable in program configuration sendto element."); yyclearin;} |
|
131 | 6252 |
yyerrok; |
6253 |
} |
|
6254 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6255 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6256 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6257 |
prog_data_source: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6258 |
constant |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6259 |
| enumerated_value |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6260 |
| global_var_reference |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6261 |
| prev_declared_direct_variable |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6262 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6263 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6264 |
data_sink: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6265 |
global_var_reference |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6266 |
| prev_declared_direct_variable |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6267 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6268 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6269 |
instance_specific_initializations: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6270 |
VAR_CONFIG instance_specific_init_list END_VAR |
68 | 6271 |
{$$ = new instance_specific_initializations_c($2, locloc(@$));} |
131 | 6272 |
/* ERROR_CHECK_BEGIN */ |
6273 |
| VAR_CONFIG END_VAR |
|
136 | 6274 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in configuration variable(s) initialization."); yynerrs++;} |
131 | 6275 |
| VAR_CONFIG error instance_specific_init_list END_VAR |
136 | 6276 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_CONFIG' in configuration variable(s) initialization."); yyerrok;} |
6277 |
| VAR_CONFIG instance_specific_init_list error END_OF_INPUT |
|
6278 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed configuration variable(s) initialization."); yyerrok;} |
|
131 | 6279 |
| VAR_CONFIG error END_VAR |
136 | 6280 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in configuration variable(s) initialization."); yyerrok;} |
131 | 6281 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6282 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6283 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6284 |
// helper symbol for instance_specific_initializations // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6285 |
instance_specific_init_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6286 |
instance_specific_init ';' |
68 | 6287 |
{$$ = new instance_specific_init_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6288 |
| instance_specific_init_list instance_specific_init ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6289 |
{$$ = $1; $$->add_element($2);} |
131 | 6290 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
6291 |
| error ';' |
136 | 6292 |
{$$ = new instance_specific_init_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid configuration variable initialization."); yyerrok;} |
131 | 6293 |
| instance_specific_init error |
136 | 6294 |
{$$ = new instance_specific_init_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at the end of configuration variable initialization."); yyerrok;} |
131 | 6295 |
| instance_specific_init_list instance_specific_init error |
136 | 6296 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at the end of configuration variable initialization."); yyerrok;} |
133 | 6297 |
| instance_specific_init_list error ';' |
136 | 6298 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid configuration variable initialization."); yyerrok;} |
131 | 6299 |
| instance_specific_init_list ';' |
136 | 6300 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after configuration variable initialization."); yynerrs++;} |
131 | 6301 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6302 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6303 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6304 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6305 |
instance_specific_init: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6306 |
// |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6307 |
// resource_name '.' program_name '.' {fb_name '.'} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6308 |
// ((variable_name [location] ':' located_var_spec_init) | (fb_name ':' function_block_type_name ':=' structure_initialization)) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6309 |
// |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6310 |
// prev_declared_resource_name '.' prev_declared_program_name '.' any_fb_name_list variable_name ':' located_var_spec_init |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6311 |
/* NOTE: variable_name has been changed to any_identifier (and not simply identifier) because the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6312 |
* variables being referenced have been declared outside the scope currently being parsed! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6313 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6314 |
/* NOTE: program_name has not been changed to prev_declared_program_name because the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6315 |
* programs being referenced have been declared outside the scope currently being parsed! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6316 |
* The programs are only kept inside the scope of the resource in which they are defined. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6317 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6318 |
prev_declared_resource_name '.' program_name '.' any_fb_name_list any_identifier ':' located_var_spec_init |
68 | 6319 |
{$$ = new instance_specific_init_c($1, $3, $5, $6, NULL, $8, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6320 |
| prev_declared_resource_name '.' program_name '.' any_fb_name_list any_identifier location ':' located_var_spec_init |
68 | 6321 |
{$$ = new instance_specific_init_c($1, $3, $5, $6, $7, $9, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6322 |
| prev_declared_resource_name '.' program_name '.' any_fb_name_list any_identifier ':' fb_initialization |
68 | 6323 |
{$5->add_element($6); $$ = new instance_specific_init_c($1, $3, $5, NULL, NULL, $8, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6324 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6325 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6326 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6327 |
/* helper symbol for instance_specific_init */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6328 |
fb_initialization: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6329 |
function_block_type_name ASSIGN structure_initialization |
68 | 6330 |
{$$ = new fb_initialization_c($1, $3, locloc(@$));} |
131 | 6331 |
/* ERROR_CHECK_BEGIN */ |
6332 |
| function_block_type_name structure_initialization |
|
136 | 6333 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing between function block name and initialization in function block initialization."); yynerrs++;} |
6334 |
| function_block_type_name ASSIGN error |
|
131 | 6335 |
{$$ = NULL; |
136 | 6336 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in function block initialization.");} |
6337 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in function block initialization."); yyclearin;} |
|
131 | 6338 |
yyerrok; |
6339 |
} |
|
6340 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6341 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6342 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6343 |
/***********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6344 |
/* B 2.1 Instructions and Operands */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6345 |
/***********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6346 |
/* helper symbol for many IL instructions, etc... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6347 |
/* eat up any extra EOL tokens... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6348 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6349 |
eol_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6350 |
EOL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6351 |
| eol_list EOL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6352 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6353 |
|
94 | 6354 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6355 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6356 |
instruction_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6357 |
il_instruction |
68 | 6358 |
{$$ = new instruction_list_c(locloc(@$)); $$->add_element($1);} |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
6359 |
| any_pragma eol_list |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
6360 |
{$$ = new instruction_list_c(locloc(@1)); $$->add_element($1);} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6361 |
| instruction_list il_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6362 |
{$$ = $1; $$->add_element($2);} |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
6363 |
| instruction_list any_pragma |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6364 |
{$$ = $1; $$->add_element($2);} |
68 | 6365 |
; |
6366 |
||
6367 |
||
6368 |
||
6369 |
il_instruction: |
|
6370 |
il_incomplete_instruction eol_list |
|
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
6371 |
{$$ = new il_instruction_c(NULL, $1, locloc(@1));} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */ |
68 | 6372 |
| label ':' il_incomplete_instruction eol_list |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
6373 |
{$$ = new il_instruction_c($1, $3, locf(@1), locl(@3));} /* locf(@1), locl(@3) is not a bug! We ignore trailing EOLs when determining symbol location! */ |
311
8fcea60029de
Allow [EOL] after a label in IL.
Mario de Sousa <msousa@fe.up.pt>
parents:
295
diff
changeset
|
6374 |
| label ':' eol_list |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
6375 |
{$$ = new il_instruction_c($1, NULL, locf(@1), locl(@2));} /* locf(@1), locl(@2) is not a bug! We ignore trailing EOLs when determining symbol location! */ |
68 | 6376 |
/* ERROR_CHECK_BEGIN */ |
6377 |
| error eol_list |
|
136 | 6378 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid IL instruction."); yyerrok;} |
131 | 6379 |
| il_incomplete_instruction error |
136 | 6380 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of IL instruction."); yyerrok;} |
131 | 6381 |
| error ':' il_incomplete_instruction eol_list |
136 | 6382 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid label in IL instruction."); yyerrok;} |
131 | 6383 |
| label il_incomplete_instruction eol_list |
136 | 6384 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after label in IL instruction."); yynerrs++;} |
68 | 6385 |
| label ':' error eol_list |
136 | 6386 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid IL instruction."); yyerrok;} |
131 | 6387 |
| label ':' il_incomplete_instruction error |
136 | 6388 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "EOL missing at the end of IL instruction."); yyerrok;} |
68 | 6389 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6390 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6391 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6392 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6393 |
/* helper symbol for il_instruction */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6394 |
il_incomplete_instruction: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6395 |
il_simple_operation |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6396 |
| il_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6397 |
| il_jump_operation |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6398 |
| il_fb_call |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6399 |
| il_formal_funct_call |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6400 |
| il_return_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6401 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6402 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6403 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6404 |
label: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6405 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6406 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6407 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6408 |
il_simple_operation: |
94 | 6409 |
// (il_simple_operator [il_operand]) | (function_name [il_operand_list]) |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6410 |
il_simple_operator |
68 | 6411 |
{$$ = new il_simple_operation_c($1, NULL, locloc(@$));} |
93 | 6412 |
/* |
6413 |
* Note: Bison is getting confused with the following rule, |
|
94 | 6414 |
* i.e. it is finding conflicts where there seemingly are really none. |
93 | 6415 |
* The rule was therefore replaced by the equivalent following |
6416 |
* two rules. |
|
6417 |
*/ |
|
6418 |
/* |
|
6419 |
| il_simple_operator il_operand |
|
6420 |
{$$ = new il_simple_operation_c($1, $2, locloc(@$));} |
|
6421 |
*/ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6422 |
| il_simple_operator_noclash il_operand |
68 | 6423 |
{$$ = new il_simple_operation_c($1, $2, locloc(@$));} |
91 | 6424 |
| il_simple_operator_clash il_operand |
6425 |
{$$ = new il_simple_operation_c($1, $2, locloc(@$));} |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6426 |
/* NOTE: the line |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6427 |
* | il_simple_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6428 |
* already contains the 'NOT' operator, as well as all the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6429 |
* expression operators ('MOD', 'AND', etc...), all of which |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6430 |
* may also be a function name! This means that these operators/functions, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6431 |
* without any operands, could be reduced to either an operator or a |
89 | 6432 |
* function call. |
6433 |
* |
|
6434 |
* I (Mario) have chosen to reduce it to an operator. |
|
68 | 6435 |
* In order to do this, we must remove from the syntax that defines |
6436 |
* function calls all the functions whose names clash with the IL operators. |
|
6437 |
* |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6438 |
* The line |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6439 |
* | function_name |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6440 |
* has been replaced with the lines |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6441 |
* | function_name_no_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6442 |
* in order to include all possible function names except |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6443 |
* those whose names coincide with operators !! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6444 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6445 |
| function_name_no_clashes |
68 | 6446 |
{$$ = new il_function_call_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6447 |
/* NOTE: the line |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6448 |
* | il_simple_operator il_operand |
68 | 6449 |
* already contains the 'NOT', 'MOD', etc. operators, followed by a single il_operand. |
6450 |
* However, this same code (MOD x) may also be reduced to a function call to the MOD |
|
6451 |
* function. This means that (MOD, AND,...) could be interpret as a function name |
|
6452 |
* or as an IL operator! This would lead us to a reduce/reduce conflict! |
|
6453 |
* |
|
89 | 6454 |
* I (Mario) have chosen to reduce it to an operand, rather than a function call. |
68 | 6455 |
* In order to do this, we must remove from the syntax that defines |
6456 |
* function calls all the functions whose names clash with the IL operators. |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6457 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6458 |
* The line |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6459 |
* | function_name il_operand_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6460 |
* has been replaced with the line |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6461 |
* | function_name_no_clashes il_operand_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6462 |
* in order to include all possible function names except |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6463 |
* for the function names which clash with expression and simple operators. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6464 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6465 |
* Note that: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6466 |
* this alternative syntax does not cover the possibility of |
68 | 6467 |
* the function 'NOT', 'MOD', etc... being called with more than one il_operand, |
6468 |
* in which case it is always a function call, and not an IL instruction. |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6469 |
* We therefore need to include an extra rule where the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6470 |
* function_name_expression_clashes and function_name_simpleop_clashes |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6471 |
* are followed by a il_operand_list with __two__ or more il_operands!! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6472 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6473 |
| function_name_no_clashes il_operand_list |
68 | 6474 |
{$$ = new il_function_call_c($1, $2, locloc(@$));} |
91 | 6475 |
| il_simple_operator_clash il_operand_list2 |
93 | 6476 |
{$$ = new il_function_call_c(il_operator_c_2_identifier_c($1), $2, locloc(@$));} |
6477 |
; |
|
6478 |
||
91 | 6479 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6480 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6481 |
il_expression: |
94 | 6482 |
// il_expr_operator '(' [il_operand] EOL {EOL} [simple_instr_list] ')' |
690
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6483 |
/* IMPORTANT NOTE: |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6484 |
* When the <il_operand> exists, and to make it easier to handle the <il_operand> as a general case (i.e. without C++ code handling this as a special case), |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6485 |
* we will create an equivalent LD <il_operand> IL instruction, and prepend it into the <simple_instr_list>. |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6486 |
* The remainder of the compiler may from now on assume that the code being compiled does not contain any IL code like |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6487 |
* LD 1 |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6488 |
* ADD ( 2 |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6489 |
* SUB 3 |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6490 |
* ) |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6491 |
* |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6492 |
* but instead, the equivalent code |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6493 |
* LD 1 |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6494 |
* ADD ( |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6495 |
* LD 2 |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6496 |
* SUB 3 |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6497 |
* ) |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6498 |
* |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6499 |
* Note, however, that in the first case, we still store in the il_expression_c a pointer to the <il_operand> (the literal '2' in the above example), in case |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6500 |
* somewhere further on in the compiler we really want to handle it as a special case. To handle it as a special case, it should be easy to simply delete the first |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6501 |
* artificial entry in <simple_instr_list> with il_expression->simple_instr_list->remove_element(0) !! |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6502 |
*/ |
94 | 6503 |
/* |
6504 |
* Note: Bison is getting confused with the use of il_expr_operator, |
|
6505 |
* i.e. it is finding conflicts where there seemingly are really none. |
|
6506 |
* il_expr_operator was therefore replaced by the equivalent |
|
6507 |
* il_expr_operator_noclash | il_expr_operator_clash. |
|
6508 |
*/ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6509 |
il_expr_operator_noclash '(' eol_list ')' |
68 | 6510 |
{$$ = new il_expression_c($1, NULL, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6511 |
| il_expr_operator_noclash '(' il_operand eol_list ')' |
690
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6512 |
{ simple_instr_list_c *tmp_simple_instr_list = new simple_instr_list_c(locloc(@3)); |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6513 |
tmp_simple_instr_list ->insert_element(new il_simple_instruction_c(new il_simple_operation_c(new LD_operator_c(locloc(@3)), $3, locloc(@3)), locloc(@3)), 0); |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6514 |
$$ = new il_expression_c($1, $3, tmp_simple_instr_list, locloc(@$)); |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6515 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6516 |
| il_expr_operator_noclash '(' eol_list simple_instr_list ')' |
68 | 6517 |
{$$ = new il_expression_c($1, NULL, $4, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6518 |
| il_expr_operator_noclash '(' il_operand eol_list simple_instr_list ')' |
690
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6519 |
{ simple_instr_list_c *tmp_simple_instr_list = dynamic_cast <simple_instr_list_c *> $5; |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6520 |
tmp_simple_instr_list ->insert_element(new il_simple_instruction_c(new il_simple_operation_c(new LD_operator_c(locloc(@3)), $3, locloc(@3)), locloc(@3)), 0); |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6521 |
$$ = new il_expression_c($1, $3, $5, locloc(@$)); |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6522 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6523 |
| il_expr_operator_clash '(' eol_list ')' |
68 | 6524 |
{$$ = new il_expression_c($1, NULL, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6525 |
| il_expr_operator_clash '(' il_operand eol_list ')' |
690
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6526 |
{ simple_instr_list_c *tmp_simple_instr_list = new simple_instr_list_c(locloc(@3)); |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6527 |
tmp_simple_instr_list ->insert_element(new il_simple_instruction_c(new il_simple_operation_c(new LD_operator_c(locloc(@3)), $3, locloc(@3)), locloc(@3)), 0); |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6528 |
$$ = new il_expression_c($1, $3, tmp_simple_instr_list, locloc(@$)); |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6529 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6530 |
| il_expr_operator_clash '(' il_operand eol_list simple_instr_list ')' |
690
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6531 |
{ simple_instr_list_c *tmp_simple_instr_list = dynamic_cast <simple_instr_list_c *> $5; |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6532 |
tmp_simple_instr_list ->insert_element(new il_simple_instruction_c(new il_simple_operation_c(new LD_operator_c(locloc(@3)), $3, locloc(@3)), locloc(@3)), 0); |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6533 |
$$ = new il_expression_c($1, $3, $5, locloc(@$)); |
6156ee2b4e32
Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents:
667
diff
changeset
|
6534 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6535 |
| il_expr_operator_clash_eol_list simple_instr_list ')' |
68 | 6536 |
{$$ = new il_expression_c($1, NULL, $2, locloc(@$));} |
131 | 6537 |
/* ERROR_CHECK_BEGIN */ |
6538 |
| il_expr_operator_noclash '(' eol_list error |
|
136 | 6539 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6540 |
| il_expr_operator_noclash '(' il_operand eol_list error |
136 | 6541 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6542 |
| il_expr_operator_noclash '(' eol_list simple_instr_list error |
136 | 6543 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6544 |
| il_expr_operator_noclash '(' il_operand eol_list simple_instr_list error |
136 | 6545 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6546 |
| il_expr_operator_clash '(' il_operand eol_list error |
136 | 6547 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6548 |
| il_expr_operator_clash '(' il_operand eol_list simple_instr_list error |
136 | 6549 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6550 |
| il_expr_operator_clash_eol_list simple_instr_list error |
136 | 6551 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6552 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6553 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6554 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6555 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6556 |
il_jump_operation: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6557 |
il_jump_operator label |
68 | 6558 |
{$$ = new il_jump_operation_c($1, $2, locloc(@$));} |
131 | 6559 |
/* ERROR_CHECK_BEGIN */ |
6560 |
| il_jump_operator error |
|
136 | 6561 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid label defined in IL jump operation."); yyerrok;} |
131 | 6562 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6563 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6564 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6565 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6566 |
il_fb_call: |
94 | 6567 |
// il_call_operator fb_name ['(' (EOL {EOL} [il_param_list]) | [il_operand_list] ')'] |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6568 |
il_call_operator prev_declared_fb_name |
68 | 6569 |
{$$ = new il_fb_call_c($1, $2, NULL, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6570 |
| il_call_operator prev_declared_fb_name '(' ')' |
68 | 6571 |
{$$ = new il_fb_call_c($1, $2, NULL, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6572 |
| il_call_operator prev_declared_fb_name '(' eol_list ')' |
68 | 6573 |
{$$ = new il_fb_call_c($1, $2, NULL, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6574 |
| il_call_operator prev_declared_fb_name '(' il_operand_list ')' |
68 | 6575 |
{$$ = new il_fb_call_c($1, $2, $4, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6576 |
| il_call_operator prev_declared_fb_name '(' eol_list il_param_list ')' |
68 | 6577 |
{$$ = new il_fb_call_c($1, $2, NULL, $5, locloc(@$));} |
131 | 6578 |
/* ERROR_CHECK_BEGIN */ |
6579 |
| il_call_operator error |
|
6580 |
{$$ = NULL; |
|
136 | 6581 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call.");} |
6582 |
else {print_err_msg(locf(@2), locl(@2), "invalid function block name in IL function block call."); yyclearin;} |
|
131 | 6583 |
yyerrok; |
6584 |
} |
|
6585 |
| il_call_operator '(' ')' |
|
136 | 6586 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;} |
131 | 6587 |
| il_call_operator '(' eol_list ')' |
136 | 6588 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;} |
131 | 6589 |
| il_call_operator '(' il_operand_list ')' |
136 | 6590 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;} |
131 | 6591 |
| il_call_operator '(' eol_list il_param_list ')' |
136 | 6592 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;} |
131 | 6593 |
| il_call_operator error '(' ')' |
136 | 6594 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;} |
131 | 6595 |
| il_call_operator error '(' eol_list ')' |
136 | 6596 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;} |
131 | 6597 |
| il_call_operator error '(' il_operand_list ')' |
136 | 6598 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;} |
131 | 6599 |
| il_call_operator error '(' eol_list il_param_list ')' |
136 | 6600 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;} |
131 | 6601 |
| il_call_operator prev_declared_fb_name ')' |
136 | 6602 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'(' missing after function block name defined in IL function block call."); yynerrs++;} |
131 | 6603 |
| il_call_operator prev_declared_fb_name il_operand_list ')' |
136 | 6604 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'(' missing after function block name defined in IL function block call."); yynerrs++;} |
131 | 6605 |
| il_call_operator prev_declared_fb_name '(' error |
136 | 6606 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of IL function block call."); yyerrok;} |
131 | 6607 |
| il_call_operator prev_declared_fb_name '(' eol_list error |
136 | 6608 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL function block call."); yyerrok;} |
131 | 6609 |
| il_call_operator prev_declared_fb_name '(' il_operand_list error |
136 | 6610 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL function block call."); yyerrok;} |
131 | 6611 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6612 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6613 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6614 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6615 |
/* NOTE: Please read note above the definition of function_name_without_clashes */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6616 |
il_formal_funct_call: |
94 | 6617 |
// function_name '(' EOL {EOL} [il_param_list] ')' |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6618 |
/* function_name '(' eol_list ')' */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6619 |
/* NOTE: il_formal_funct_call is only used in the definition of |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6620 |
* - il_incomplete_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6621 |
* - il_simple_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6622 |
* In both of the above, il_expression also |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6623 |
* shows up as another option. This means that the functions whose |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6624 |
* names clash with expressions, followed by '(' eol_list ')', are |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6625 |
* already included. We must therefore leave them out in this |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6626 |
* definition in order to remove reduce/reduce conflicts. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6627 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6628 |
* In summary: 'MOD' '(' eol_list ')', and all other functions whose |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6629 |
* names clash with expressions may be interpreted by the syntax by |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6630 |
* two different routes. I (Mario) chose to interpret them |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6631 |
* as operators, rather than as function calls! |
68 | 6632 |
* (AND MOD OR XOR ADD DIV EQ GT GE LT LE MUL NE SUB) |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6633 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6634 |
function_name_no_clashes '(' eol_list ')' |
68 | 6635 |
{$$ = new il_formal_funct_call_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6636 |
| function_name_simpleop_clashes '(' eol_list ')' |
68 | 6637 |
{$$ = new il_formal_funct_call_c($1, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6638 |
/* | function_name '(' eol_list il_param_list ')' */ |
68 | 6639 |
/* For the above syntax, we no longer have two ways of interpreting the |
6640 |
* same syntax. The above is always a function call! |
|
6641 |
* However, some of the functions that we may be calling |
|
6642 |
* may have the same name as an IL operator. This means that |
|
6643 |
* flex will be parsing them and handing them over to bison as |
|
6644 |
* IL operator tokens, and not as function name tokens. |
|
6645 |
* (when parsing ST, flex no longer recognizes IL operators, |
|
6646 |
* so will always return the correct function name, unless that |
|
6647 |
* name also coincides with an operator used in ST -> XOR, OR, MOD, AND, NOT) |
|
6648 |
* |
|
6649 |
* We must therefore interpret the IL operators as function names! |
|
6650 |
*/ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6651 |
| function_name_no_clashes '(' eol_list il_param_list ')' |
68 | 6652 |
{$$ = new il_formal_funct_call_c($1, $4, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6653 |
| function_name_simpleop_clashes '(' eol_list il_param_list ')' |
68 | 6654 |
{$$ = new il_formal_funct_call_c($1, $4, locloc(@$));} |
6655 |
/* The following line should read: |
|
6656 |
* |
|
6657 |
* | function_name_expression_clashes '(' eol_list il_param_list ')' |
|
6658 |
* |
|
6659 |
* but the function_name_expression_clashes had to be first reduced to |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6660 |
* an intermediary symbol in order to remove a reduce/reduce conflict. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6661 |
* In essence, the syntax requires more than one look ahead token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6662 |
* in order to be parsed. We resolve this by reducing a collection of |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6663 |
* symbols into a temporary symbol (il_expr_operator_clash_eol_list), that |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6664 |
* will later be replaced by the correct symbol. The correct symbol will |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6665 |
* now be determined by a single look ahead token, as all the common |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6666 |
* symbols have been reduced to the temporary symbol |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6667 |
* il_expr_operator_clash_eol_list ! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6668 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6669 |
* Unfortunately, this work around results in the wrong symbol |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6670 |
* being created for the abstract syntax tree. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6671 |
* We need to figure out which symbol was created, destroy it, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6672 |
* and create the correct symbol for our case. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6673 |
* This is a lot of work, so I put it in a function |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6674 |
* at the end of this file... il_operator_c_2_identifier_c() |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6675 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6676 |
| il_expr_operator_clash_eol_list il_param_list ')' |
68 | 6677 |
{$$ = new il_formal_funct_call_c(il_operator_c_2_identifier_c($1), $2, locloc(@$));} |
131 | 6678 |
/* ERROR_CHECK_BEGIN */ |
6679 |
| function_name_no_clashes '(' eol_list error ')' |
|
136 | 6680 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid parameter list defined in IL formal function call."); yyerrok;} |
131 | 6681 |
| function_name_simpleop_clashes '(' eol_list error ')' |
136 | 6682 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid parameter list defined in IL formal function call."); yyerrok;} |
131 | 6683 |
| il_expr_operator_clash_eol_list error ')' |
136 | 6684 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter list defined in IL formal function call."); yyerrok;} |
131 | 6685 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6686 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6687 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6688 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6689 |
il_expr_operator_clash_eol_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6690 |
il_expr_operator_clash '(' eol_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6691 |
{$$ = $1;} |
131 | 6692 |
/* ERROR_CHECK_BEGIN */ |
6693 |
| il_expr_operator_clash '(' error |
|
136 | 6694 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "EOL missing after '(' in IL instruction."); yyerrok;} |
131 | 6695 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6696 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6697 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6698 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6699 |
il_operand: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6700 |
variable |
85 | 6701 |
| enumerated_value |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6702 |
| constant |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6703 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6704 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6705 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6706 |
il_operand_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6707 |
il_operand |
68 | 6708 |
{$$ = new il_operand_list_c(locloc(@$)); $$->add_element($1);} |
91 | 6709 |
| il_operand_list2 |
6710 |
; |
|
6711 |
||
6712 |
||
6713 |
/* List with 2 or more il_operands */ |
|
6714 |
il_operand_list2: |
|
6715 |
il_operand ',' il_operand |
|
6716 |
{$$ = new il_operand_list_c(locloc(@$)); $$->add_element($1); $$->add_element($3);} |
|
6717 |
| il_operand_list2 ',' il_operand |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6718 |
{$$ = $1; $$->add_element($3);} |
131 | 6719 |
/* ERROR_CHECK_BEGIN */ |
6720 |
| il_operand_list2 il_operand |
|
136 | 6721 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in IL operand list."); yynerrs++;} |
6722 |
| il_operand ',' error |
|
6723 |
{$$ = new il_operand_list_c(locloc(@$)); |
|
6724 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no operand defined in IL operand list.");} |
|
6725 |
else {print_err_msg(locf(@3), locl(@3), "invalid operand name in IL operand list."); yyclearin;} |
|
131 | 6726 |
yyerrok; |
6727 |
} |
|
6728 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6729 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6730 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6731 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6732 |
simple_instr_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6733 |
il_simple_instruction |
68 | 6734 |
{$$ = new simple_instr_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6735 |
| simple_instr_list il_simple_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6736 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6737 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6738 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6739 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6740 |
il_simple_instruction: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6741 |
il_simple_operation eol_list |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
6742 |
{$$ = new il_simple_instruction_c($1, locloc(@1));} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6743 |
| il_expression eol_list |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
6744 |
{$$ = new il_simple_instruction_c($1, locloc(@1));} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6745 |
| il_formal_funct_call eol_list |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
6746 |
{$$ = new il_simple_instruction_c($1, locloc(@1));} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */ |
131 | 6747 |
/* ERROR_CHECK_BEGIN */ |
6748 |
| il_expression error |
|
136 | 6749 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing after expression IL instruction."); yyerrok;} |
131 | 6750 |
| il_formal_funct_call error |
136 | 6751 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing after formal function call IL instruction."); yyerrok;} |
131 | 6752 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6753 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6754 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6755 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6756 |
/* NOTE: the correct definition of il_param_list is |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6757 |
* il_param_list ::= {il_param_instruction} il_param_last_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6758 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6759 |
* where {...} denotes zero or many il_param_instruction's. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6760 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6761 |
* We could do this by defining the following: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6762 |
* il_param_list: il_param_instruction_list il_param_last_instruction; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6763 |
* il_param_instruction_list : ** empty ** | il_param_instruction_list il_param_instruction; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6764 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6765 |
* Unfortunately, the above leads to reduce/reduce conflicts. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6766 |
* The chosen alternative (as follows) does not have any conflicts! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6767 |
* il_param_list: il_param_last_instruction | il_param_instruction_list il_param_last_instruction; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6768 |
* il_param_instruction_list : il_param_instruction_list | il_param_instruction_list il_param_instruction; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6769 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6770 |
il_param_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6771 |
il_param_instruction_list il_param_last_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6772 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6773 |
| il_param_last_instruction |
68 | 6774 |
{$$ = new il_param_list_c(locloc(@$)); $$->add_element($1);} |
131 | 6775 |
/* ERROR_CHECK_BEGIN */ |
6776 |
| il_param_instruction_list error |
|
136 | 6777 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid parameter assignment in parameter assignment list."); yyerrok;} |
131 | 6778 |
| il_param_last_instruction il_param_last_instruction |
136 | 6779 |
{$$ = new il_param_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "',' missing at the end of parameter assignment in parameter assignment list."); yynerrs++;} |
131 | 6780 |
| il_param_instruction_list il_param_last_instruction il_param_last_instruction |
136 | 6781 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "',' missing at the end of parameter assignment in parameter assignment list."); yynerrs++;} |
131 | 6782 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6783 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6784 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6785 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6786 |
/* Helper symbol for il_param_list */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6787 |
il_param_instruction_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6788 |
il_param_instruction |
68 | 6789 |
{$$ = new il_param_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6790 |
| il_param_instruction_list il_param_instruction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6791 |
{$$ = $1; $$->add_element($2);} |
131 | 6792 |
/* ERROR_CHECK_BEGIN */ |
6793 |
| il_param_last_instruction il_param_instruction |
|
136 | 6794 |
{$$ = new il_param_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "',' missing at the end of parameter assignment in parameter assignment list."); yynerrs++;} |
131 | 6795 |
| il_param_instruction_list il_param_last_instruction il_param_instruction |
136 | 6796 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "',' missing at the end of parameter assignment in parameter assignment list."); yynerrs++;} |
131 | 6797 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6798 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6799 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6800 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6801 |
il_param_instruction: |
257 | 6802 |
il_param_assignment ',' eol_list |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6803 |
| il_param_out_assignment ',' eol_list |
131 | 6804 |
/* ERROR_CHECK_BEGIN */ |
6805 |
| il_param_assignment ',' error |
|
136 | 6806 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "EOL missing at the end of parameter assignment in parameter assignment list."); yyerrok;} |
131 | 6807 |
| il_param_out_assignment ',' error |
136 | 6808 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "EOL missing at the end of parameter out assignment in parameter assignment list."); yyerrok;} |
131 | 6809 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6810 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6811 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6812 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6813 |
il_param_last_instruction: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6814 |
il_param_assignment eol_list |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6815 |
| il_param_out_assignment eol_list |
131 | 6816 |
/* ERROR_CHECK_BEGIN */ |
6817 |
| il_param_assignment error |
|
136 | 6818 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of last parameter assignment in parameter assignment list."); yyerrok;} |
131 | 6819 |
| il_param_out_assignment error |
136 | 6820 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of last parameter out assignment in parameter assignment list."); yyerrok;} |
131 | 6821 |
/* ERROR_CHECK_END */ |
6822 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6823 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6824 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6825 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6826 |
il_param_assignment: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6827 |
il_assign_operator il_operand |
68 | 6828 |
{$$ = new il_param_assignment_c($1, $2, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6829 |
| il_assign_operator '(' eol_list simple_instr_list ')' |
68 | 6830 |
{$$ = new il_param_assignment_c($1, NULL, $4, locloc(@$));} |
131 | 6831 |
/* ERROR_CHECK_BEGIN */ |
6832 |
| error il_operand |
|
136 | 6833 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid operator in parameter assignment."); yyerrok;} |
131 | 6834 |
| error '(' eol_list simple_instr_list ')' |
136 | 6835 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid operator in parameter assignment."); yyerrok;} |
131 | 6836 |
| il_assign_operator error |
6837 |
{$$ = NULL; |
|
136 | 6838 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no operand defined in parameter assignment.");} |
6839 |
else {print_err_msg(locf(@2), locl(@2), "invalid operand in parameter assignment."); yyclearin;} |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
6840 |
yyerrok; |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
6841 |
} |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
6842 |
| il_assign_operator '(' eol_list ')' |
136 | 6843 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no instruction list defined in parameter assignment."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
6844 |
| il_assign_operator '(' eol_list error ')' |
136 | 6845 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid instruction list defined in parameter assignment."); yyerrok;} |
131 | 6846 |
| il_assign_operator '(' eol_list simple_instr_list error |
136 | 6847 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of instruction list defined in parameter assignment."); yyerrok;} |
131 | 6848 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6849 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6850 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6851 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6852 |
il_param_out_assignment: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6853 |
il_assign_out_operator variable |
68 | 6854 |
{$$ = new il_param_out_assignment_c($1, $2, locloc(@$));} |
131 | 6855 |
/* ERROR_CHECK_BEGIN */ |
6856 |
| il_assign_out_operator error |
|
6857 |
{$$ = NULL; |
|
136 | 6858 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no variable defined in IL operand list.");} |
6859 |
else {print_err_msg(locf(@2), locl(@2), "invalid variable in IL operand list."); yyclearin;} |
|
131 | 6860 |
yyerrok; |
6861 |
} |
|
6862 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6863 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6864 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6865 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6866 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6867 |
/*******************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6868 |
/* B 2.2 Operators */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6869 |
/*******************/ |
68 | 6870 |
sendto_identifier: sendto_identifier_token {$$ = new identifier_c($1, locloc(@$));}; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6871 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6872 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6873 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6874 |
* The spec includes the operator 'EQ ' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6875 |
* Note that EQ is followed by a space. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6876 |
* I am considering this a typo, and defining the operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6877 |
* as 'EQ' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6878 |
* (Mario) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6879 |
*/ |
68 | 6880 |
LD_operator: LD {$$ = new LD_operator_c(locloc(@$));}; |
6881 |
LDN_operator: LDN {$$ = new LDN_operator_c(locloc(@$));}; |
|
6882 |
ST_operator: ST {$$ = new ST_operator_c(locloc(@$));}; |
|
6883 |
STN_operator: STN {$$ = new STN_operator_c(locloc(@$));}; |
|
6884 |
NOT_operator: NOT {$$ = new NOT_operator_c(locloc(@$));}; |
|
6885 |
S_operator: S {$$ = new S_operator_c(locloc(@$));}; |
|
6886 |
R_operator: R {$$ = new R_operator_c(locloc(@$));}; |
|
6887 |
S1_operator: S1 {$$ = new S1_operator_c(locloc(@$));}; |
|
6888 |
R1_operator: R1 {$$ = new R1_operator_c(locloc(@$));}; |
|
6889 |
CLK_operator: CLK {$$ = new CLK_operator_c(locloc(@$));}; |
|
6890 |
CU_operator: CU {$$ = new CU_operator_c(locloc(@$));}; |
|
6891 |
CD_operator: CD {$$ = new CD_operator_c(locloc(@$));}; |
|
6892 |
PV_operator: PV {$$ = new PV_operator_c(locloc(@$));}; |
|
6893 |
IN_operator: IN {$$ = new IN_operator_c(locloc(@$));}; |
|
6894 |
PT_operator: PT {$$ = new PT_operator_c(locloc(@$));}; |
|
6895 |
AND_operator: AND {$$ = new AND_operator_c(locloc(@$));}; |
|
6896 |
AND2_operator: AND2 {$$ = new AND_operator_c(locloc(@$));}; /* '&' in the source code! */ |
|
6897 |
OR_operator: OR {$$ = new OR_operator_c(locloc(@$));}; |
|
6898 |
XOR_operator: XOR {$$ = new XOR_operator_c(locloc(@$));}; |
|
6899 |
ANDN_operator: ANDN {$$ = new ANDN_operator_c(locloc(@$));}; |
|
6900 |
ANDN2_operator: ANDN2 {$$ = new ANDN_operator_c(locloc(@$));}; /* '&N' in the source code! */ |
|
6901 |
ORN_operator: ORN {$$ = new ORN_operator_c(locloc(@$));}; |
|
6902 |
XORN_operator: XORN {$$ = new XORN_operator_c(locloc(@$));}; |
|
6903 |
ADD_operator: ADD {$$ = new ADD_operator_c(locloc(@$));}; |
|
6904 |
SUB_operator: SUB {$$ = new SUB_operator_c(locloc(@$));}; |
|
6905 |
MUL_operator: MUL {$$ = new MUL_operator_c(locloc(@$));}; |
|
6906 |
DIV_operator: DIV {$$ = new DIV_operator_c(locloc(@$));}; |
|
6907 |
MOD_operator: MOD {$$ = new MOD_operator_c(locloc(@$));}; |
|
6908 |
GT_operator: GT {$$ = new GT_operator_c(locloc(@$));}; |
|
6909 |
GE_operator: GE {$$ = new GE_operator_c(locloc(@$));}; |
|
6910 |
EQ_operator: EQ {$$ = new EQ_operator_c(locloc(@$));}; |
|
6911 |
LT_operator: LT {$$ = new LT_operator_c(locloc(@$));}; |
|
6912 |
LE_operator: LE {$$ = new LE_operator_c(locloc(@$));}; |
|
6913 |
NE_operator: NE {$$ = new NE_operator_c(locloc(@$));}; |
|
6914 |
CAL_operator: CAL {$$ = new CAL_operator_c(locloc(@$));}; |
|
6915 |
CALC_operator: CALC {$$ = new CALC_operator_c(locloc(@$));}; |
|
6916 |
CALCN_operator: CALCN {$$ = new CALCN_operator_c(locloc(@$));}; |
|
6917 |
RET_operator: RET {$$ = new RET_operator_c(locloc(@$));}; |
|
6918 |
RETC_operator: RETC {$$ = new RETC_operator_c(locloc(@$));}; |
|
6919 |
RETCN_operator: RETCN {$$ = new RETCN_operator_c(locloc(@$));}; |
|
6920 |
JMP_operator: JMP {$$ = new JMP_operator_c(locloc(@$));}; |
|
6921 |
JMPC_operator: JMPC {$$ = new JMPC_operator_c(locloc(@$));}; |
|
6922 |
JMPCN_operator: JMPCN {$$ = new JMPCN_operator_c(locloc(@$));}; |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6923 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6924 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6925 |
il_simple_operator: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6926 |
il_simple_operator_clash |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6927 |
| il_simple_operator_noclash |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6928 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6929 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6930 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6931 |
il_simple_operator_noclash: |
382
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6932 |
LDN_operator |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6933 |
| ST_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6934 |
| STN_operator |
382
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6935 |
| il_expr_operator_noclash |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6936 |
; |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6937 |
|
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6938 |
|
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6939 |
il_simple_operator_clash: |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6940 |
il_simple_operator_clash1 |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6941 |
| il_simple_operator_clash2 |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6942 |
| il_simple_operator_clash3 |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6943 |
; |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6944 |
|
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6945 |
il_simple_operator_clash1: |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6946 |
NOT_operator |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6947 |
; |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6948 |
|
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6949 |
il_simple_operator_clash2: |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6950 |
il_expr_operator_clash |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6951 |
; |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6952 |
|
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6953 |
il_simple_operator_clash3: |
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6954 |
LD_operator |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6955 |
| S_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6956 |
| R_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6957 |
| S1_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6958 |
| R1_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6959 |
| CLK_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6960 |
| CU_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6961 |
| CD_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6962 |
| PV_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6963 |
| IN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6964 |
| PT_operator |
382
ac6dfec701c9
Fix bug in parser while trying to use IL operator like S1, R1, etc... as standard function block interface variable in structured_variable syntax and bug in code generator while generating code for assignment of function block interface variable using structured_variable syntax
laurent
parents:
377
diff
changeset
|
6965 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6966 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6967 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6968 |
il_expr_operator: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6969 |
il_expr_operator_noclash |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6970 |
| il_expr_operator_clash |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6971 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6972 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6973 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6974 |
il_expr_operator_clash: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6975 |
AND_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6976 |
| OR_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6977 |
| XOR_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6978 |
| ADD_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6979 |
| SUB_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6980 |
| MUL_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6981 |
| DIV_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6982 |
| MOD_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6983 |
| GT_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6984 |
| GE_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6985 |
| EQ_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6986 |
| LT_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6987 |
| LE_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6988 |
| NE_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6989 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6990 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6991 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6992 |
il_expr_operator_noclash: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6993 |
ANDN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6994 |
| ANDN2_operator /* string '&N' in source code! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6995 |
| AND2_operator /* string '&' in source code! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6996 |
| ORN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6997 |
| XORN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6998 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6999 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7000 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7001 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7002 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7003 |
il_assign_operator: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7004 |
/* variable_name ASSIGN */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7005 |
any_identifier ASSIGN |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7006 |
{$$ = new il_assign_operator_c($1, locloc(@$));} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7007 |
| en_identifier ASSIGN |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7008 |
{$$ = new il_assign_operator_c($1, locloc(@$));} |
239
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7009 |
| S1_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7010 |
{$$ = new il_assign_operator_c(il_operator_c_2_identifier_c($1), locloc(@$));} |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7011 |
| R1_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7012 |
{$$ = new il_assign_operator_c(il_operator_c_2_identifier_c($1), locloc(@$));} |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7013 |
| CLK_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7014 |
{$$ = new il_assign_operator_c(il_operator_c_2_identifier_c($1), locloc(@$));} |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7015 |
| CU_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7016 |
{$$ = new il_assign_operator_c(il_operator_c_2_identifier_c($1), locloc(@$));} |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7017 |
| CD_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7018 |
{$$ = new il_assign_operator_c(il_operator_c_2_identifier_c($1), locloc(@$));} |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7019 |
| PV_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7020 |
{$$ = new il_assign_operator_c(il_operator_c_2_identifier_c($1), locloc(@$));} |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7021 |
| IN_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7022 |
{$$ = new il_assign_operator_c(il_operator_c_2_identifier_c($1), locloc(@$));} |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7023 |
| PT_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7024 |
{$$ = new il_assign_operator_c(il_operator_c_2_identifier_c($1), locloc(@$));} |
131 | 7025 |
/* ERROR_CHECK_BEGIN */ |
7026 |
| error ASSIGN |
|
136 | 7027 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter assignment."); yyerrok;} |
131 | 7028 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7029 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7030 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7031 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7032 |
il_assign_out_operator: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7033 |
/* variable_name SENDTO */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7034 |
/* any_identifier SENDTO */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7035 |
sendto_identifier SENDTO |
68 | 7036 |
{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));} |
257 | 7037 |
/* The following is not required, as the sendto_identifier_token returned by flex will |
7038 |
* also include the 'ENO' identifier. |
|
7039 |
* The resulting abstract syntax tree is identical with or without this following rule, |
|
7040 |
* as both the eno_identifier and the sendto_identifier are stored as |
|
7041 |
* an identifier_c !! |
|
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7042 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7043 |
* To understand why we must even explicitly consider the use of ENO here, |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7044 |
* please read the comment above the definition of 'variable' in section B1.4 for details. |
257 | 7045 |
*/ |
7046 |
/* |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7047 |
| eno_identifier SENDTO |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7048 |
{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));} |
257 | 7049 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7050 |
/*| NOT variable_name SENDTO */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7051 |
| NOT sendto_identifier SENDTO |
68 | 7052 |
{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));} |
257 | 7053 |
/* The following is not required, as the sendto_identifier_token returned by flex will |
7054 |
* also include the 'ENO' identifier. |
|
7055 |
* The resulting abstract syntax tree is identical with or without this following rule, |
|
7056 |
* as both the eno_identifier and the sendto_identifier are stored as |
|
7057 |
* an identifier_c !! |
|
7058 |
* |
|
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7059 |
* To understand why we must even explicitly consider the use of ENO here, |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7060 |
* please read the comment above the definition of 'variable' in section B1.4 for details. |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7061 |
* |
257 | 7062 |
* NOTE: Removing the following rule also removes a shift/reduce conflict from the parser. |
7063 |
* This conflict is not really an error/ambiguity in the syntax, but rather |
|
7064 |
* due to the fact that more than a single look-ahead token would be required |
|
7065 |
* to correctly parse the syntax, something that bison does not support. |
|
7066 |
* |
|
7067 |
* The shift/reduce conflict arises because bison does not know whether |
|
7068 |
* to parse the 'NOT ENO' in the following code |
|
7069 |
* LD 1 |
|
7070 |
* funct_name ( |
|
7071 |
* NOT ENO => bool_var, |
|
7072 |
* EN := TRUE |
|
7073 |
* ) |
|
7074 |
* as either a il_param_assignment (wrong!) or an il_param_out_assignment.(correct). |
|
7075 |
* The '=>' delimiter (known as SEND_TO in this iec.y file) is a dead giveaway that |
|
7076 |
* it should be parsed as an il_param_out_assignment, but still, bison gets confused! |
|
7077 |
* Bison considers the possibility of reducing the 'NOT ENO' as an NOT_operator with |
|
7078 |
* the 'ENO' operand |
|
7079 |
* (NOT_operator -> il_simple_operator -> il_simple_operation -> il_simple_instruction -> |
|
7080 |
* -> simple_instr_list -> il_param_assignment) |
|
7081 |
* instead of reducing it to an il_param_out_operator. |
|
7082 |
* ( il_param_out_operator -> il_param_out_assignment) |
|
7083 |
* |
|
7084 |
* Note that the shift/reduce conflict only manifests itself in the il_formal_funct_call, |
|
7085 |
* where both the il_param_out_assignment and il_param_assignment are used! |
|
7086 |
* |
|
7087 |
* il_param_out_assignment --+--> il_param_instruction -> il_param_instruction_list --+ |
|
7088 |
* | | |
|
7089 |
* il_param_assignment --+ | |
|
7090 |
* | |
|
7091 |
* il_formal_funct_call <- il_param_list <-+ |
|
7092 |
* |
|
7093 |
*/ |
|
7094 |
/* |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7095 |
| NOT eno_identifier SENDTO |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7096 |
{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));} |
257 | 7097 |
*/ |
131 | 7098 |
/* ERROR_CHECK_BEGIN */ |
7099 |
| error SENDTO |
|
136 | 7100 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter out assignment."); yyerrok;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
7101 |
| NOT SENDTO |
136 | 7102 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter defined in parameter out assignment."); yynerrs++;} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
7103 |
| NOT error SENDTO |
136 | 7104 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter defined in parameter out assignment."); yyerrok;} |
131 | 7105 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7106 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7107 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7108 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7109 |
il_call_operator: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7110 |
CAL_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7111 |
| CALC_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7112 |
| CALCN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7113 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7114 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7115 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7116 |
il_return_operator: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7117 |
RET_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7118 |
| RETC_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7119 |
| RETCN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7120 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7121 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7122 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7123 |
il_jump_operator: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7124 |
JMP_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7125 |
| JMPC_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7126 |
| JMPCN_operator |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7127 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7128 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7129 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7130 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7131 |
/* B 3.1 - Expressions */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7132 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7133 |
expression: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7134 |
xor_expression |
873
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7135 |
| ref_expression /* an extension to the IEC 61131-3 v2 standard, based on the IEC 61131-3 v3 standard */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7136 |
| expression OR xor_expression |
68 | 7137 |
{$$ = new or_expression_c($1, $3, locloc(@$));} |
131 | 7138 |
/* ERROR_CHECK_BEGIN */ |
7139 |
| expression OR error |
|
7140 |
{$$ = NULL; |
|
136 | 7141 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'OR' in ST expression.");} |
7142 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'OR' in ST expression."); yyclearin;} |
|
131 | 7143 |
yyerrok; |
7144 |
} |
|
7145 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7146 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7147 |
|
873
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7148 |
/* REF(var_name) */ |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7149 |
/* This is an extension to the IEC 61131-3 standard. It is actually defined in the IEC 61131-3 v3 standard */ |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7150 |
/* The REF() operator returns the adrress of the variable. Basically, it returns a pointer to the variable */ |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7151 |
ref_expression: |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7152 |
REF '(' symbolic_variable ')' |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7153 |
{$$ = new ref_expression_c($3, locloc(@$));} |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7154 |
; |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7155 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7156 |
xor_expression: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7157 |
and_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7158 |
| xor_expression XOR and_expression |
68 | 7159 |
{$$ = new xor_expression_c($1, $3, locloc(@$));} |
131 | 7160 |
/* ERROR_CHECK_BEGIN */ |
7161 |
| xor_expression XOR error |
|
7162 |
{$$ = NULL; |
|
136 | 7163 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'XOR' in ST expression.");} |
7164 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'XOR' in ST expression."); yyclearin;} |
|
131 | 7165 |
yyerrok; |
7166 |
} |
|
7167 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7168 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7169 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7170 |
and_expression: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7171 |
comparison |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7172 |
| and_expression '&' comparison |
68 | 7173 |
{$$ = new and_expression_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7174 |
| and_expression AND comparison |
68 | 7175 |
{$$ = new and_expression_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7176 |
/* NOTE: The lexical parser never returns the token '&'. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7177 |
* The '&' string is interpreted by the lexcial parser as the token |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7178 |
* AND2! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7179 |
* This means that the first rule with '&' is actually not required, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7180 |
* but we leave it in nevertheless just in case we later decide |
136 | 7181 |
* to remove the AND2 token... |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7182 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7183 |
| and_expression AND2 comparison |
68 | 7184 |
{$$ = new and_expression_c($1, $3, locloc(@$));} |
131 | 7185 |
/* ERROR_CHECK_BEGIN */ |
7186 |
| and_expression '&' error |
|
7187 |
{$$ = NULL; |
|
136 | 7188 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '&' in ST expression.");} |
7189 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '&' in ST expression."); yyclearin;} |
|
131 | 7190 |
yyerrok; |
7191 |
} |
|
7192 |
| and_expression AND error |
|
7193 |
{$$ = NULL; |
|
136 | 7194 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'AND' in ST expression.");} |
7195 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'AND' in ST expression."); yyclearin;} |
|
131 | 7196 |
yyerrok; |
7197 |
} |
|
7198 |
| and_expression AND2 error |
|
7199 |
{$$ = NULL; |
|
136 | 7200 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '&' in ST expression.");} |
7201 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '&' in ST expression."); yyclearin;} |
|
131 | 7202 |
yyerrok; |
7203 |
} |
|
7204 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7205 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7206 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7207 |
comparison: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7208 |
equ_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7209 |
| comparison '=' equ_expression |
68 | 7210 |
{$$ = new equ_expression_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7211 |
| comparison OPER_NE equ_expression |
68 | 7212 |
{$$ = new notequ_expression_c($1, $3, locloc(@$));} |
131 | 7213 |
/* ERROR_CHECK_BEGIN */ |
7214 |
| comparison '=' error |
|
7215 |
{$$ = NULL; |
|
136 | 7216 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '=' in ST expression.");} |
7217 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '=' in ST expression."); yyclearin;} |
|
131 | 7218 |
yyerrok; |
7219 |
} |
|
7220 |
| comparison OPER_NE error |
|
7221 |
{$$ = NULL; |
|
136 | 7222 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '<>' in ST expression.");} |
7223 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '<>' in ST expression."); yyclearin;} |
|
131 | 7224 |
yyerrok; |
7225 |
} |
|
7226 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7227 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7228 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7229 |
equ_expression: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7230 |
add_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7231 |
| equ_expression '<' add_expression |
68 | 7232 |
{$$ = new lt_expression_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7233 |
| equ_expression '>' add_expression |
68 | 7234 |
{$$ = new gt_expression_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7235 |
| equ_expression OPER_LE add_expression |
68 | 7236 |
{$$ = new le_expression_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7237 |
| equ_expression OPER_GE add_expression |
68 | 7238 |
{$$ = new ge_expression_c($1, $3, locloc(@$));} |
131 | 7239 |
/* ERROR_CHECK_BEGIN */ |
7240 |
| equ_expression '<' error |
|
7241 |
{$$ = NULL; |
|
136 | 7242 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '<' in ST expression.");} |
7243 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '<' in ST expression."); yyclearin;} |
|
131 | 7244 |
yyerrok; |
7245 |
} |
|
7246 |
| equ_expression '>' error |
|
7247 |
{$$ = NULL; |
|
136 | 7248 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '>' in ST expression.");} |
7249 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '>' in ST expression."); yyclearin;} |
|
131 | 7250 |
yyerrok; |
7251 |
} |
|
7252 |
| equ_expression OPER_LE error |
|
7253 |
{$$ = NULL; |
|
136 | 7254 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '<=' in ST expression.");} |
7255 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '<=' in ST expression."); yyclearin;} |
|
131 | 7256 |
yyerrok; |
7257 |
} |
|
7258 |
| equ_expression OPER_GE error |
|
7259 |
{$$ = NULL; |
|
136 | 7260 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '>=' in ST expression.");} |
7261 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '>=' in ST expression."); yyclearin;} |
|
131 | 7262 |
yyerrok; |
7263 |
} |
|
7264 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7265 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7266 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7267 |
/* Not required... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7268 |
comparison_operator: '<' | '>' | '>=' '<=' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7269 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7270 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7271 |
add_expression: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7272 |
term |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7273 |
| add_expression '+' term |
68 | 7274 |
{$$ = new add_expression_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7275 |
| add_expression '-' term |
68 | 7276 |
{$$ = new sub_expression_c($1, $3, locloc(@$));} |
131 | 7277 |
/* ERROR_CHECK_BEGIN */ |
7278 |
| add_expression '+' error |
|
7279 |
{$$ = NULL; |
|
136 | 7280 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '+' in ST expression.");} |
7281 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '+' in ST expression."); yyclearin;} |
|
131 | 7282 |
yyerrok; |
7283 |
} |
|
7284 |
| add_expression '-' error |
|
7285 |
{$$ = NULL; |
|
136 | 7286 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '-' in ST expression.");} |
7287 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '-' in ST expression."); yyclearin;} |
|
131 | 7288 |
yyerrok; |
7289 |
} |
|
7290 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7291 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7292 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7293 |
/* Not required... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7294 |
add_operator: '+' | '-' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7295 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7296 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7297 |
term: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7298 |
power_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7299 |
| term '*' power_expression |
68 | 7300 |
{$$ = new mul_expression_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7301 |
| term '/' power_expression |
68 | 7302 |
{$$ = new div_expression_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7303 |
| term MOD power_expression |
68 | 7304 |
{$$ = new mod_expression_c($1, $3, locloc(@$));} |
131 | 7305 |
/* ERROR_CHECK_BEGIN */ |
7306 |
| term '*' error |
|
7307 |
{$$ = NULL; |
|
136 | 7308 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '*' in ST expression.");} |
7309 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '*' in ST expression."); yyclearin;} |
|
131 | 7310 |
yyerrok; |
7311 |
} |
|
7312 |
| term '/' error |
|
7313 |
{$$ = NULL; |
|
136 | 7314 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '/' in ST expression.");} |
7315 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '/' in ST expression."); yyclearin;} |
|
131 | 7316 |
yyerrok; |
7317 |
} |
|
7318 |
| term MOD error |
|
7319 |
{$$ = NULL; |
|
136 | 7320 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'MOD' in ST expression.");} |
7321 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'MOD' in ST expression."); yyclearin;} |
|
131 | 7322 |
yyerrok; |
7323 |
} |
|
7324 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7325 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7326 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7327 |
/* Not required... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7328 |
multiply_operator: '*' | '/' | 'MOD' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7329 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7330 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7331 |
power_expression: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7332 |
unary_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7333 |
| power_expression OPER_EXP unary_expression |
68 | 7334 |
{$$ = new power_expression_c($1, $3, locloc(@$));} |
131 | 7335 |
/* ERROR_CHECK_BEGIN */ |
7336 |
| power_expression OPER_EXP error |
|
7337 |
{$$ = NULL; |
|
136 | 7338 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '**' in ST expression.");} |
7339 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '**' in ST expression."); yyclearin;} |
|
131 | 7340 |
yyerrok; |
7341 |
} |
|
7342 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7343 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7344 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7345 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7346 |
unary_expression: |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7347 |
primary_expression |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7348 |
| '-' non_int_or_real_primary_expression |
68 | 7349 |
{$$ = new neg_expression_c($2, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7350 |
| NOT primary_expression |
68 | 7351 |
{$$ = new not_expression_c($2, locloc(@$));} |
131 | 7352 |
/* ERROR_CHECK_BEGIN */ |
7353 |
| '-' error |
|
7354 |
{$$ = NULL; |
|
136 | 7355 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no expression defined after '-' in ST expression.");} |
7356 |
else {print_err_msg(locf(@2), locl(@2), "invalid expression after '-' in ST expression."); yyclearin;} |
|
131 | 7357 |
yyerrok; |
7358 |
} |
|
7359 |
| NOT error |
|
7360 |
{$$ = NULL; |
|
136 | 7361 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no expression defined after 'NOT' in ST expression.");} |
7362 |
else {print_err_msg(locf(@2), locl(@2), "invalid expression after 'NOT' in ST expression."); yyclearin;} |
|
131 | 7363 |
yyerrok; |
7364 |
} |
|
7365 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7366 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7367 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7368 |
/* Not required... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7369 |
unary_operator: '-' | 'NOT' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7370 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7371 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7372 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7373 |
/* NOTE: using constant as a possible symbol for primary_expression |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7374 |
* leads to a reduce/reduce conflict. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7375 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7376 |
* The text '-9' may be parsed as either a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7377 |
* expression<-primary_expression<-constant<-signed_integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7378 |
* (i.e. the constant 9 negative) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7379 |
* OR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7380 |
* expression<-unary_expression<-constant<-integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7381 |
* (i.e. the constant 9, preceded by a unary negation) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7382 |
* |
257 | 7383 |
* To remove the conflict, we only allow constants without |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7384 |
* integer or reals that are not preceded by a sign |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7385 |
* (i.e. a '-' or '+' character) to be used in primary_expression |
257 | 7386 |
* (i.e. as a parameter to the unary negation operator) |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7387 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7388 |
* e.g. '-42', '+54', '42', '54' are all allowed in primary expression |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7389 |
* according to the standard. However, we will allow only '-42' and '+54' |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7390 |
* to be used as an argument to the negation operator ('-'). |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7391 |
*/ |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7392 |
/* NOTE: Notice that the standard considers the following syntax correct: |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7393 |
* VAR intv: INT; END_VAR |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7394 |
* intv := 42; <----- OK |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7395 |
* intv := -42; <----- OK |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7396 |
* intv := +42; <----- OK |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7397 |
* intv := --42; <----- OK!! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7398 |
* intv := -+42; <----- OK!! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7399 |
* intv := -(--42); <----- OK!! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7400 |
* intv := -(-+42); <----- OK!! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7401 |
* intv :=-(-(--42)); <----- OK!! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7402 |
* intv :=-(-(-+42)); <----- OK!! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7403 |
* but does NOT allow the following syntax: |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7404 |
* VAR intv: INT; END_VAR |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7405 |
* intv := ---42; <----- ERROR!! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7406 |
* intv := --+42; <----- ERROR!! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7407 |
* intv := ----42; <----- ERROR!! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7408 |
* intv := ---+42; <----- ERROR!! |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7409 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7410 |
* Although strange, we follow the standard to the letter, and do exactly |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7411 |
* as stated above!! |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7412 |
*/ |
13 | 7413 |
/* NOTE: We use enumerated_value_without_identifier instead of enumerated_value |
7414 |
* in order to remove a reduce/reduce conflict between reducing an |
|
7415 |
* identifier to a variable or an enumerated_value. |
|
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
7416 |
* |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
7417 |
* This change follows the IEC specification. The specification seems to |
85 | 7418 |
* imply (by introducing syntax that allows to unambiguosly reference an |
7419 |
* enumerated value - enum_type#enum_value) that in case the same identifier is used |
|
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
7420 |
* for a variable and an enumerated value, then the variable shall be |
85 | 7421 |
* considered. |
13 | 7422 |
*/ |
643
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7423 |
non_int_or_real_primary_expression: |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7424 |
non_int_or_real_constant |
85 | 7425 |
//| enumerated_value_without_identifier |
7426 |
| enumerated_value |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7427 |
| variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7428 |
| '(' expression ')' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7429 |
{$$ = $2;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7430 |
| function_invocation |
131 | 7431 |
/* ERROR_CHECK_BEGIN */ |
7432 |
| '(' expression error |
|
136 | 7433 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of expression in ST expression."); yyerrok;} |
131 | 7434 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7435 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7436 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7437 |
|
257 | 7438 |
primary_expression: |
7439 |
constant |
|
7440 |
//| enumerated_value_without_identifier |
|
328
66cd5d9893dd
Add support for finding type of a constant enumerated value and managing conflict between same identifiers defined in different enumerated data types
laurent
parents:
315
diff
changeset
|
7441 |
| enumerated_value |
257 | 7442 |
| variable |
7443 |
| '(' expression ')' |
|
7444 |
{$$ = $2;} |
|
7445 |
| function_invocation |
|
7446 |
/* ERROR_CHECK_BEGIN */ |
|
7447 |
| '(' expression error |
|
7448 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of expression in ST expression."); yyerrok;} |
|
7449 |
/* ERROR_CHECK_END */ |
|
7450 |
; |
|
7451 |
||
7452 |
||
7453 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7454 |
/* intermediate helper symbol for primary_expression */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7455 |
/* NOTE: function_name includes the standard function name 'NOT' ! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7456 |
* This introduces a reduce/reduce conflict, as NOT(var) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7457 |
* may be parsed as either a function_invocation, or a |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7458 |
* unary_expression. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7459 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7460 |
* I (Mario) have opted to remove the possible reduction |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7461 |
* to function invocation, which means replacing the rule |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7462 |
* function_name '(' param_assignment_list ')' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7463 |
* with |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7464 |
* function_name_no_NOT_clashes '(' param_assignment_list ')' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7465 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7466 |
* Notice how the new rule does not include the situation where |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7467 |
* the function NOT is called with more than one parameter, which |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7468 |
* the original rule does include! Callinf the NOT function with more |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7469 |
* than one argument is probably a semantic error anyway, so it |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7470 |
* doesn't make much sense to take it into account. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7471 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7472 |
* Nevertheless, if we were to to it entirely correctly, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7473 |
* leaving the semantic checks for the next compiler stage, |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7474 |
* this syntax parser would need to include such a possibility. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7475 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7476 |
* We will leave this out for now. No need to complicate the syntax |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7477 |
* more than the specification does by contradicting itself, and |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7478 |
* letting names clash! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7479 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7480 |
function_invocation: |
85 | 7481 |
/* function_name '(' [param_assignment_list] ')' */ |
7482 |
function_name_no_NOT_clashes '(' param_assignment_formal_list ')' |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7483 |
{$$ = new function_invocation_c($1, $3, NULL, locloc(@$));} |
85 | 7484 |
| function_name_no_NOT_clashes '(' param_assignment_nonformal_list ')' |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7485 |
{$$ = new function_invocation_c($1, NULL, $3, locloc(@$));} |
131 | 7486 |
/* ERROR_CHECK_BEGIN */ |
7487 |
| function_name_no_NOT_clashes param_assignment_formal_list ')' |
|
136 | 7488 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function name in ST expression."); yynerrs++;} |
131 | 7489 |
| function_name_no_NOT_clashes '(' ')' |
136 | 7490 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no parameter defined in function invocation of ST expression."); yynerrs++;} |
131 | 7491 |
| function_name_no_NOT_clashes '(' error ')' |
136 | 7492 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid parameter(s) defined in function invocation of ST expression."); yyerrok;} |
131 | 7493 |
| function_name_no_NOT_clashes '(' param_assignment_formal_list error |
136 | 7494 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of function invocation in ST expression."); yyerrok;} |
131 | 7495 |
| function_name_no_NOT_clashes '(' param_assignment_nonformal_list error |
136 | 7496 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of function invocation in ST expression."); yyerrok;} |
131 | 7497 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7498 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7499 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7500 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7501 |
/********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7502 |
/* B 3.2 Statements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7503 |
/********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7504 |
statement_list: |
13 | 7505 |
statement ';' |
68 | 7506 |
{$$ = new statement_list_c(locloc(@$)); $$->add_element($1);} |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
7507 |
| any_pragma |
68 | 7508 |
{$$ = new statement_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7509 |
| statement_list statement ';' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7510 |
{$$ = $1; $$->add_element($2);} |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
7511 |
| statement_list any_pragma |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7512 |
{$$ = $1; $$->add_element($2);} |
68 | 7513 |
/* ERROR_CHECK_BEGIN */ |
133 | 7514 |
| statement error |
136 | 7515 |
{$$ = new statement_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at the end of statement in ST statement."); yyerrok;} |
133 | 7516 |
| statement_list statement error |
136 | 7517 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at the end of statement in ST statement."); yyerrok;} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7518 |
| statement_list error ';' |
136 | 7519 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid statement in ST statement."); yyerrok;} |
133 | 7520 |
| statement_list ';' |
136 | 7521 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after statement in ST statement."); yynerrs++;} |
68 | 7522 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7523 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7524 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7525 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7526 |
statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7527 |
assignment_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7528 |
| subprogram_control_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7529 |
| selection_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7530 |
| iteration_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7531 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7532 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7533 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7534 |
/*********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7535 |
/* B 3.2.1 Assignment Statements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7536 |
/*********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7537 |
assignment_statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7538 |
variable ASSIGN expression |
68 | 7539 |
{$$ = new assignment_statement_c($1, $3, locloc(@$));} |
131 | 7540 |
/* ERROR_CHECK_BEGIN */ |
136 | 7541 |
| error ASSIGN expression |
7542 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid variable before ':=' in ST assignment statement."); yyerrok;} |
|
131 | 7543 |
| variable ASSIGN error |
133 | 7544 |
{$$ = NULL; |
136 | 7545 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after ':=' in ST assignment statement.");} |
7546 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after ':=' in ST assignment statement."); yyclearin;} |
|
131 | 7547 |
yyerrok; |
7548 |
} |
|
7549 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7550 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7551 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7552 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7553 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7554 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7555 |
/*****************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7556 |
/* B 3.2.2 Subprogram Control Statements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7557 |
/*****************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7558 |
subprogram_control_statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7559 |
fb_invocation |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7560 |
| return_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7561 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7562 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7563 |
return_statement: |
68 | 7564 |
RETURN {$$ = new return_statement_c(locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7565 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7566 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7567 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7568 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7569 |
fb_invocation: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7570 |
prev_declared_fb_name '(' ')' |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7571 |
{$$ = new fb_invocation_c($1, NULL, NULL, locloc(@$)); } |
85 | 7572 |
| prev_declared_fb_name '(' param_assignment_formal_list ')' |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7573 |
{$$ = new fb_invocation_c($1, $3, NULL, locloc(@$));} |
85 | 7574 |
| prev_declared_fb_name '(' param_assignment_nonformal_list ')' |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7575 |
{$$ = new fb_invocation_c($1, NULL, $3, locloc(@$));} |
131 | 7576 |
/* ERROR_CHECK_BEGIN */ |
7577 |
| prev_declared_fb_name ')' |
|
136 | 7578 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function block name in ST statement."); yynerrs++;} |
131 | 7579 |
| prev_declared_fb_name param_assignment_formal_list ')' |
136 | 7580 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function block name in ST statement."); yynerrs++;} |
131 | 7581 |
| prev_declared_fb_name '(' error ')' |
136 | 7582 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid parameter list in function block invocation in ST statement."); yyerrok;} |
131 | 7583 |
| prev_declared_fb_name '(' error |
136 | 7584 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing after parameter list of function block invocation in ST statement."); yyerrok;} |
131 | 7585 |
| prev_declared_fb_name '(' param_assignment_formal_list error |
136 | 7586 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after parameter list of function block invocation in ST statement."); yyerrok;} |
131 | 7587 |
| prev_declared_fb_name '(' param_assignment_nonformal_list error |
136 | 7588 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after parameter list of function block invocation in ST statement."); yyerrok;} |
131 | 7589 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7590 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7591 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7592 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7593 |
/* helper symbol for |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7594 |
* - fb_invocation |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7595 |
* - function_invocation |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7596 |
*/ |
85 | 7597 |
param_assignment_formal_list: |
7598 |
param_assignment_formal |
|
68 | 7599 |
{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);} |
85 | 7600 |
| param_assignment_formal_list ',' param_assignment_formal |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7601 |
{$$ = $1; $$->add_element($3);} |
131 | 7602 |
/* ERROR_CHECK_BEGIN */ |
7603 |
| param_assignment_formal_list ',' error |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
7604 |
{$$ = $1; |
136 | 7605 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no parameter assignment defined in ST parameter assignment list.");} |
7606 |
else {print_err_msg(locf(@3), locl(@3), "invalid parameter assignment in ST parameter assignment list."); yyclearin;} |
|
131 | 7607 |
yyerrok; |
7608 |
} |
|
7609 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7610 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7611 |
|
85 | 7612 |
/* helper symbol for |
7613 |
* - fb_invocation |
|
7614 |
* - function_invocation |
|
7615 |
*/ |
|
7616 |
param_assignment_nonformal_list: |
|
7617 |
param_assignment_nonformal |
|
7618 |
{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);} |
|
7619 |
| param_assignment_nonformal_list ',' param_assignment_nonformal |
|
7620 |
{$$ = $1; $$->add_element($3);} |
|
131 | 7621 |
/* ERROR_CHECK_BEGIN */ |
7622 |
| param_assignment_nonformal_list ',' error |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
7623 |
{$$ = $1; |
136 | 7624 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no parameter assignment defined in ST parameter assignment list.");} |
7625 |
else {print_err_msg(locf(@3), locl(@3), "invalid parameter assignment in ST parameter assignment list."); yyclearin;} |
|
131 | 7626 |
yyerrok; |
7627 |
} |
|
7628 |
/* ERROR_CHECK_END */ |
|
85 | 7629 |
; |
7630 |
||
7631 |
||
7632 |
/* NOTE: According to the IEC 61131-3 standard, there are two possible |
|
7633 |
* syntaxes for calling function blocks within ST. |
|
7634 |
* The formal method has the form: |
|
7635 |
* fb ( invar := x, inoutvar := var1, outvar => var2); |
|
7636 |
* The non-formal method has the form: |
|
7637 |
* fb (x, var1, var2); |
|
7638 |
* In the text of IEC 61131-3 (where the semantics are defined), |
|
7639 |
* it is obvious that mixing the two syntaxes is considered incorrect. |
|
7640 |
* The following should therefore be incorrect: |
|
7641 |
* fb ( invar := x, var1, var2); |
|
7642 |
* However, according to the syntax definition, as defined in IEC 61131-3, |
|
7643 |
* mixing the formal and non-formal methods of invocation is allowed. |
|
7644 |
* We have two alternatives: |
|
7645 |
* (a) implement the syntax here in iec.y according to the standard, |
|
7646 |
* and leave it to the semantic analyser stage to find this error |
|
7647 |
* (b) or implement the syntax in iec.y correctly, not allowing |
|
7648 |
* the mixing of formal and non-formal invocation syntaxes. |
|
7649 |
* Considering that this is a syntax issue, and not semantic issue, |
|
7650 |
* I (Mario) have decided to go with alternative (a). |
|
7651 |
* In other words, in iec.y we do not follow the syntax as defined in |
|
7652 |
* Annex B of the IEC 61131-3 standard, but rather implement |
|
7653 |
* the syntax also taking into account the textual part of the standard too. |
|
7654 |
*/ |
|
7655 |
/* |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7656 |
param_assignment: |
85 | 7657 |
variable_name ASSIGN expression |
7658 |
*/ |
|
7659 |
param_assignment_nonformal: |
|
7660 |
expression |
|
7661 |
; |
|
7662 |
||
7663 |
||
7664 |
param_assignment_formal: |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7665 |
any_identifier ASSIGN expression |
68 | 7666 |
{$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7667 |
| en_identifier ASSIGN expression |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7668 |
{$$ = new input_variable_param_assignment_c($1, $3, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7669 |
/*| variable_name SENDTO variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7670 |
/*| any_identifier SENDTO variable */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7671 |
| sendto_identifier SENDTO variable |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7672 |
{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));} |
257 | 7673 |
/* The following is not required, as the sendto_identifier_token returned by flex will |
7674 |
* also include the 'ENO' identifier. |
|
7675 |
* The resulting abstract syntax tree is identical with or without this following rule, |
|
7676 |
* as both the eno_identifier and the sendto_identifier are stored as |
|
7677 |
* an identifier_c !! |
|
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7678 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7679 |
* To understand why we must even explicitly consider the use of ENO here, |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7680 |
* please read the comment above the definition of 'variable' in section B1.4 for details. |
257 | 7681 |
*/ |
7682 |
/* |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7683 |
| eno_identifier SENDTO variable |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7684 |
{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));} |
257 | 7685 |
*/ |
85 | 7686 |
/*| NOT variable_name SENDTO variable */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7687 |
/*| NOT any_identifier SENDTO variable*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7688 |
| NOT sendto_identifier SENDTO variable |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7689 |
{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));} |
257 | 7690 |
/* The following is not required, as the sendto_identifier_token returned by flex will |
7691 |
* also include the 'ENO' identifier. |
|
7692 |
* The resulting abstract syntax tree is identical with or without this following rule, |
|
7693 |
* as both the eno_identifier and the sendto_identifier are stored as |
|
7694 |
* an identifier_c !! |
|
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7695 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7696 |
* To understand why we must even explicitly consider the use of ENO here, |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7697 |
* please read the comment above the definition of 'variable' in section B1.4 for details. |
257 | 7698 |
*/ |
7699 |
/* |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7700 |
| NOT eno_identifier SENDTO variable |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7701 |
{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));} |
257 | 7702 |
*/ |
131 | 7703 |
/* ERROR_CHECK_BEGIN */ |
7704 |
| any_identifier ASSIGN error |
|
7705 |
{$$ = NULL; |
|
136 | 7706 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");} |
7707 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;} |
|
7708 |
yyerrok; |
|
7709 |
} |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7710 |
| en_identifier ASSIGN error |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7711 |
{$$ = NULL; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7712 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");} |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7713 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;} |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7714 |
yyerrok; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7715 |
} |
131 | 7716 |
| sendto_identifier SENDTO error |
7717 |
{$$ = NULL; |
|
136 | 7718 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");} |
7719 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;} |
|
131 | 7720 |
yyerrok; |
7721 |
} |
|
257 | 7722 |
/* |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7723 |
| eno_identifier SENDTO error |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7724 |
{$$ = NULL; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7725 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");} |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7726 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;} |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7727 |
yyerrok; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7728 |
} |
257 | 7729 |
*/ |
131 | 7730 |
| NOT SENDTO variable |
136 | 7731 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter name defined in ST formal parameter out negated assignment."); yynerrs++;} |
131 | 7732 |
| NOT error SENDTO variable |
136 | 7733 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter name defined in ST formal parameter out negated assignment."); yyerrok;} |
131 | 7734 |
| NOT sendto_identifier SENDTO error |
7735 |
{$$ = NULL; |
|
136 | 7736 |
if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");} |
7737 |
else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;} |
|
131 | 7738 |
yyerrok; |
7739 |
} |
|
257 | 7740 |
/* |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7741 |
| NOT eno_identifier SENDTO error |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7742 |
{$$ = NULL; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7743 |
if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");} |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7744 |
else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;} |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7745 |
yyerrok; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7746 |
} |
257 | 7747 |
*/ |
131 | 7748 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7749 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7750 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7751 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7752 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7753 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7754 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7755 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7756 |
/* B 3.2.3 Selection Statements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7757 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7758 |
selection_statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7759 |
if_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7760 |
| case_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7761 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7762 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7763 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7764 |
if_statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7765 |
IF expression THEN statement_list elseif_statement_list END_IF |
68 | 7766 |
{$$ = new if_statement_c($2, $4, $5, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7767 |
| IF expression THEN statement_list elseif_statement_list ELSE statement_list END_IF |
68 | 7768 |
{$$ = new if_statement_c($2, $4, $5, $7, locloc(@$));} |
131 | 7769 |
/* ERROR_CHECK_BEGIN */ |
7770 |
| IF THEN statement_list elseif_statement_list END_IF |
|
136 | 7771 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'IF' statement."); yynerrs++;} |
131 | 7772 |
| IF THEN statement_list elseif_statement_list ELSE statement_list END_IF |
136 | 7773 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'IF' statement."); yynerrs++;} |
131 | 7774 |
| IF error THEN statement_list elseif_statement_list END_IF |
136 | 7775 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'IF' statement."); yyerrok;} |
131 | 7776 |
| IF error THEN statement_list elseif_statement_list ELSE statement_list END_IF |
136 | 7777 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'IF' statement."); yyerrok;} |
131 | 7778 |
| IF expression error statement_list elseif_statement_list END_IF |
136 | 7779 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'THEN' after test expression in ST 'IF' statement."); yyerrok;} |
131 | 7780 |
| IF expression error statement_list elseif_statement_list ELSE statement_list END_IF |
136 | 7781 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'THEN' after test expression in ST 'IF' statement."); yyerrok;} |
131 | 7782 |
| IF expression THEN elseif_statement_list END_IF |
136 | 7783 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no statement defined after 'THEN' in ST 'IF' statement."); yynerrs++;} |
131 | 7784 |
| IF expression THEN elseif_statement_list ELSE statement_list END_IF |
136 | 7785 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no statement defined after 'THEN' in ST 'IF' statement."); yynerrs++;} |
131 | 7786 |
| IF expression THEN statement_list elseif_statement_list ELSE END_IF |
136 | 7787 |
{$$ = NULL; print_err_msg(locl(@6), locf(@7), "no statement defined after 'ELSE' in ST 'IF' statement."); yynerrs++;} |
131 | 7788 |
| IF expression THEN statement_list elseif_statement_list ELSE error END_IF |
136 | 7789 |
{$$ = NULL; print_err_msg(locf(@7), locl(@7), "invalid statement defined after 'ELSE' in ST 'IF' statement."); yynerrs++; yyerrok;} |
7790 |
| IF expression error END_OF_INPUT |
|
7791 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed 'IF' statement in ST."); yyerrok;} |
|
7792 |
| IF expression THEN statement_list elseif_statement_list END_OF_INPUT |
|
7793 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'IF' statement in ST."); yynerrs++;} |
|
7794 |
| IF expression THEN statement_list elseif_statement_list ELSE statement_list END_OF_INPUT |
|
7795 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'IF' statement in ST."); yynerrs++;} |
|
131 | 7796 |
| IF error END_IF |
136 | 7797 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'IF' statement."); yyerrok;} |
131 | 7798 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7799 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7800 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7801 |
/* helper symbol for if_statement */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7802 |
elseif_statement_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7803 |
/* empty */ |
68 | 7804 |
{$$ = new elseif_statement_list_c(locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7805 |
| elseif_statement_list elseif_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7806 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7807 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7808 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7809 |
/* helper symbol for elseif_statement_list */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7810 |
elseif_statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7811 |
ELSIF expression THEN statement_list |
68 | 7812 |
{$$ = new elseif_statement_c($2, $4, locloc(@$));} |
131 | 7813 |
/* ERROR_CHECK_BEGIN */ |
7814 |
| ELSIF THEN statement_list |
|
136 | 7815 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined for 'ELSEIF' statement in ST 'IF' statement."); yynerrs++;} |
131 | 7816 |
| ELSIF error THEN statement_list |
136 | 7817 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for 'ELSEIF' statement in ST 'IF' statement."); yyerrok;} |
131 | 7818 |
| ELSIF expression error statement_list |
136 | 7819 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'THEN' after test expression in 'ELSEIF' statement of ST 'IF' statement."); yyerrok;} |
131 | 7820 |
| ELSIF expression THEN error |
136 | 7821 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid statement list in 'ELSEIF' statement of ST 'IF' statement."); yyerrok;} |
131 | 7822 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7823 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7824 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7825 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7826 |
case_statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7827 |
CASE expression OF case_element_list END_CASE |
68 | 7828 |
{$$ = new case_statement_c($2, $4, NULL, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7829 |
| CASE expression OF case_element_list ELSE statement_list END_CASE |
68 | 7830 |
{$$ = new case_statement_c($2, $4, $6, locloc(@$));} |
131 | 7831 |
/* ERROR_CHECK_BEGIN */ |
7832 |
| CASE OF case_element_list END_CASE |
|
136 | 7833 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'CASE' statement."); yynerrs++;} |
131 | 7834 |
| CASE OF case_element_list ELSE statement_list END_CASE |
136 | 7835 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'CASE' statement."); yynerrs++;} |
131 | 7836 |
| CASE error OF case_element_list END_CASE |
136 | 7837 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'CASE' statement."); yyerrok;} |
131 | 7838 |
| CASE error OF case_element_list ELSE statement_list END_CASE |
136 | 7839 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'CASE' statement."); yyerrok;} |
131 | 7840 |
| CASE expression error case_element_list END_CASE |
136 | 7841 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'OF' after test expression in ST 'CASE' statement."); yyerrok;} |
131 | 7842 |
| CASE expression error case_element_list ELSE statement_list END_CASE |
136 | 7843 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'OF' after test expression in ST 'CASE' statement."); yyerrok;} |
131 | 7844 |
| CASE expression OF END_CASE |
136 | 7845 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no case element(s) defined after 'OF' in ST 'CASE' statement."); yynerrs++;} |
131 | 7846 |
| CASE expression OF ELSE statement_list END_CASE |
136 | 7847 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no case element(s) defined after 'OF' in ST 'CASE' statement."); yynerrs++;} |
131 | 7848 |
| CASE expression OF error END_CASE |
136 | 7849 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid case element(s) defined after 'OF' in ST 'CASE' statement."); yyerrok;} |
131 | 7850 |
| CASE expression OF error ELSE statement_list END_CASE |
136 | 7851 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid case element(s) defined after 'OF' in ST 'CASE' statement."); yyerrok;} |
131 | 7852 |
| CASE expression OF case_element_list ELSE END_CASE |
136 | 7853 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "no statement defined after 'ELSE' in ST 'CASE' statement."); yynerrs++;} |
131 | 7854 |
| CASE expression OF case_element_list ELSE error END_CASE |
136 | 7855 |
{$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid statement defined after 'ELSE' in ST 'CASE' statement."); yyerrok;} |
7856 |
| CASE expression error END_OF_INPUT |
|
7857 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed 'CASE' statement in ST."); yyerrok;} |
|
7858 |
| CASE expression OF case_element_list END_OF_INPUT |
|
7859 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'CASE' statement in ST."); yynerrs++;} |
|
7860 |
| CASE expression OF case_element_list ELSE statement_list END_OF_INPUT |
|
7861 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'CASE' statement in ST."); yynerrs++;} |
|
131 | 7862 |
| CASE error END_CASE |
136 | 7863 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'CASE' statement."); yyerrok;} |
131 | 7864 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7865 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7866 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7867 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7868 |
/* helper symbol for case_statement */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7869 |
case_element_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7870 |
case_element |
68 | 7871 |
{$$ = new case_element_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7872 |
| case_element_list case_element |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7873 |
{$$ = $1; $$->add_element($2);} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7874 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7875 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7876 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7877 |
case_element: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7878 |
case_list ':' statement_list |
68 | 7879 |
{$$ = new case_element_c($1, $3, locloc(@$));} |
131 | 7880 |
/* ERROR_CHECK_BEGIN */ |
7881 |
| case_list statement_list |
|
136 | 7882 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after case list in ST 'CASE' statement."); yynerrs++;} |
131 | 7883 |
| case_list ':' error |
136 | 7884 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid statement in case element of ST 'CASE' statement."); yyerrok;} |
131 | 7885 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7886 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7887 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7888 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7889 |
case_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7890 |
case_list_element |
68 | 7891 |
{$$ = new case_list_c(locloc(@$)); $$->add_element($1);} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7892 |
| case_list ',' case_list_element |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7893 |
{$$ = $1; $$->add_element($3);} |
131 | 7894 |
/* ERROR_CHECK_BEGIN */ |
7895 |
| case_list ',' error |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
7896 |
{$$ = $1; |
136 | 7897 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no case defined in case list of ST parameter assignment list.");} |
7898 |
else {print_err_msg(locf(@3), locl(@3), "invalid case in case list of ST parameter assignment list."); yyclearin;} |
|
131 | 7899 |
yyerrok; |
7900 |
} |
|
7901 |
/* ERROR_CHECK_END */ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7902 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7903 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7904 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7905 |
case_list_element: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7906 |
signed_integer |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
7907 |
| subrange |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7908 |
| enumerated_value |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7909 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7910 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7911 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7912 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7913 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7914 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7915 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7916 |
/* B 3.2.4 Iteration Statements */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7917 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7918 |
iteration_statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7919 |
for_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7920 |
| while_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7921 |
| repeat_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7922 |
| exit_statement |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7923 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7924 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7925 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7926 |
for_statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7927 |
FOR control_variable ASSIGN expression TO expression BY expression DO statement_list END_FOR |
68 | 7928 |
{$$ = new for_statement_c($2, $4, $6, $8, $10, locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7929 |
| FOR control_variable ASSIGN expression TO expression DO statement_list END_FOR |
68 | 7930 |
{$$ = new for_statement_c($2, $4, $6, NULL, $8, locloc(@$));} |
131 | 7931 |
/* ERROR_CHECK_BEGIN */ |
7932 |
| FOR ASSIGN expression TO expression BY expression DO statement_list END_FOR |
|
136 | 7933 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no control variable defined in ST 'FOR' statement."); yynerrs++;} |
131 | 7934 |
| FOR ASSIGN expression TO expression DO statement_list END_FOR |
136 | 7935 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no control variable defined in ST 'FOR' statement."); yynerrs++;} |
131 | 7936 |
| FOR error ASSIGN expression TO expression BY expression DO statement_list END_FOR |
136 | 7937 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid control variable defined for ST 'FOR' statement."); yyerrok;} |
131 | 7938 |
| FOR error ASSIGN expression TO expression DO statement_list END_FOR |
136 | 7939 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid control variable defined for ST 'FOR' statement."); yyerrok;} |
131 | 7940 |
| FOR control_variable expression TO expression BY expression DO statement_list END_FOR |
136 | 7941 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':=' missing between control variable and start expression in ST 'FOR' statement."); yynerrs++;} |
131 | 7942 |
| FOR control_variable expression TO expression DO statement_list END_FOR |
136 | 7943 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':=' missing between control variable and start expression in ST 'FOR' statement."); yynerrs++;} |
131 | 7944 |
| FOR control_variable error expression TO expression BY expression DO statement_list END_FOR |
136 | 7945 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting ':=' between control variable and start expression in ST 'FOR' statement."); yyerrok;} |
131 | 7946 |
| FOR control_variable error expression TO expression DO statement_list END_FOR |
136 | 7947 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting ':=' between control variable and start expression in ST 'FOR' statement."); yyerrok;} |
131 | 7948 |
| FOR control_variable ASSIGN TO expression BY expression DO statement_list END_FOR |
136 | 7949 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no start expression defined in ST 'FOR' statement."); yynerrs++;} |
131 | 7950 |
| FOR control_variable ASSIGN TO expression DO statement_list END_FOR |
136 | 7951 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no start expression defined in ST 'FOR' statement."); yynerrs++;} |
131 | 7952 |
| FOR control_variable ASSIGN error TO expression BY expression DO statement_list END_FOR |
136 | 7953 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid start expression defined in ST 'FOR' statement."); yyerrok;} |
131 | 7954 |
| FOR control_variable ASSIGN error TO expression DO statement_list END_FOR |
136 | 7955 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid start expression in ST 'FOR' statement."); yyerrok;} |
131 | 7956 |
| FOR control_variable ASSIGN expression error expression BY expression DO statement_list END_FOR |
136 | 7957 |
{$$ = NULL; print_err_msg(locf(@5), locl(@5), "expecting 'TO' between start expression and end expression in ST 'FOR' statement."); yyerrok;} |
131 | 7958 |
| FOR control_variable ASSIGN expression error expression DO statement_list END_FOR |
136 | 7959 |
{$$ = NULL; print_err_msg(locf(@5), locl(@5), "expecting 'TO' between start expression and end expression in ST 'FOR' statement."); yyerrok;} |
131 | 7960 |
| FOR control_variable ASSIGN expression TO expression error expression DO statement_list END_FOR |
136 | 7961 |
{$$ = NULL; print_err_msg(locf(@7), locl(@7), "expecting 'BY' between end expression and step expression in ST 'FOR' statement."); yyerrok;} |
131 | 7962 |
| FOR control_variable ASSIGN expression TO expression BY expression error statement_list END_FOR |
136 | 7963 |
{$$ = NULL; print_err_msg(locf(@9), locl(@9), "expecting 'DO' after step expression in ST 'FOR' statement."); yyerrok;} |
131 | 7964 |
| FOR control_variable ASSIGN expression TO expression error statement_list END_FOR |
136 | 7965 |
{$$ = NULL; print_err_msg(locf(@7), locl(@7), "expecting 'DO' after end expression in ST 'FOR' statement."); yyerrok;} |
131 | 7966 |
| FOR control_variable ASSIGN expression TO expression BY expression DO END_FOR |
136 | 7967 |
{$$ = NULL; print_err_msg(locl(@9), locf(@10), "no statement(s) defined after 'DO' in ST 'FOR' statement."); yynerrs++;} |
131 | 7968 |
| FOR control_variable ASSIGN expression TO expression DO END_FOR |
136 | 7969 |
{$$ = NULL; print_err_msg(locl(@7), locf(@8), "no statement(s) defined after 'DO' in ST 'FOR' statement."); yynerrs++;} |
131 | 7970 |
| FOR control_variable ASSIGN expression TO expression BY expression DO error END_FOR |
136 | 7971 |
{$$ = NULL; print_err_msg(locf(@10), locl(@10), "invalid statement(s) defined after 'DO' in ST 'FOR' statement."); yyerrok;} |
131 | 7972 |
| FOR control_variable ASSIGN expression TO expression DO error END_FOR |
136 | 7973 |
{$$ = NULL; print_err_msg(locf(@8), locl(@8), "invalid statement(s) defined after 'DO' in ST 'FOR' statement."); yyerrok;} |
7974 |
| FOR control_variable error END_OF_INPUT |
|
7975 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yyerrok;} |
|
7976 |
| FOR control_variable ASSIGN expression error END_OF_INPUT |
|
7977 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yyerrok;} |
|
7978 |
| FOR control_variable ASSIGN expression TO expression DO statement_list END_OF_INPUT |
|
7979 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yynerrs++;} |
|
7980 |
| FOR control_variable ASSIGN expression TO expression BY expression error END_OF_INPUT |
|
7981 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yyerrok;} |
|
7982 |
| FOR control_variable ASSIGN expression TO expression BY expression DO statement_list END_OF_INPUT |
|
7983 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yynerrs++;} |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
7984 |
| FOR error END_FOR |
136 | 7985 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'FOR' statement."); yyerrok;} |
131 | 7986 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7987 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7988 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7989 |
/* The spec has the syntax |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7990 |
* control_variable: identifier; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7991 |
* but then defines the semantics of control_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7992 |
* (Section 3.3.2.4) as being of an integer type |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7993 |
* (e.g., SINT, INT, or DINT). |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7994 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7995 |
* Obviously this presuposes that the control_variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7996 |
* must have been declared in some VAR .. END_VAR |
79 | 7997 |
* We must therefore change the syntax to read |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7998 |
* control_variable: prev_declared_variable_name; |
13 | 7999 |
* |
79 | 8000 |
* If we don't, then the correct use of any previosuly declared |
8001 |
* variable would result in an incorrect syntax error |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8002 |
*/ |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8003 |
control_variable: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8004 |
prev_declared_variable_name |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8005 |
{$$ = new symbolic_variable_c($1,locloc(@$));}; |
79 | 8006 |
// control_variable: identifier {$$ = $1;}; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8007 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8008 |
/* Integrated directly into for_statement */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8009 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8010 |
for_list: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8011 |
expression TO expression [BY expression] |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8012 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8013 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8014 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8015 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8016 |
while_statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8017 |
WHILE expression DO statement_list END_WHILE |
68 | 8018 |
{$$ = new while_statement_c($2, $4, locloc(@$));} |
131 | 8019 |
/* ERROR_CHECK_BEGIN */ |
8020 |
| WHILE DO statement_list END_WHILE |
|
136 | 8021 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'WHILE' statement."); yynerrs++;} |
131 | 8022 |
| WHILE error DO statement_list END_WHILE |
136 | 8023 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'WHILE' statement."); yyerrok;} |
131 | 8024 |
| WHILE expression error statement_list END_WHILE |
136 | 8025 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'DO' after test expression in ST 'WHILE' statement."); yyerrok;} |
131 | 8026 |
| WHILE expression DO END_WHILE |
136 | 8027 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no statement(s) defined after 'DO' in ST 'WHILE' statement."); yynerrs++;} |
131 | 8028 |
| WHILE expression DO error END_WHILE |
136 | 8029 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid statement(s) defined after 'DO' in ST 'WHILE' statement."); yyerrok;} |
8030 |
| WHILE expression error END_OF_INPUT |
|
8031 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'WHILE' statement in ST."); yyerrok;} |
|
8032 |
| WHILE expression DO statement_list END_OF_INPUT |
|
8033 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'WHILE' statement in ST."); yynerrs++;} |
|
131 | 8034 |
| WHILE error END_WHILE |
136 | 8035 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'WHILE' statement."); yyerrok;} |
131 | 8036 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8037 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8038 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8039 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8040 |
repeat_statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8041 |
REPEAT statement_list UNTIL expression END_REPEAT |
68 | 8042 |
{$$ = new repeat_statement_c($2, $4, locloc(@$));} |
131 | 8043 |
/* ERROR_CHECK_BEGIN */ |
8044 |
| REPEAT UNTIL expression END_REPEAT |
|
136 | 8045 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no statement(s) defined after 'REPEAT' in ST 'REPEAT' statement."); yynerrs++;} |
131 | 8046 |
| REPEAT error UNTIL expression END_REPEAT |
136 | 8047 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid statement(s) defined after 'REPEAT' for ST 'REPEAT' statement."); yyerrok;} |
131 | 8048 |
| REPEAT statement_list UNTIL END_REPEAT |
136 | 8049 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no test expression defined after 'UNTIL' in ST 'REPEAT' statement.");} |
131 | 8050 |
| REPEAT statement_list UNTIL error END_REPEAT |
136 | 8051 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid test expression defined after 'UNTIL' in ST 'REPEAT' statement."); yyerrok;} |
8052 |
| REPEAT statement_list END_OF_INPUT |
|
8053 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'REPEAT' statement in ST."); yynerrs++;} |
|
8054 |
| REPEAT statement_list UNTIL expression error END_OF_INPUT |
|
8055 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'REPEAT' statement in ST."); yyerrok;} |
|
131 | 8056 |
| REPEAT error END_REPEAT |
136 | 8057 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'REPEAT' statement."); yyerrok;} |
131 | 8058 |
/* ERROR_CHECK_END */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8059 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8060 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8061 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8062 |
exit_statement: |
68 | 8063 |
EXIT {$$ = new exit_statement_c(locloc(@$));} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8064 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8065 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8066 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8067 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8068 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8069 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8070 |
%% |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8071 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8072 |
#include <stdio.h> /* required for printf() */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8073 |
#include <errno.h> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8074 |
#include "../util/symtable.hh" |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8075 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8076 |
|
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8077 |
|
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8078 |
|
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8079 |
/*************************************************************************************************/ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8080 |
/* NOTE: These variables are really parameters we would like the stage2__ function to pass */ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8081 |
/* to the yyparse() function. However, the yyparse() function is created automatically */ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8082 |
/* by bison, so we cannot add parameters to this function. The only other */ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8083 |
/* option is to use global variables! yuck! */ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8084 |
/*************************************************************************************************/ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8085 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8086 |
/* A global flag used to tell the parser if overloaded funtions should be allowed. |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8087 |
* The IEC 61131-3 standard allows overloaded funtions in the standard library, |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8088 |
* but disallows them in user code... |
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8089 |
* |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8090 |
* In essence, a parameter we would like to pass to the yyparse() function but |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8091 |
* have to do it using a global variable, as the yyparse() prototype is fixed by bison. |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8092 |
*/ |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8093 |
bool allow_function_overloading = false; |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8094 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8095 |
/* | [var1_list ','] variable_name '..' */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8096 |
/* NOTE: This is an extension to the standard!!! */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8097 |
/* In order to be able to handle extensible standard functions |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8098 |
* (i.e. standard functions that may have a variable number of |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8099 |
* input parameters, such as AND(word#33, word#44, word#55, word#66), |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8100 |
* we have extended the acceptable syntax to allow var_name '..' |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8101 |
* in an input variable declaration. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8102 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8103 |
* This allows us to parse the declaration of standard |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8104 |
* extensible functions and load their interface definition |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8105 |
* into the abstract syntax tree just like we do to other |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8106 |
* user defined functions. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8107 |
* This has the advantage that we can later do semantic |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8108 |
* checking of calls to functions (be it a standard or user defined |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8109 |
* function) in (almost) exactly the same way. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8110 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8111 |
* Of course, we have a flag that disables this syntax when parsing user |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8112 |
* written code, so we only allow this extra syntax while parsing the |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8113 |
* 'header' file that declares all the standard IEC 61131-3 functions. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8114 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8115 |
bool allow_extensible_function_parameters = false; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8116 |
|
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8117 |
/* A global flag used to tell the parser whether to include the full variable location |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8118 |
* when printing out error messages... |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8119 |
*/ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8120 |
bool full_token_loc; |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8121 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8122 |
/* A pointer to the root of the parsing tree that will be generated |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8123 |
* by bison. |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8124 |
*/ |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8125 |
symbol_c *tree_root; |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8126 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8127 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8128 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8129 |
/* The following function is called automatically by bison whenever it comes across |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8130 |
* an error. Unfortunately it calls this function before executing the code that handles |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8131 |
* the error itself, so we cannot print out the correct line numbers of the error location |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8132 |
* over here. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8133 |
* Our solution is to store the current error message in a global variable, and have all |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8134 |
* error action handlers call the function print_err_msg() after setting the location |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8135 |
* (line number) variable correctly. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8136 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8137 |
const char *current_error_msg; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8138 |
void yyerror (const char *error_msg) { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8139 |
current_error_msg = error_msg; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8140 |
/* fprintf(stderr, "error %d: %s\n", yynerrs // global variable //, error_msg); */ |
68 | 8141 |
/* print_include_stack(); */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8142 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8143 |
|
136 | 8144 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8145 |
/* ERROR_CHECK_BEGIN */ |
136 | 8146 |
bool is_current_syntax_token() { |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8147 |
switch (yychar) { |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8148 |
case ';': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8149 |
case ',': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8150 |
case ')': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8151 |
case ']': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8152 |
case '+': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8153 |
case '*': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8154 |
case '-': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8155 |
case '/': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8156 |
case '<': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8157 |
case '>': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8158 |
case '=': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8159 |
case '&': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8160 |
case OR: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8161 |
case XOR: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8162 |
case AND: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8163 |
case AND2: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8164 |
case OPER_NE: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8165 |
case OPER_LE: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8166 |
case OPER_GE: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8167 |
case MOD: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8168 |
case OPER_EXP: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8169 |
case NOT: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8170 |
return true; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8171 |
default: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8172 |
return false; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8173 |
} |
136 | 8174 |
} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8175 |
/* ERROR_CHECK_END */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8176 |
|
136 | 8177 |
|
8178 |
void print_err_msg(int first_line, |
|
95 | 8179 |
int first_column, |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8180 |
const char *first_filename, |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
8181 |
long int first_order, |
95 | 8182 |
int last_line, |
8183 |
int last_column, |
|
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8184 |
const char *last_filename, |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
8185 |
long int last_order, |
95 | 8186 |
const char *additional_error_msg) { |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8187 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8188 |
const char *unknown_file = "<unknown_file>"; |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8189 |
if (first_filename == NULL) first_filename = unknown_file; |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8190 |
if ( last_filename == NULL) last_filename = unknown_file; |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8191 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8192 |
if (full_token_loc) { |
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8193 |
if (first_filename == last_filename) |
516
8591746fa134
Produce similar error messages in stage2 and stage3.
Mario de Sousa <msousa@fe.up.pt>
parents:
469
diff
changeset
|
8194 |
fprintf(stderr, "%s:%d-%d..%d-%d: error: %s\n", first_filename, first_line, first_column, last_line, last_column, additional_error_msg); |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8195 |
else |
516
8591746fa134
Produce similar error messages in stage2 and stage3.
Mario de Sousa <msousa@fe.up.pt>
parents:
469
diff
changeset
|
8196 |
fprintf(stderr, "%s:%d-%d..%s:%d-%d: error: %s\n", first_filename, first_line, first_column, last_filename, last_line, last_column, additional_error_msg); |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8197 |
} else { |
516
8591746fa134
Produce similar error messages in stage2 and stage3.
Mario de Sousa <msousa@fe.up.pt>
parents:
469
diff
changeset
|
8198 |
fprintf(stderr, "%s:%d: error: %s\n", first_filename, first_line, additional_error_msg); |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8199 |
} |
131 | 8200 |
//fprintf(stderr, "error %d: %s\n", yynerrs /* a global variable */, additional_error_msg); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8201 |
print_include_stack(); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8202 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8203 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8204 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8205 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8206 |
/* If function overloading is on, we allow several functions with the same name. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8207 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8208 |
* However, to support standard functions, we also allow functions named |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8209 |
* AND, MOD, NOT, OR, XOR, ADD, ... |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8210 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8211 |
/* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8212 |
identifier_c *token_2_identifier_c(char *value, ) { |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8213 |
identifier_c tmp = new identifier_c(value, locloc(@$)); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8214 |
if (!allow_function_overloading) { |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8215 |
fprintf(stderr, "Function overloading not allowed. Invalid identifier %s\n", ((token_c *)($$))->value); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8216 |
ERROR; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8217 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8218 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8219 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8220 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8221 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8222 |
/* convert between an il_operator to a function name */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8223 |
/* This a kludge! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8224 |
* It is required because our language requires more than one |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8225 |
* look ahead token, and bison only works with one! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8226 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8227 |
#define op_2_str(op, str) {\ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8228 |
op ## _operator_c *ptr = dynamic_cast<op ## _operator_c *>(il_operator); \ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8229 |
if (ptr != NULL) name = str; \ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8230 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8231 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8232 |
/* NOTE: this code is very ugly and un-eficient, but I (Mario) have many |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8233 |
* more things to worry about right now, so just let it be... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8234 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8235 |
symbol_c *il_operator_c_2_identifier_c(symbol_c *il_operator) { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8236 |
const char *name = NULL; |
68 | 8237 |
identifier_c *res; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8238 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8239 |
op_2_str(NOT, "NOT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8240 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8241 |
op_2_str(AND, "AND"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8242 |
op_2_str(OR, "OR"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8243 |
op_2_str(XOR, "XOR"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8244 |
op_2_str(ADD, "ADD"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8245 |
op_2_str(SUB, "SUB"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8246 |
op_2_str(MUL, "MUL"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8247 |
op_2_str(DIV, "DIV"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8248 |
op_2_str(MOD, "MOD"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8249 |
op_2_str(GT, "GT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8250 |
op_2_str(GE, "GE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8251 |
op_2_str(EQ, "EQ"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8252 |
op_2_str(LT, "LT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8253 |
op_2_str(LE, "LE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8254 |
op_2_str(NE, "NE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8255 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8256 |
op_2_str(LD, "LD"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8257 |
op_2_str(LDN, "LDN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8258 |
op_2_str(ST, "ST"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8259 |
op_2_str(STN, "STN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8260 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8261 |
op_2_str(S, "S"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8262 |
op_2_str(R, "R"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8263 |
op_2_str(S1, "S1"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8264 |
op_2_str(R1, "R1"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8265 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8266 |
op_2_str(CLK, "CLK"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8267 |
op_2_str(CU, "CU"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8268 |
op_2_str(CD, "CD"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8269 |
op_2_str(PV, "PV"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8270 |
op_2_str(IN, "IN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8271 |
op_2_str(PT, "PT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8272 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8273 |
op_2_str(ANDN, "ANDN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8274 |
op_2_str(ORN, "ORN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8275 |
op_2_str(XORN, "XORN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8276 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8277 |
op_2_str(ADD, "ADD"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8278 |
op_2_str(SUB, "SUB"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8279 |
op_2_str(MUL, "MUL"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8280 |
op_2_str(DIV, "DIV"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8281 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8282 |
op_2_str(GT, "GT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8283 |
op_2_str(GE, "GE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8284 |
op_2_str(EQ, "EQ"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8285 |
op_2_str(LT, "LT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8286 |
op_2_str(LE, "LE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8287 |
op_2_str(NE, "NE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8288 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8289 |
op_2_str(CAL, "CAL"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8290 |
op_2_str(CALC, "CALC"); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8291 |
op_2_str(CALCN, "CALCN"); |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8292 |
op_2_str(RET, "RET"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8293 |
op_2_str(RETC, "RETC"); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8294 |
op_2_str(RETCN, "RETCN"); |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8295 |
op_2_str(JMP, "JMP"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8296 |
op_2_str(JMPC, "JMPC"); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8297 |
op_2_str(JMPCN, "JMPCN"); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8298 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8299 |
if (name == NULL) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8300 |
ERROR; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8301 |
|
68 | 8302 |
res = new identifier_c(strdup(name), |
8303 |
il_operator->first_line, |
|
8304 |
il_operator->first_column, |
|
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8305 |
il_operator->first_file, |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
8306 |
il_operator->first_order, |
68 | 8307 |
il_operator->last_line, |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8308 |
il_operator->last_column, |
287
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
8309 |
il_operator->last_file, |
9df7fcb9bde5
Added tracking of order by which tokens are processed by lexical analyser.
Mario de Sousa <msousa@fe.up.pt>
parents:
286
diff
changeset
|
8310 |
il_operator->last_order |
68 | 8311 |
); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8312 |
free(il_operator); |
68 | 8313 |
return res; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8314 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8315 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8316 |
|
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
28
diff
changeset
|
8317 |
#include "standard_function_names.c" |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8318 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8319 |
const char *standard_function_block_names[] = { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8320 |
// 2.5.2.3.1 Bistable elements |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8321 |
// Table 34 - Standard bistable function blocks |
73 | 8322 |
"SR","RS", |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8323 |
// 2.5.2.3.2 Edge detection |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8324 |
// Table 35 - Standard edge detection function blocks |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8325 |
"R_TRIG","F_TRIG", |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8326 |
// 2.5.2.3.3 Counters |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8327 |
// Table 36 - Standard counter function blocks |
68 | 8328 |
"CTU","CTU_DINT","CTU_LINT","CTU_UDINT","CTU_ULINT", |
8329 |
"CTD","CTD_DINT","CTD_LINT","CTD_UDINT","CTD_ULINT", |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8330 |
"CTUD","CTUD_DINT","CTUD_LINT","CTUD_ULINT", |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8331 |
// 2.5.2.3.4 Timers |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8332 |
// Table 37 - Standard timer function blocks |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8333 |
"TP","TON","TOF", |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8334 |
/* end of array marker! Do not remove! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8335 |
NULL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8336 |
}; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8337 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8338 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8339 |
#define LIBFILE "ieclib.txt" |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8340 |
#define DEF_LIBFILENAME LIBDIRECTORY "/" LIBFILE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8341 |
|
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
28
diff
changeset
|
8342 |
extern const char *INCLUDE_DIRECTORIES[]; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
28
diff
changeset
|
8343 |
|
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8344 |
|
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8345 |
|
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8346 |
int stage2__(const char *filename, |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8347 |
const char *includedir, /* Include directory, where included files will be searched for... */ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8348 |
symbol_c **tree_root_ref, |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8349 |
bool full_token_loc_ /* error messages specify full token location */ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8350 |
) { |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8351 |
char *libfilename = NULL; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8352 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8353 |
if (includedir != NULL) { |
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
28
diff
changeset
|
8354 |
INCLUDE_DIRECTORIES[0] = includedir; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8355 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8356 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8357 |
/* first parse the standard library file... */ |
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
8358 |
/* Do not debug the standard library, even if debug flag is set! */ |
257 | 8359 |
/* |
8360 |
#if YYDEBUG |
|
8361 |
yydebug = 1; |
|
8362 |
#endif |
|
8363 |
*/ |
|
757
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8364 |
|
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8365 |
if ((libfilename = strdup3(INCLUDE_DIRECTORIES[0], "/", LIBFILE)) == NULL) { |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8366 |
fprintf (stderr, "Out of memory. Bailing out!\n"); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8367 |
return -1; |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8368 |
} |
761
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8369 |
|
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8370 |
FILE *libfile = NULL; |
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8371 |
if((libfile = parse_file(libfilename)) == NULL) { |
757
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8372 |
char *errmsg = strdup2("Error opening library file ", libfilename); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8373 |
perror(errmsg); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8374 |
free(errmsg); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8375 |
/* we give up... */ |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8376 |
return -1; |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8377 |
} |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8378 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8379 |
allow_function_overloading = true; |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8380 |
allow_extensible_function_parameters = true; |
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8381 |
full_token_loc = full_token_loc_; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8382 |
if (yyparse() != 0) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8383 |
ERROR; |
761
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8384 |
fclose(libfile); |
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8385 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8386 |
if (yynerrs > 0) { |
516
8591746fa134
Produce similar error messages in stage2 and stage3.
Mario de Sousa <msousa@fe.up.pt>
parents:
469
diff
changeset
|
8387 |
fprintf (stderr, "\n%d error(s) found in %s. Bailing out!\n", yynerrs /* global variable */, libfilename); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8388 |
ERROR; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8389 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8390 |
free(libfilename); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8391 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8392 |
/* if by any chance the library is not complete, we |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8393 |
* now add the missing reserved keywords to the list!!! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8394 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8395 |
for(int i = 0; standard_function_block_names[i] != NULL; i++) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8396 |
if (library_element_symtable.find_value(standard_function_block_names[i]) == |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8397 |
library_element_symtable.end_value()) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8398 |
library_element_symtable.insert(standard_function_block_names[i], standard_function_block_name_token); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8399 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8400 |
/* now parse the input file... */ |
257 | 8401 |
#if YYDEBUG |
8402 |
yydebug = 1; |
|
8403 |
#endif |
|
761
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8404 |
FILE *mainfile = NULL; |
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8405 |
if ((mainfile = parse_file(filename)) == NULL) { |
757
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8406 |
char *errmsg = strdup2("Error opening main file ", filename); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8407 |
perror(errmsg); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8408 |
free(errmsg); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8409 |
return -1; |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8410 |
} |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8411 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8412 |
allow_function_overloading = false; |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8413 |
allow_extensible_function_parameters = false; |
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8414 |
full_token_loc = full_token_loc_; |
757
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8415 |
|
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8416 |
if (yyparse() != 0) { |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8417 |
fprintf (stderr, "\nParsing failed because of too many consecutive syntax errors. Bailing out!\n"); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8418 |
exit(EXIT_FAILURE); |
85 | 8419 |
} |
761
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8420 |
fclose(mainfile); |
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8421 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8422 |
if (yynerrs > 0) { |
516
8591746fa134
Produce similar error messages in stage2 and stage3.
Mario de Sousa <msousa@fe.up.pt>
parents:
469
diff
changeset
|
8423 |
fprintf (stderr, "\n%d error(s) found. Bailing out!\n", yynerrs /* global variable */); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8424 |
exit(EXIT_FAILURE); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8425 |
} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
8426 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8427 |
if (tree_root_ref != NULL) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8428 |
*tree_root_ref = tree_root; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8429 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8430 |
return 0; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8431 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8432 |
|
756
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8433 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8434 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8435 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8436 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8437 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8438 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8439 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8440 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8441 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8442 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8443 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8444 |
|
634f476cb60f
Insert the auto generated enum datatype conversion functions after the TYPE...END_TYPE, instead of at the end of input file.
Mario de Sousa <msousa@fe.up.pt>
parents:
749
diff
changeset
|
8445 |