author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Fri, 05 Apr 2024 13:23:53 +0200 | |
changeset 1103 | f3c6c938d5ff |
parent 1053 | e94368340160 |
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! */ |
822 | 99 |
#include "iec_bison.hh" |
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++) { \ |
1041
56ebe2a31b5b
Access elements[] in list_c through a new get_element() method.
Mario de Sousa <msousa@fe.up.pt>
parents:
1032
diff
changeset
|
122 |
elem = list->get_element(i); \ |
0
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 |
822 | 172 |
* in the iec_bison.hh 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 |
822 | 175 |
* would get a new variable defined each time iec_bison.hh 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 |
|
934
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
201 |
/* A global flag used to tell the parser whether to allow use of DREF and '^' operators (defined in IEC 61131-3 v3) */ |
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
202 |
extern bool allow_ref_dereferencing; |
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
203 |
|
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
204 |
/* A global flag used to tell the parser whether to allow use of REF_TO ANY datatypes (non-standard extension to IEC 61131-3 v3) */ |
924 | 205 |
extern bool allow_ref_to_any; |
206 |
||
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
207 |
/* A global flag used to tell the parser whether to allow use of REF_TO as a struct or array element (non-standard extension) */ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
208 |
extern bool allow_ref_to_in_derived_datatypes; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
209 |
|
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
210 |
/* A pointer to the root of the parsing tree that will be generated by bison. */ |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
211 |
extern symbol_c *tree_root; |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
212 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
213 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
214 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
215 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
216 |
/* 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
|
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 |
/* 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
|
219 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
220 |
/* Convert an il_operator_c into an identifier_c */ |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
221 |
identifier_c *il_operator_c_2_identifier_c (symbol_c *il_operator); |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
222 |
/* Convert an il_operator_c into an poutype_identifier_c */ |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
223 |
poutype_identifier_c *il_operator_c_2_poutype_identifier_c(symbol_c *il_operator); |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
224 |
|
0
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 |
822 | 253 |
* (actually the default value of YYLTYPE) in the iec_bison.hh 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 |
*/ |
822 | 259 |
/* NOTE: since this code will be placed in the iec_bison.hh header file, |
260 |
* as well as the iec.cc file that also includes the iec_bison.hh 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 |
|
1016
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
376 |
/* Tokens used to help resolve a reduce/reduce conflict */ |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
377 |
/* The mentioned conflict only arises due to a non-standard feature added to matiec. |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
378 |
* Namely, the permission to call functions returning VOID as an ST statement. |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
379 |
* e.g.: FUNCTION foo: VOID |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
380 |
* VAR_INPUT i: INT; END_VAR; |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
381 |
* ... |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
382 |
* END_FUNCTION |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
383 |
* |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
384 |
* FUNCTION BAR: BOOL |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
385 |
* VAR b: bool; END_VAR |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
386 |
* foo(i:=42); <--- Calling foo outside an expression. Function invocation is considered an ST statement!! |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
387 |
* END_FUNCTION |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
388 |
* |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
389 |
* The above function invocation may also be reduced to a formal IL function invocation, so we get a |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
390 |
* reduce/reduce conflict to st_statement_list/instruction_list (or something equivalent). |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
391 |
* |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
392 |
* We solve this by having flex determine if it is ST or IL invocation (ST ends with a ';' !!). |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
393 |
* At the start of a function/FB/program body, flex will tell bison whether to expect ST or IL code! |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
394 |
* This is why we need the following two tokens! |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
395 |
* |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
396 |
* NOTE: flex was already determing whther it was parsing ST or IL code as it can only send |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
397 |
* EOL tokens when parsing IL. However, did this silently without telling bison about this. |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
398 |
* Now, it does |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
399 |
*/ |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
400 |
%token start_ST_body_token |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
401 |
%token start_IL_body_token |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
402 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
403 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
404 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
405 |
/**********************************************************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
406 |
/* 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
|
407 |
/**********************************************************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
408 |
|
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
409 |
/* 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
|
410 |
* 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
|
411 |
*/ |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
412 |
%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
|
413 |
%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
|
414 |
%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
|
415 |
%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
|
416 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
417 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
418 |
/* 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
|
419 |
/* 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
|
420 |
* 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
|
421 |
* 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
|
422 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
423 |
%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
|
424 |
%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
|
425 |
|
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
426 |
/* 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
|
427 |
%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
|
428 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
429 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
430 |
/* 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
|
431 |
/* 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
|
432 |
* 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
|
433 |
* 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
|
434 |
* 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
|
435 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
436 |
* 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
|
437 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
438 |
%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
|
439 |
%token ENO |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
440 |
%type <leaf> en_identifier |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
441 |
%type <leaf> eno_identifier |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
442 |
|
919
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
443 |
/* Keywords in IEC 61131-3 v3 */ |
873
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
444 |
%token REF |
933
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
445 |
%token DREF |
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
|
446 |
%token REF_TO |
919
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
447 |
%token NULL_token /* cannot use simply 'NULL', as it conflicts with the NULL keyword in 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
|
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 |
|
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 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
452 |
/* 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
|
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 <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
|
455 |
%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
|
456 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
457 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
458 |
/*******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
459 |
/* 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
|
460 |
/*******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
461 |
/* 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
|
462 |
letter |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
463 |
digit |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
464 |
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
|
465 |
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
|
466 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
467 |
%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
|
468 |
%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
|
469 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
470 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
471 |
/* 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
|
472 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
473 |
%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
|
474 |
%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
|
475 |
|
919
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
476 |
/*********************************/ |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
477 |
/* B 1.2.XX - Reference Literals */ |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
478 |
/*********************************/ |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
479 |
/* NOTE: The following syntax was added by MJS in order to add support for the NULL keyword, defined in IEC 61131-3 v3 |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
480 |
* In v3 expressions that reduce to a reference datatype (REF_TO) are handled explicitly in the syntax |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
481 |
* (e.g., any variable that is a of reference datatpe falls under the 'ref_name' rule), which means |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
482 |
* that we would need to keep track of which variables are declared as REF_TO. |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
483 |
* In order to reduce the changes to the current IEC 61131-3 v2 syntax, I have opted not to do this, |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
484 |
* and simply let the ref_expressions (Ref_Assign, Ref_Compare) be interpreted as all other standard expressions |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
485 |
* in v2. However, ref_expressions allow the use of the 'NULL' constant, which is handled explicitly |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
486 |
* in the ref_expressions syntax of v3. |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
487 |
* To allow the use of the 'NULL' constant in this extended v2, I have opted to interpret this 'NULL' constant |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
488 |
* as a literal. |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
489 |
*/ |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
490 |
%type <leaf> ref_value_null_literal /* defined in IEC 61131-3 v3 - Basically the 'NULL' keyword! */ |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
491 |
|
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
492 |
|
0
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.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
|
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 |
/* 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
|
497 |
bit |
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 |
%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
|
500 |
%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
|
501 |
%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
|
502 |
%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
|
503 |
%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
|
504 |
%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
|
505 |
%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
|
506 |
%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
|
507 |
%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
|
508 |
%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
|
509 |
%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
|
510 |
%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
|
511 |
%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
|
512 |
%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
|
513 |
%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
|
514 |
// %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
|
515 |
%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
|
516 |
%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
|
517 |
|
257 | 518 |
%token safeboolean_true_literal_token |
519 |
%token safeboolean_false_literal_token |
|
520 |
%token boolean_true_literal_token |
|
521 |
%token boolean_false_literal_token |
|
522 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
523 |
%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
|
524 |
%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
|
525 |
|
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 |
/* 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
|
529 |
/*******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
530 |
%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
|
531 |
%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
|
532 |
|
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> 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
|
534 |
%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
|
535 |
%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
|
536 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
537 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
538 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
539 |
/* 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
|
540 |
/***************************/ |
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> 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
|
542 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
543 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
544 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
545 |
/* 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
|
546 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
547 |
%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
|
548 |
%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
|
549 |
%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
|
550 |
%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
|
551 |
%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
|
552 |
%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
|
553 |
%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
|
554 |
%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
|
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 |
%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
|
557 |
%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
|
558 |
%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
|
559 |
%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
|
560 |
%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
|
561 |
%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
|
562 |
%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
|
563 |
%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
|
564 |
%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
|
565 |
%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
|
566 |
%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
|
567 |
%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
|
568 |
%token <ID> erroneous_interval_token |
257 | 569 |
// %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
|
570 |
%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
|
571 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
572 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
573 |
/************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
574 |
/* 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
|
575 |
/************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
576 |
%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
|
577 |
%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
|
578 |
%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
|
579 |
%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
|
580 |
%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
|
581 |
%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
|
582 |
%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
|
583 |
%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
|
584 |
%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
|
585 |
%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
|
586 |
%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
|
587 |
|
257 | 588 |
// %token TIME_OF_DAY |
589 |
// %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
|
590 |
%token D_SHARP |
257 | 591 |
// %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
|
592 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
593 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
594 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
595 |
/* 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
|
596 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
597 |
/* 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
|
598 |
// %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
|
599 |
%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
|
600 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
601 |
|
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 |
/* 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
|
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 |
/* NOTES: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
606 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
607 |
* - 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
|
608 |
* 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
|
609 |
* 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
|
610 |
* 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
|
611 |
* 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
|
612 |
* (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
|
613 |
* 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
|
614 |
* 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
|
615 |
* 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
|
616 |
* 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
|
617 |
* 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
|
618 |
* 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
|
619 |
* 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
|
620 |
* 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
|
621 |
* 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
|
622 |
* 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
|
623 |
* 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
|
624 |
* 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
|
625 |
* 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
|
626 |
* 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
|
627 |
* 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
|
628 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
629 |
* - 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
|
630 |
* 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
|
631 |
* 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
|
632 |
* 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
|
633 |
* 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
|
634 |
* 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
|
635 |
* 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
|
636 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
637 |
%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
|
638 |
%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
|
639 |
%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
|
640 |
%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
|
641 |
%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
|
642 |
%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
|
643 |
%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
|
644 |
%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
|
645 |
/* 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
|
646 |
* 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
|
647 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
648 |
%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
|
649 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
650 |
%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
|
651 |
%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
|
652 |
%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
|
653 |
%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
|
654 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
655 |
%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
|
656 |
%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
|
657 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
658 |
%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
|
659 |
%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
|
660 |
%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
|
661 |
%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
|
662 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
663 |
%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
|
664 |
%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
|
665 |
%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
|
666 |
%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
|
667 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
668 |
%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
|
669 |
%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
|
670 |
%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
|
671 |
|
257 | 672 |
%token TIME |
673 |
%token DATE |
|
674 |
%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
|
675 |
%token DT |
257 | 676 |
%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
|
677 |
%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
|
678 |
|
1014
a61f8f58f612
Add support for non-standard VOID datatype. May ony be used to define functions returning VOID.
mjsousa
parents:
1012
diff
changeset
|
679 |
/* A non-standard extension! */ |
a61f8f58f612
Add support for non-standard VOID datatype. May ony be used to define functions returning VOID.
mjsousa
parents:
1012
diff
changeset
|
680 |
%token VOID |
a61f8f58f612
Add support for non-standard VOID datatype. May ony be used to define functions returning VOID.
mjsousa
parents:
1012
diff
changeset
|
681 |
|
257 | 682 |
/******************************************************/ |
683 |
/* Symbols defined in */ |
|
684 |
/* "Safety Software Technical Specification, */ |
|
685 |
/* Part 1: Concepts and Function Blocks, */ |
|
686 |
/* Version 1.0 – Official Release" */ |
|
687 |
/* by PLCopen - Technical Committee 5 - 2006-01-31 */ |
|
688 |
/******************************************************/ |
|
689 |
||
690 |
%token SAFEBYTE |
|
691 |
%token SAFEWORD |
|
692 |
%token SAFEDWORD |
|
693 |
%token SAFELWORD |
|
694 |
||
695 |
%token SAFELREAL |
|
696 |
%token SAFEREAL |
|
697 |
||
698 |
%token SAFESINT |
|
699 |
%token SAFEINT |
|
700 |
%token SAFEDINT |
|
701 |
%token SAFELINT |
|
702 |
||
703 |
%token SAFEUSINT |
|
704 |
%token SAFEUINT |
|
705 |
%token SAFEUDINT |
|
706 |
%token SAFEULINT |
|
707 |
||
708 |
%token SAFEWSTRING |
|
709 |
%token SAFESTRING |
|
710 |
%token SAFEBOOL |
|
711 |
||
712 |
%token SAFETIME |
|
713 |
%token SAFEDATE |
|
714 |
%token SAFEDATE_AND_TIME |
|
715 |
%token SAFEDT |
|
716 |
%token SAFETIME_OF_DAY |
|
717 |
%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
|
718 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
719 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
720 |
/* 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
|
721 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
722 |
/* 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
|
723 |
// %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
|
724 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
725 |
/* 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
|
726 |
* 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
|
727 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
728 |
%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
|
729 |
%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
|
730 |
%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
|
731 |
%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
|
732 |
%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
|
733 |
%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
|
734 |
%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
|
735 |
%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
|
736 |
%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
|
737 |
%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
|
738 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
739 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
740 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
741 |
/* 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
|
742 |
/********************************/ |
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> 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
|
744 |
%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
|
745 |
// %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
|
746 |
// %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
|
747 |
// %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
|
748 |
// %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
|
749 |
// %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
|
750 |
|
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> 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
|
752 |
/* 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
|
753 |
%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
|
754 |
%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
|
755 |
%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
|
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 |
%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
|
758 |
%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
|
759 |
%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
|
760 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
761 |
%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
|
762 |
%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
|
763 |
%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
|
764 |
%type <leaf> subrange |
960
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
765 |
/* A non standard construct, used to support the use of variables in array subranges. e.g.: ARRAY [12..max] OF INT */ |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
766 |
%type <leaf> subrange_with_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
|
767 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
768 |
%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
|
769 |
%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
|
770 |
%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
|
771 |
/* 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
|
772 |
%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
|
773 |
%type <leaf> enumerated_value |
85 | 774 |
//%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
|
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> 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
|
777 |
%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
|
778 |
%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
|
779 |
/* 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
|
780 |
%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
|
781 |
%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
|
782 |
/* 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
|
783 |
%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
|
784 |
%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
|
785 |
%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
|
786 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
787 |
%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
|
788 |
%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
|
789 |
%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
|
790 |
%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
|
791 |
/* 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
|
792 |
%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
|
793 |
%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
|
794 |
%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
|
795 |
%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
|
796 |
/* 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
|
797 |
%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
|
798 |
%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
|
799 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
800 |
//%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
|
801 |
%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
|
802 |
/* 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
|
803 |
%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
|
804 |
/* 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
|
805 |
%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
|
806 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
807 |
%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
|
808 |
%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
|
809 |
%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
|
810 |
%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
|
811 |
%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
|
812 |
%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
|
813 |
%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
|
814 |
%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
|
815 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
816 |
|
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
817 |
%type <leaf> ref_spec /* defined in IEC 61131-3 v3 */ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
818 |
%type <leaf> ref_spec_non_recursive /* helper symbol */ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
819 |
%type <leaf> ref_spec_init /* defined in IEC 61131-3 v3 */ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
820 |
%type <leaf> ref_type_decl /* defined in IEC 61131-3 v3 */ |
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
|
821 |
|
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
|
822 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
823 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
824 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
825 |
/* 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
|
826 |
/*********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
827 |
%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
|
828 |
%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
|
829 |
/* 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
|
830 |
%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
|
831 |
%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
|
832 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
833 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
834 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
835 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
836 |
/********************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
837 |
/* 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
|
838 |
/********************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
839 |
/* 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
|
840 |
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
|
841 |
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
|
842 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
843 |
%token <ID> direct_variable_token |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
844 |
//%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
|
845 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
846 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
847 |
/*************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
848 |
/* 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
|
849 |
/*************************************/ |
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> 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
|
851 |
/* 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
|
852 |
%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
|
853 |
%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
|
854 |
/* 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
|
855 |
%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
|
856 |
%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
|
857 |
/* 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
|
858 |
%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
|
859 |
%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
|
860 |
%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
|
861 |
%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
|
862 |
/* 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
|
863 |
%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
|
864 |
%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
|
865 |
/* 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
|
866 |
%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
|
867 |
%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
|
868 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
869 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
870 |
/******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
871 |
/* 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
|
872 |
/******************************************/ |
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> 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
|
874 |
/* 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
|
875 |
%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
|
876 |
%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
|
877 |
%type <leaf> edge_declaration |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
878 |
/* 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
|
879 |
%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
|
880 |
%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
|
881 |
%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
|
882 |
%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
|
883 |
%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
|
884 |
%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
|
885 |
%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
|
886 |
/* 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
|
887 |
%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
|
888 |
/* 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
|
889 |
%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
|
890 |
// %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
|
891 |
// %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
|
892 |
%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
|
893 |
%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
|
894 |
%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
|
895 |
/* eno_param_declaration is not in the standard, but should be! */ |
147 | 896 |
%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
|
897 |
%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
|
898 |
/* 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
|
899 |
%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
|
900 |
%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
|
901 |
%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
|
902 |
%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
|
903 |
%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
|
904 |
%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
|
905 |
%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
|
906 |
%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
|
907 |
%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
|
908 |
/* 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
|
909 |
%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
|
910 |
%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
|
911 |
%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
|
912 |
/* 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
|
913 |
%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
|
914 |
%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
|
915 |
%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
|
916 |
%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
|
917 |
/* 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
|
918 |
%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
|
919 |
%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
|
920 |
%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
|
921 |
%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
|
922 |
%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
|
923 |
%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
|
924 |
%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
|
925 |
%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
|
926 |
%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
|
927 |
%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
|
928 |
%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
|
929 |
%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
|
930 |
/* 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
|
931 |
%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
|
932 |
%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
|
933 |
%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
|
934 |
%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
|
935 |
/* 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
|
936 |
%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
|
937 |
/* 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
|
938 |
* - 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
|
939 |
* - 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
|
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 |
%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
|
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 <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
|
944 |
|
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 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
|
946 |
%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
|
947 |
%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
|
948 |
%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
|
949 |
%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
|
950 |
%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
|
951 |
%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
|
952 |
%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
|
953 |
%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
|
954 |
%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
|
955 |
%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
|
956 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
957 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
958 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
959 |
/* 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
|
960 |
/***********************/ |
68 | 961 |
// %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
|
962 |
/* 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
|
963 |
%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
|
964 |
%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
|
965 |
//%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
|
966 |
/* 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
|
967 |
//%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
|
968 |
%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
|
969 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
970 |
//%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
|
971 |
/* 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
|
972 |
%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
|
973 |
%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
|
974 |
%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
|
975 |
/* 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
|
976 |
%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
|
977 |
%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
|
978 |
|
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> 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
|
980 |
%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
|
981 |
/* 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
|
982 |
%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
|
983 |
%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
|
984 |
%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
|
985 |
%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
|
986 |
%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
|
987 |
/* 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
|
988 |
%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
|
989 |
/* 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
|
990 |
%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
|
991 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
992 |
%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
|
993 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
994 |
%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
|
995 |
%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
|
996 |
%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
|
997 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
998 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
999 |
/*****************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1000 |
/* 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
|
1001 |
/*****************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1002 |
%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
|
1003 |
%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
|
1004 |
%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
|
1005 |
%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
|
1006 |
%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
|
1007 |
%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
|
1008 |
%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
|
1009 |
%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
|
1010 |
/* 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
|
1011 |
%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
|
1012 |
/* 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
|
1013 |
%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
|
1014 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1015 |
%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
|
1016 |
|
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 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
|
1018 |
%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
|
1019 |
%token VAR_TEMP |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1020 |
// %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
|
1021 |
%token VAR |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1022 |
// %token NON_RETAIN |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1023 |
// %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
|
1024 |
|
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 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1027 |
/* 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
|
1028 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1029 |
%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
|
1030 |
%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
|
1031 |
/* 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
|
1032 |
%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
|
1033 |
|
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 PROGRAM |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1035 |
%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
|
1036 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1037 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1038 |
/********************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1039 |
/* 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
|
1040 |
/********************************************/ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
1041 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1042 |
%type <list> sequential_function_chart |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
1043 |
%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
|
1044 |
%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
|
1045 |
%type <leaf> step |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
1046 |
%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
|
1047 |
%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
|
1048 |
%type <leaf> action_association |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
1049 |
/* 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
|
1050 |
%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
|
1051 |
%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
|
1052 |
%type <leaf> action_qualifier |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
1053 |
%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
|
1054 |
%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
|
1055 |
%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
|
1056 |
%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
|
1057 |
%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
|
1058 |
%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
|
1059 |
%type <list> step_name_list |
131 | 1060 |
%type <leaf> transition_priority |
85 | 1061 |
%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
|
1062 |
%type <leaf> action |
151 | 1063 |
%type <leaf> action_body |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
1064 |
%type <leaf> transition_name |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
1065 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1066 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1067 |
// %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
|
1068 |
%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
|
1069 |
%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
|
1070 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1071 |
%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
|
1072 |
%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
|
1073 |
%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
|
1074 |
%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
|
1075 |
%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
|
1076 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1077 |
%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
|
1078 |
%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
|
1079 |
%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
|
1080 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1081 |
%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
|
1082 |
%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
|
1083 |
%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
|
1084 |
%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
|
1085 |
%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
|
1086 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1087 |
%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
|
1088 |
%token P |
627
e7caa7d32ef5
Adding support for P0 and P1 qualifiers and fixing code generated for SL qualifier
Laurent Bessard
parents:
616
diff
changeset
|
1089 |
%token P0 |
e7caa7d32ef5
Adding support for P0 and P1 qualifiers and fixing code generated for SL qualifier
Laurent Bessard
parents:
616
diff
changeset
|
1090 |
%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
|
1091 |
/* 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
|
1092 |
* 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
|
1093 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1094 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1095 |
%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
|
1096 |
%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
|
1097 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1098 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1099 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1100 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1101 |
/* 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
|
1102 |
/********************************/ |
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> 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
|
1104 |
%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
|
1105 |
%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
|
1106 |
// 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
|
1107 |
// - 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
|
1108 |
// - 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
|
1109 |
// |
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
|
1110 |
%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
|
1111 |
// 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
|
1112 |
%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
|
1113 |
// 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
|
1114 |
%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
|
1115 |
// 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
|
1116 |
%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
|
1117 |
%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
|
1118 |
%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
|
1119 |
// 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
|
1120 |
%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
|
1121 |
// 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
|
1122 |
%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
|
1123 |
%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
|
1124 |
// %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
|
1125 |
// 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
|
1126 |
// %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
|
1127 |
// %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
|
1128 |
// %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
|
1129 |
// 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
|
1130 |
%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
|
1131 |
%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
|
1132 |
// %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
|
1133 |
%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
|
1134 |
%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
|
1135 |
// %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
|
1136 |
%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
|
1137 |
%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
|
1138 |
%type <leaf> task_initialization |
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
1139 |
// 3 helper symbols for task_initialization |
75 | 1140 |
%type <leaf> task_initialization_single |
1141 |
%type <leaf> task_initialization_interval |
|
1142 |
%type <leaf> task_initialization_priority |
|
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
1143 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1144 |
%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
|
1145 |
%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
|
1146 |
// 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
|
1147 |
%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
|
1148 |
// 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
|
1149 |
%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
|
1150 |
%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
|
1151 |
%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
|
1152 |
%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
|
1153 |
%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
|
1154 |
%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
|
1155 |
%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
|
1156 |
%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
|
1157 |
// 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
|
1158 |
%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
|
1159 |
%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
|
1160 |
// 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
|
1161 |
%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
|
1162 |
|
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 <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
|
1164 |
%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
|
1165 |
|
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 <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
|
1167 |
%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
|
1168 |
|
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 <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
|
1170 |
%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
|
1171 |
|
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1172 |
%type <leaf> prev_declared_configuration_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
|
1173 |
%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
|
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 |
// %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
|
1176 |
// %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
|
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 |
%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
|
1179 |
%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
|
1180 |
%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
|
1181 |
%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
|
1182 |
%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
|
1183 |
%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
|
1184 |
%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
|
1185 |
%token VAR_ACCESS |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1186 |
// %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
|
1187 |
%token WITH |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1188 |
// %token PROGRAM |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1189 |
// %token RETAIN |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1190 |
// %token NON_RETAIN |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1191 |
// %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
|
1192 |
%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
|
1193 |
%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
|
1194 |
%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
|
1195 |
%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
|
1196 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1197 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1198 |
/***********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1199 |
/* 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
|
1200 |
/***********************************/ |
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 <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
|
1202 |
%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
|
1203 |
%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
|
1204 |
%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
|
1205 |
%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
|
1206 |
// helper symbol for il_simple_operation |
91 | 1207 |
//%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
|
1208 |
%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
|
1209 |
%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
|
1210 |
%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
|
1211 |
%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
|
1212 |
// 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
|
1213 |
%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
|
1214 |
%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
|
1215 |
%type <list> il_operand_list |
91 | 1216 |
// helper symbol for il_simple_operation |
1217 |
%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
|
1218 |
%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
|
1219 |
%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
|
1220 |
%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
|
1221 |
%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
|
1222 |
%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
|
1223 |
%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
|
1224 |
%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
|
1225 |
%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
|
1226 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1227 |
%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
|
1228 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1229 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1230 |
/*******************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1231 |
/* 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
|
1232 |
/*******************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1233 |
%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
|
1234 |
%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
|
1235 |
|
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> 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
|
1237 |
%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
|
1238 |
%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
|
1239 |
%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
|
1240 |
%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
|
1241 |
%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
|
1242 |
%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
|
1243 |
%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
|
1244 |
%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
|
1245 |
%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
|
1246 |
%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
|
1247 |
%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
|
1248 |
%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
|
1249 |
%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
|
1250 |
%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
|
1251 |
%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
|
1252 |
%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
|
1253 |
%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
|
1254 |
%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
|
1255 |
%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
|
1256 |
%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
|
1257 |
%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
|
1258 |
%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
|
1259 |
%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
|
1260 |
%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
|
1261 |
%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
|
1262 |
%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
|
1263 |
%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
|
1264 |
%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
|
1265 |
%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
|
1266 |
%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
|
1267 |
%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
|
1268 |
%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
|
1269 |
%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
|
1270 |
%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
|
1271 |
%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
|
1272 |
%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
|
1273 |
%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
|
1274 |
%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
|
1275 |
%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
|
1276 |
%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
|
1277 |
%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
|
1278 |
%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
|
1279 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1280 |
%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
|
1281 |
%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
|
1282 |
%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
|
1283 |
%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
|
1284 |
%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
|
1285 |
%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
|
1286 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1287 |
//%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
|
1288 |
%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
|
1289 |
%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
|
1290 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1291 |
%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
|
1292 |
%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
|
1293 |
%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
|
1294 |
%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
|
1295 |
%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
|
1296 |
|
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 |
%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
|
1299 |
%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
|
1300 |
%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
|
1301 |
%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
|
1302 |
%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
|
1303 |
%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
|
1304 |
%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
|
1305 |
%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
|
1306 |
%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
|
1307 |
%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
|
1308 |
%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
|
1309 |
%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
|
1310 |
%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
|
1311 |
%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
|
1312 |
%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
|
1313 |
%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
|
1314 |
%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
|
1315 |
%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
|
1316 |
%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
|
1317 |
%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
|
1318 |
%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
|
1319 |
%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
|
1320 |
%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
|
1321 |
%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
|
1322 |
%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
|
1323 |
%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
|
1324 |
%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
|
1325 |
%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
|
1326 |
%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
|
1327 |
%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
|
1328 |
%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
|
1329 |
%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
|
1330 |
%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
|
1331 |
%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
|
1332 |
%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
|
1333 |
%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
|
1334 |
%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
|
1335 |
%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
|
1336 |
%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
|
1337 |
%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
|
1338 |
%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
|
1339 |
%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
|
1340 |
%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
|
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 |
%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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1345 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1346 |
/* 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
|
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 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1349 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1350 |
* - 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
|
1351 |
* 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
|
1352 |
* 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
|
1353 |
* 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
|
1354 |
*/ |
933
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
1355 |
%type <leaf> ref_expression /* an extension to the IEC 61131-3 v2 standard, based on the IEC 61131-3 v3 standard */ |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
1356 |
%type <leaf> deref_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
|
1357 |
%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
|
1358 |
%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
|
1359 |
%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
|
1360 |
%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
|
1361 |
%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
|
1362 |
// %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
|
1363 |
%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
|
1364 |
// %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
|
1365 |
%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
|
1366 |
// %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
|
1367 |
%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
|
1368 |
%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
|
1369 |
// %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
|
1370 |
%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
|
1371 |
%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
|
1372 |
/* 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
|
1373 |
%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
|
1374 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1375 |
// %token AND |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1376 |
// %token XOR |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1377 |
// %token OR |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1378 |
// %token MOD |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1379 |
// %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
|
1380 |
%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
|
1381 |
%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
|
1382 |
%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
|
1383 |
%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
|
1384 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1385 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1386 |
/********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1387 |
/* 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
|
1388 |
/********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1389 |
%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
|
1390 |
%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
|
1391 |
|
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 |
/* 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
|
1396 |
/*********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1397 |
%type <leaf> assignment_statement |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1398 |
// %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
|
1399 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1400 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1401 |
/*****************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1402 |
/* 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
|
1403 |
/*****************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1404 |
%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
|
1405 |
%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
|
1406 |
%type <leaf> fb_invocation |
85 | 1407 |
// %type <leaf> param_assignment |
1408 |
%type <leaf> param_assignment_formal |
|
1409 |
%type <leaf> param_assignment_nonformal |
|
1410 |
/* helper symbols for fb_invocation */ |
|
1411 |
%type <list> param_assignment_formal_list |
|
1412 |
%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
|
1413 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1414 |
// %token ASSIGN |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1415 |
// %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
|
1416 |
%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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1419 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1420 |
/* 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
|
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 |
%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
|
1423 |
%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
|
1424 |
%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
|
1425 |
%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
|
1426 |
%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
|
1427 |
%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
|
1428 |
/* 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
|
1429 |
%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
|
1430 |
/* 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
|
1431 |
%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
|
1432 |
/* 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
|
1433 |
%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
|
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 |
%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
|
1436 |
%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
|
1437 |
%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
|
1438 |
%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
|
1439 |
%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
|
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 |
%token CASE |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1442 |
// %token OF |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1443 |
// %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
|
1444 |
%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
|
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 |
/* 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
|
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 |
%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
|
1452 |
%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
|
1453 |
%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
|
1454 |
%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
|
1455 |
%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
|
1456 |
%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
|
1457 |
/* 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
|
1458 |
// %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
|
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 |
%token FOR |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1461 |
// %token ASSIGN |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1462 |
// %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
|
1463 |
%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
|
1464 |
%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
|
1465 |
%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
|
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 |
%token WHILE |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
1468 |
// %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
|
1469 |
%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
|
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 |
%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
|
1472 |
%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
|
1473 |
%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
|
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 |
%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
|
1476 |
|
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
1477 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1478 |
%% |
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1481 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1482 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1483 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1484 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1485 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1486 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1487 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1488 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1489 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1490 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1491 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1492 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1493 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1494 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1495 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1496 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1497 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1498 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1499 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1500 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1501 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1502 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1503 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1504 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1505 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1506 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1507 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1508 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1509 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1510 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1511 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1512 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1513 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1514 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1515 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1516 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1517 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1518 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1519 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1520 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1521 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1522 |
/********************************************************/ |
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 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1525 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1526 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1527 |
/********************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1528 |
|
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 |
start: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1531 |
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
|
1532 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1533 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1534 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1535 |
/**********************************************************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1536 |
/* 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
|
1537 |
/**********************************************************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1538 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1539 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1540 |
/* 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
|
1541 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1542 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1543 |
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
|
1544 |
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
|
1545 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1546 |
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
|
1547 |
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
|
1548 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1549 |
pragma: |
68 | 1550 |
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
|
1551 |
|
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1552 |
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
|
1553 |
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
|
1554 |
| 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
|
1555 |
| pragma |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1556 |
; |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
264
diff
changeset
|
1557 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1558 |
|
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
1559 |
/* EN/ENO */ |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1560 |
/* 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
|
1561 |
* similarly to these... |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1562 |
*/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1563 |
en_identifier: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1564 |
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
|
1565 |
; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1566 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1567 |
eno_identifier: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1568 |
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
|
1569 |
; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1570 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1571 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1572 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1573 |
/*************************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1574 |
/* Prelimenary helpful constructs... */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
1575 |
/*************************************/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1576 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1577 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1578 |
* 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
|
1579 |
* 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
|
1580 |
* 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
|
1581 |
* 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
|
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 |
* 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
|
1584 |
* 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
|
1585 |
* 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
|
1586 |
* 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
|
1587 |
* 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
|
1588 |
* 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
|
1589 |
* 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
|
1590 |
* 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
|
1591 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1592 |
* 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
|
1593 |
* 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
|
1594 |
* 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
|
1595 |
* 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
|
1596 |
* 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
|
1597 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1598 |
* 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
|
1599 |
* 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
|
1600 |
* 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
|
1601 |
* 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
|
1602 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1603 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1604 |
* 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
|
1605 |
* 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
|
1606 |
* 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
|
1607 |
* 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
|
1608 |
* 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
|
1609 |
* 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
|
1610 |
* 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
|
1611 |
* 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
|
1612 |
* 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
|
1613 |
* (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
|
1614 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1615 |
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
|
1616 |
identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1617 |
| 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
|
1618 |
| 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
|
1619 |
/**/ |
953
66697c05a147
Fix bug introduced when adding support for relaxed datatype model: change derived_datatype_identifier_c to identifier_c when used as an identifier
mjsousa
parents:
952
diff
changeset
|
1620 |
/* ref_type_name is defined in IEC 61131-3 v3 */ |
66697c05a147
Fix bug introduced when adding support for relaxed datatype model: change derived_datatype_identifier_c to identifier_c when used as an identifier
mjsousa
parents:
952
diff
changeset
|
1621 |
| prev_declared_ref_type_name {$$ = new identifier_c(((token_c *)$1)->value, locloc(@$));}; // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
66697c05a147
Fix bug introduced when adding support for relaxed datatype model: change derived_datatype_identifier_c to identifier_c when used as an identifier
mjsousa
parents:
952
diff
changeset
|
1622 |
| prev_declared_simple_type_name {$$ = new identifier_c(((token_c *)$1)->value, locloc(@$));}; // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
66697c05a147
Fix bug introduced when adding support for relaxed datatype model: change derived_datatype_identifier_c to identifier_c when used as an identifier
mjsousa
parents:
952
diff
changeset
|
1623 |
| prev_declared_subrange_type_name {$$ = new identifier_c(((token_c *)$1)->value, locloc(@$));}; // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
66697c05a147
Fix bug introduced when adding support for relaxed datatype model: change derived_datatype_identifier_c to identifier_c when used as an identifier
mjsousa
parents:
952
diff
changeset
|
1624 |
| prev_declared_enumerated_type_name {$$ = new identifier_c(((token_c *)$1)->value, locloc(@$));}; // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
66697c05a147
Fix bug introduced when adding support for relaxed datatype model: change derived_datatype_identifier_c to identifier_c when used as an identifier
mjsousa
parents:
952
diff
changeset
|
1625 |
| prev_declared_array_type_name {$$ = new identifier_c(((token_c *)$1)->value, locloc(@$));}; // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
66697c05a147
Fix bug introduced when adding support for relaxed datatype model: change derived_datatype_identifier_c to identifier_c when used as an identifier
mjsousa
parents:
952
diff
changeset
|
1626 |
| prev_declared_structure_type_name {$$ = new identifier_c(((token_c *)$1)->value, locloc(@$));}; // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
66697c05a147
Fix bug introduced when adding support for relaxed datatype model: change derived_datatype_identifier_c to identifier_c when used as an identifier
mjsousa
parents:
952
diff
changeset
|
1627 |
| prev_declared_string_type_name {$$ = new identifier_c(((token_c *)$1)->value, locloc(@$));}; // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1628 |
| prev_declared_derived_function_name {$$ = new identifier_c(((token_c *)$1)->value, locloc(@$));}; // change the poutype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1629 |
| prev_declared_derived_function_block_name {$$ = new identifier_c(((token_c *)$1)->value, locloc(@$));}; // change the poutype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1630 |
| prev_declared_program_type_name {$$ = new identifier_c(((token_c *)$1)->value, locloc(@$));}; // change the poutype_identifier_c into an identifier_c, as it will be taking the place of an 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
|
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 |
| 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
|
1633 |
| 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
|
1634 |
| 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
|
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 |
|
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1637 |
/* NOTE: Notice that the symbol classes: |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1638 |
* - derived_datatype_identifier_c |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1639 |
* - poutype_identifier_c |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1640 |
* are only inserted into the AST when referencing a derived dataype or a POU |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1641 |
* (e.g. when declaring a variable, making a function call, instantiating a program in a resource, |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1642 |
* or delaring a derived datatype that derives from another previously delcared datatype). |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1643 |
* |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1644 |
* In the declaration of the datatype or POU itself, the name of the datatype or POU will be stored |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1645 |
* inside an identifier_c instead!! |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1646 |
*/ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1647 |
prev_declared_variable_name: prev_declared_variable_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1648 |
prev_declared_fb_name: prev_declared_fb_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1649 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1650 |
prev_declared_simple_type_name: prev_declared_simple_type_name_token {$$ = new derived_datatype_identifier_c($1, locloc(@$));}; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1651 |
prev_declared_subrange_type_name: prev_declared_subrange_type_name_token {$$ = new derived_datatype_identifier_c($1, locloc(@$));}; |
945
477393b00f95
Add support for relaxed datatype model for array datatypes.
mjsousa
parents:
936
diff
changeset
|
1652 |
prev_declared_enumerated_type_name: prev_declared_enumerated_type_name_token {$$ = new derived_datatype_identifier_c($1, locloc(@$));}; |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1653 |
prev_declared_array_type_name: prev_declared_array_type_name_token {$$ = new derived_datatype_identifier_c($1, locloc(@$));}; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1654 |
prev_declared_structure_type_name: prev_declared_structure_type_name_token {$$ = new derived_datatype_identifier_c($1, locloc(@$));}; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1655 |
prev_declared_string_type_name: prev_declared_string_type_name_token {$$ = new derived_datatype_identifier_c($1, locloc(@$));}; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1656 |
prev_declared_ref_type_name: prev_declared_ref_type_name_token {$$ = new derived_datatype_identifier_c($1, locloc(@$));}; /* defined in IEC 61131-3 v3 */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
1657 |
|
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1658 |
prev_declared_derived_function_name: prev_declared_derived_function_name_token {$$ = new poutype_identifier_c($1, locloc(@$));}; |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1659 |
prev_declared_derived_function_block_name: prev_declared_derived_function_block_name_token {$$ = new poutype_identifier_c($1, locloc(@$));}; |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1660 |
prev_declared_program_type_name: prev_declared_program_type_name_token {$$ = new poutype_identifier_c($1, locloc(@$));}; |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1661 |
/* NOTE: The poutype_identifier_c was introduced to allow the implementation of remove_forward_dependencies_c */ |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
1662 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1663 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1664 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1665 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1666 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1667 |
/* 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
|
1668 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1669 |
library: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1670 |
/* empty */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1671 |
{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
|
1672 |
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
|
1673 |
$$ = (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
|
1674 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1675 |
| 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
|
1676 |
{$$ = $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
|
1677 |
| 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
|
1678 |
{$$ = $1; $$->add_element($2);} |
77 | 1679 |
/* ERROR_CHECK_BEGIN */ |
136 | 1680 |
| library error library_element_declaration |
1681 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unknown syntax error."); yyerrok;} |
|
73 | 1682 |
| library error END_OF_INPUT |
136 | 1683 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unknown syntax error."); yyerrok;} |
77 | 1684 |
/* 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
|
1685 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1686 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1687 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1688 |
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
|
1689 |
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
|
1690 |
| 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
|
1691 |
| 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
|
1692 |
| 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
|
1693 |
| 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1696 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1697 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1698 |
/*******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1699 |
/* 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
|
1700 |
/*******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1701 |
/* 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
|
1702 |
* 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
|
1703 |
* 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
|
1704 |
* or '_'. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1705 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1706 |
* 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
|
1707 |
* "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
|
1708 |
* 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
|
1709 |
* (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
|
1710 |
* 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
|
1711 |
* 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
|
1712 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1713 |
* 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
|
1714 |
* 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
|
1715 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1716 |
* 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
|
1717 |
* - 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
|
1718 |
* - 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
|
1719 |
* - 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
|
1720 |
* 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
|
1721 |
* 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
|
1722 |
* 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
|
1723 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1724 |
* 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
|
1725 |
* 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
|
1726 |
* (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
|
1727 |
* 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
|
1728 |
* 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
|
1729 |
* (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
|
1730 |
* 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
|
1731 |
* 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
|
1732 |
* 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
|
1733 |
* 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
|
1734 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1735 |
* 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
|
1736 |
* 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
|
1737 |
* 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
|
1738 |
* 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
|
1739 |
* identifiers as keywords / tokens if we are currently parsing IL code. |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1740 |
* 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
|
1741 |
* 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
|
1742 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1743 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1744 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1745 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1746 |
* 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
|
1747 |
* 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
|
1748 |
* 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
|
1749 |
* 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
|
1750 |
* 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
|
1751 |
* 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
|
1752 |
* 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
|
1753 |
* 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
|
1754 |
* 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
|
1755 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1756 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1757 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1758 |
* 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
|
1759 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1760 |
* - 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
|
1761 |
* - 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
|
1762 |
* - 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
|
1763 |
* - 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
|
1764 |
* - 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
|
1765 |
* - AT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1766 |
* - 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
|
1767 |
* - 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
|
1768 |
* - CONSTANT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1769 |
* - 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
|
1770 |
* - EXIT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1771 |
* - FALSE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1772 |
* - 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
|
1773 |
* - 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
|
1774 |
* - 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
|
1775 |
* - 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
|
1776 |
* - 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
|
1777 |
* - 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
|
1778 |
* - 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
|
1779 |
* - 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
|
1780 |
* - 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
|
1781 |
* - 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
|
1782 |
* - 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
|
1783 |
* - 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
|
1784 |
* - 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
|
1785 |
* - 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
|
1786 |
* - RETURN |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1787 |
* - 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
|
1788 |
* - 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
|
1789 |
* - TASK |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1790 |
* - 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
|
1791 |
* - TRUE |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1792 |
* - 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
|
1793 |
* - 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
|
1794 |
* - 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
|
1795 |
* - 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
|
1796 |
* - 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
|
1797 |
* - 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
|
1798 |
* - 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
|
1799 |
* - 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
|
1800 |
* - 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
|
1801 |
* - 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
|
1802 |
* - 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
|
1803 |
* - WITH |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1804 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1805 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1806 |
identifier: |
68 | 1807 |
identifier_token {$$ = new identifier_c($1, locloc(@$));} |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1808 |
; |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1809 |
|
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
1810 |
|
0
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 - Constants */ |
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 |
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
|
1816 |
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
|
1817 |
| 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
|
1818 |
| 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
|
1819 |
| 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
|
1820 |
| 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
|
1821 |
/* 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
|
1822 |
* 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
|
1823 |
* 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
|
1824 |
*/ |
0
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: in order to remove reduce/reduce conflicts, |
257 | 1826 |
* [between -9.5 being parsed as |
1827 |
* (i) a signed real, |
|
1828 |
* (ii) or as a real preceded by the '-' operator |
|
1829 |
* ] |
|
1830 |
* 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
|
1831 |
* 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
|
1832 |
* 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
|
1833 |
* (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
|
1834 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1835 |
* 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
|
1836 |
* 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
|
1837 |
* 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
|
1838 |
*/ |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1839 |
| 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
|
1840 |
| 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
|
1841 |
/* 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
|
1842 |
* 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
|
1843 |
* 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
|
1844 |
*/ |
919
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1845 |
| ref_value_null_literal /* defined in IEC 61131-3 v3. Basically the 'NULL' keyword! */ |
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
|
1846 |
; |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1847 |
|
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1848 |
|
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1849 |
|
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1850 |
|
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1851 |
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
|
1852 |
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
|
1853 |
| 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
|
1854 |
| 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
|
1855 |
| 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
|
1856 |
| 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
|
1857 |
/* 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
|
1858 |
* 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
|
1859 |
* (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
|
1860 |
* 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
|
1861 |
*/ |
257 | 1862 |
/* NOTE: in order to remove reduce/reduce conflicts, |
1863 |
* [between -9.5 being parsed as |
|
1864 |
* (i) a signed real, |
|
1865 |
* (ii) or as a real preceded by the '-' operator |
|
1866 |
* ] |
|
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
|
1867 |
* [and a similar situation for integers!] |
257 | 1868 |
* 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
|
1869 |
* 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
|
1870 |
* 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
|
1871 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
1872 |
* 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
|
1873 |
* 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
|
1874 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1875 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1876 |
|
919
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1877 |
/*********************************/ |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1878 |
/* B 1.2.XX - Reference Literals */ |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1879 |
/*********************************/ |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1880 |
/* NOTE: The following syntax was added by MJS in order to add support for the NULL keyword, defined in IEC 61131-3 v3 |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1881 |
* Please read the comment where the 'ref_value_null_literal' is declared as a <leaf> |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1882 |
*/ |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1883 |
/* defined in IEC 61131-3 v3 - Basically the 'NULL' keyword! */ |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1884 |
ref_value_null_literal: |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1885 |
NULL_token {$$ = new ref_value_null_literal_c(locloc(@$));} |
8da635655f37
Add support for the 'NULL' keyword, defined in version 3 of IEC 61131-3.
mjsousa
parents:
909
diff
changeset
|
1886 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1887 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1888 |
/******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1889 |
/* 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
|
1890 |
/******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1891 |
/* NOTES: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1892 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1893 |
* - 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
|
1894 |
* 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
|
1895 |
* 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
|
1896 |
* 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
|
1897 |
* 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
|
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 |
* - 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
|
1900 |
* 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
|
1901 |
* 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
|
1902 |
* 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
|
1903 |
* 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
|
1904 |
* 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
|
1905 |
* 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
|
1906 |
* 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
|
1907 |
* 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
|
1908 |
* 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
|
1909 |
* 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
|
1910 |
* 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
|
1911 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1912 |
* 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
|
1913 |
* 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
|
1914 |
* 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
|
1915 |
* 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
|
1916 |
* 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
|
1917 |
* 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
|
1918 |
* |
257 | 1919 |
* - 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
|
1920 |
* 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
|
1921 |
* 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
|
1922 |
* 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
|
1923 |
* 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
|
1924 |
* 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
|
1925 |
* 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
|
1926 |
* 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
|
1927 |
* 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
|
1928 |
* 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
|
1929 |
* 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
|
1930 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1931 |
* - 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
|
1932 |
* 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
|
1933 |
* 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
|
1934 |
* 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
|
1935 |
* 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
|
1936 |
* 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
|
1937 |
* 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
|
1938 |
* 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
|
1939 |
* 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
|
1940 |
* 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
|
1941 |
* 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
|
1942 |
* 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
|
1943 |
* 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
|
1944 |
* 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
|
1945 |
* 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
|
1946 |
* 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
|
1947 |
* 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
|
1948 |
* (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
|
1949 |
* 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
|
1950 |
* 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
|
1951 |
* 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
|
1952 |
* 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
|
1953 |
* 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
|
1954 |
* 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
|
1955 |
* 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
|
1956 |
* 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
|
1957 |
* 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
|
1958 |
* 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
|
1959 |
* 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
|
1960 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1961 |
real: |
68 | 1962 |
real_token {$$ = new real_c($1, locloc(@$));} |
1963 |
| fixed_point_token {$$ = new real_c($1, locloc(@$));} |
|
1964 |
; |
|
1965 |
||
1966 |
integer: integer_token {$$ = new integer_c($1, locloc(@$));}; |
|
1967 |
binary_integer: binary_integer_token {$$ = new binary_integer_c($1, locloc(@$));}; |
|
1968 |
octal_integer: octal_integer_token {$$ = new octal_integer_c($1, locloc(@$));}; |
|
1969 |
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
|
1970 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1971 |
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
|
1972 |
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
|
1973 |
| 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
|
1974 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1975 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1976 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1977 |
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
|
1978 |
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
|
1979 |
{$$ = 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
|
1980 |
| 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
|
1981 |
{$$ = 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
|
1982 |
| 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
|
1983 |
{$$ = 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
|
1984 |
| 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
|
1985 |
{$$ = 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
|
1986 |
| 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
|
1987 |
| 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
|
1988 |
| 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
|
1989 |
//|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
|
1990 |
//| 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
|
1991 |
| '+' 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
|
1992 |
| '-' integer {$$ = new neg_integer_c($2, locloc(@$));} |
131 | 1993 |
/* ERROR_CHECK_BEGIN */ |
1994 |
| integer_type_name signed_integer |
|
136 | 1995 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;} |
131 | 1996 |
| integer_type_name binary_integer |
136 | 1997 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;} |
131 | 1998 |
| integer_type_name octal_integer |
136 | 1999 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;} |
131 | 2000 |
| integer_type_name hex_integer |
136 | 2001 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;} |
131 | 2002 |
| integer_type_name '#' error |
136 | 2003 |
{$$ = NULL; |
2004 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for integer literal.");} |
|
2005 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for integer literal."); yyclearin;} |
|
131 | 2006 |
yyerrok; |
2007 |
} |
|
2008 |
/* 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
|
2009 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2010 |
|
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
|
2011 |
/* 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
|
2012 |
* 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
|
2013 |
* 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
|
2014 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
2015 |
* 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
|
2016 |
* 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
|
2017 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2018 |
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
|
2019 |
integer |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2020 |
| '+' integer {$$ = $2;} |
257 | 2021 |
| '-' 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
|
2022 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2023 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2024 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2025 |
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
|
2026 |
// 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
|
2027 |
// 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
|
2028 |
'+' 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
|
2029 |
| '-' 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
|
2030 |
| 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
|
2031 |
{$$ = new real_literal_c($1, $3, locloc(@$));} |
131 | 2032 |
/* ERROR_CHECK_BEGIN */ |
2033 |
| real_type_name signed_real |
|
136 | 2034 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between real type name and value in real literal."); yynerrs++;} |
131 | 2035 |
| real_type_name '#' error |
136 | 2036 |
{$$ = NULL; |
2037 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for real literal.");} |
|
2038 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for real literal."); yyclearin;} |
|
131 | 2039 |
yyerrok; |
2040 |
} |
|
2041 |
/* 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
|
2042 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2043 |
|
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
|
2044 |
/* 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
|
2045 |
* 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
|
2046 |
* 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
|
2047 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
2048 |
* 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
|
2049 |
* 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
|
2050 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2051 |
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
|
2052 |
real |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2053 |
| '+' real {$$ = $2;} |
257 | 2054 |
| '-' real {$$ = new neg_real_c($2, locloc(@2));} |
2055 |
; |
|
2056 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2057 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2058 |
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
|
2059 |
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
|
2060 |
{$$ = 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
|
2061 |
| 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
|
2062 |
{$$ = 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
|
2063 |
| 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
|
2064 |
{$$ = 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
|
2065 |
| 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
|
2066 |
{$$ = 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
|
2067 |
/* 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
|
2068 |
* 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
|
2069 |
* 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
|
2070 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2071 |
/* 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
|
2072 |
* 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
|
2073 |
* 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
|
2074 |
* 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
|
2075 |
*/ |
131 | 2076 |
/* ERROR_CHECK_BEGIN */ |
2077 |
| bit_string_type_name integer |
|
136 | 2078 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;} |
131 | 2079 |
| bit_string_type_name binary_integer |
136 | 2080 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;} |
131 | 2081 |
| bit_string_type_name octal_integer |
136 | 2082 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;} |
131 | 2083 |
| bit_string_type_name hex_integer |
136 | 2084 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;} |
131 | 2085 |
| bit_string_type_name '#' error |
257 | 2086 |
{$$ = NULL; |
136 | 2087 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for bit string literal.");} |
2088 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for bit string literal."); yyclearin;} |
|
131 | 2089 |
yyerrok; |
2090 |
} |
|
2091 |
/* 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
|
2092 |
; |
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 |
boolean_literal: |
257 | 2096 |
boolean_true_literal_token |
2097 |
{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)), |
|
2098 |
new boolean_true_c(locloc(@$)), |
|
2099 |
locloc(@$)); |
|
2100 |
} |
|
2101 |
| boolean_false_literal_token |
|
2102 |
{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)), |
|
68 | 2103 |
new boolean_false_c(locloc(@$)), |
257 | 2104 |
locloc(@$)); |
2105 |
} |
|
2106 |
| safeboolean_true_literal_token |
|
2107 |
{$$ = new boolean_literal_c(new safebool_type_name_c(locloc(@$)), |
|
2108 |
new boolean_true_c(locloc(@$)), |
|
2109 |
locloc(@$)); |
|
2110 |
} |
|
2111 |
| safeboolean_false_literal_token |
|
2112 |
{$$ = new boolean_literal_c(new safebool_type_name_c(locloc(@$)), |
|
2113 |
new boolean_false_c(locloc(@$)), |
|
2114 |
locloc(@$)); |
|
2115 |
} |
|
2116 |
| FALSE |
|
2117 |
{$$ = new boolean_literal_c(NULL, |
|
2118 |
new boolean_false_c(locloc(@$)), |
|
2119 |
locloc(@$)); |
|
2120 |
} |
|
2121 |
| TRUE |
|
2122 |
{$$ = new boolean_literal_c(NULL, |
|
2123 |
new boolean_true_c(locloc(@$)), |
|
2124 |
locloc(@$)); |
|
2125 |
} |
|
0
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 |
| 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
|
2128 |
| 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
|
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 |
/* 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
|
2131 |
* 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
|
2132 |
* and |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2133 |
* 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
|
2134 |
* 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
|
2135 |
* 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
|
2136 |
* 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
|
2137 |
* 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
|
2138 |
* 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
|
2139 |
* 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
|
2140 |
* 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
|
2141 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2142 |
* 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
|
2143 |
* 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
|
2144 |
* 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
|
2145 |
* 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
|
2146 |
* 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
|
2147 |
* 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
|
2148 |
* 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
|
2149 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2150 |
* 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
|
2151 |
* 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
|
2152 |
* 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
|
2153 |
* 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
|
2154 |
* 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
|
2155 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2156 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2157 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2158 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2159 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2160 |
/*******************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2161 |
/* 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
|
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 |
/* 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
|
2164 |
single_byte_character_string: single_byte_character_string_token |
68 | 2165 |
{$$ = 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
|
2166 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2167 |
double_byte_character_string: double_byte_character_string_token |
68 | 2168 |
{$$ = 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
|
2169 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2170 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2171 |
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
|
2172 |
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
|
2173 |
| 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
|
2174 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2175 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2176 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2177 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2178 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2179 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2180 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2181 |
/* 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
|
2182 |
/***************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2183 |
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
|
2184 |
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
|
2185 |
| date |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2186 |
| 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
|
2187 |
| duration |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2188 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2189 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2190 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2191 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2192 |
/* 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
|
2193 |
/************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2194 |
duration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2195 |
/* (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
|
2196 |
/* 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
|
2197 |
* 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
|
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 |
* 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
|
2200 |
* 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
|
2201 |
* 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
|
2202 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2203 |
* 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
|
2204 |
* 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
|
2205 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2206 |
TIME '#' interval |
257 | 2207 |
{$$ = 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
|
2208 |
| TIME '#' '-' interval |
257 | 2209 |
{$$ = 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
|
2210 |
| T_SHARP interval |
257 | 2211 |
{$$ = 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
|
2212 |
| T_SHARP '-' interval |
257 | 2213 |
{$$ = new duration_c(new time_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $3, locloc(@$));} |
2214 |
| SAFETIME '#' interval |
|
2215 |
{$$ = new duration_c(new safetime_type_name_c(locloc(@1)), NULL, $3, locloc(@$));} |
|
2216 |
| SAFETIME '#' '-' interval |
|
2217 |
{$$ = new duration_c(new safetime_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $4, locloc(@$));} |
|
131 | 2218 |
/* ERROR_CHECK_BEGIN */ |
2219 |
| TIME interval |
|
136 | 2220 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME' and interval in duration."); yynerrs++;} |
131 | 2221 |
| TIME '-' interval |
136 | 2222 |
{$$ = 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
|
2223 |
| TIME '#' erroneous_interval_token |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2224 |
{$$ = 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
|
2225 |
| 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
|
2226 |
{$$ = 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
|
2227 |
| TIME '#' '-' erroneous_interval_token |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2228 |
{$$ = 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
|
2229 |
| 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
|
2230 |
{$$ = 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
|
2231 |
/* ERROR_CHECK_END */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2232 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2233 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2234 |
fixed_point: |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2235 |
integer |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2236 |
| 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
|
2237 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2238 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2239 |
interval: |
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2240 |
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
|
2241 |
{$$ = 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
|
2242 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2243 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2244 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2245 |
days: /* fixed_point ('d') */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2246 |
/* empty */ {$$ = NULL;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2247 |
| 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
|
2248 |
| 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
|
2249 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2250 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2251 |
hours: /* fixed_point ('h') */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2252 |
/* empty */ {$$ = NULL;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2253 |
| 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
|
2254 |
| 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
|
2255 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2256 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2257 |
minutes: /* fixed_point ('m') */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2258 |
/* empty */ {$$ = NULL;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2259 |
| 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
|
2260 |
| 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
|
2261 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2262 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2263 |
seconds: /* fixed_point ('s') */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2264 |
/* empty */ {$$ = NULL;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2265 |
| 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
|
2266 |
| 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
|
2267 |
; |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2268 |
|
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2269 |
milliseconds: /* fixed_point ('ms') */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2270 |
/* empty */ {$$ = NULL;} |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
2271 |
| 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
|
2272 |
| 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
|
2273 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2274 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2275 |
|
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 |
/* 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
|
2279 |
/************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2280 |
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
|
2281 |
TIME_OF_DAY '#' daytime |
257 | 2282 |
{$$ = new time_of_day_c(new tod_type_name_c(locloc(@1)), $3, locloc(@$));} |
2283 |
| SAFETIME_OF_DAY '#' daytime |
|
2284 |
{$$ = new time_of_day_c(new safetod_type_name_c(locloc(@1)), $3, locloc(@$));} |
|
131 | 2285 |
/* ERROR_CHECK_BEGIN */ |
2286 |
| TIME_OF_DAY daytime |
|
136 | 2287 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME_OF_DAY' and daytime in time of day."); yynerrs++;} |
131 | 2288 |
| TIME_OF_DAY '#' error |
2289 |
{$$ = NULL; |
|
136 | 2290 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for time of day.");} |
2291 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for time of day."); yyclearin;} |
|
131 | 2292 |
yyerrok; |
2293 |
} |
|
2294 |
/* 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
|
2295 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2296 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2297 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2298 |
daytime: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2299 |
day_hour ':' day_minute ':' day_second |
68 | 2300 |
{$$ = new daytime_c($1, $3, $5, locloc(@$));} |
131 | 2301 |
/* ERROR_CHECK_BEGIN */ |
136 | 2302 |
| ':' day_minute ':' day_second |
2303 |
{$$ = NULL; print_err_msg(locf(@1), locl(@4), "no value defined for hours in daytime."); yynerrs++;} |
|
2304 |
| error ':' day_minute ':' day_second |
|
2305 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid value defined for hours in daytime."); yyerrok;} |
|
131 | 2306 |
| day_hour day_minute ':' day_second |
136 | 2307 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between hours and minutes in daytime."); yynerrs++;} |
131 | 2308 |
| day_hour ':' ':' day_second |
136 | 2309 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for minutes in daytime."); yynerrs++;} |
131 | 2310 |
| day_hour ':' error ':' day_second |
136 | 2311 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value defined for minutes in daytime."); yyerrok;} |
131 | 2312 |
| day_hour ':' day_minute day_second |
136 | 2313 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "':' missing between minutes and seconds in daytime."); yynerrs++;} |
131 | 2314 |
| day_hour ':' day_minute ':' error |
2315 |
{$$ = NULL; |
|
136 | 2316 |
if (is_current_syntax_token()) {print_err_msg(locl(@4), locf(@5), "no value defined for seconds in daytime.");} |
2317 |
else {print_err_msg(locf(@5), locl(@5), "invalid value for seconds in daytime."); yyclearin;} |
|
131 | 2318 |
yyerrok; |
2319 |
} |
|
2320 |
/* 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
|
2321 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2322 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2323 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2324 |
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
|
2325 |
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
|
2326 |
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
|
2327 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2328 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2329 |
date: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2330 |
DATE '#' date_literal |
257 | 2331 |
{$$ = 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
|
2332 |
| D_SHARP date_literal |
257 | 2333 |
{$$ = new date_c(new date_type_name_c(locloc(@1)), $2, locloc(@$));} |
2334 |
| SAFEDATE '#' date_literal |
|
2335 |
{$$ = new date_c(new safedate_type_name_c(locloc(@1)), $3, locloc(@$));} |
|
131 | 2336 |
/* ERROR_CHECK_BEGIN */ |
2337 |
| DATE date_literal |
|
136 | 2338 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE' and date literal in date."); yynerrs++;} |
131 | 2339 |
| DATE '#' error |
2340 |
{$$ = NULL; |
|
136 | 2341 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for date.");} |
2342 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for date."); yyclearin;} |
|
131 | 2343 |
yyerrok; |
2344 |
} |
|
2345 |
| D_SHARP error |
|
136 | 2346 |
{$$ = NULL; |
2347 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no value defined for date.");} |
|
2348 |
else {print_err_msg(locf(@2), locl(@2), "invalid value for date."); yyclearin;} |
|
131 | 2349 |
yyerrok; |
2350 |
} |
|
2351 |
/* 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
|
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 |
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
|
2356 |
year '-' month '-' day |
68 | 2357 |
{$$ = new date_literal_c($1, $3, $5, locloc(@$));} |
131 | 2358 |
/* ERROR_CHECK_BEGIN */ |
136 | 2359 |
| '-' month '-' day |
2360 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no value defined for year in date literal."); yynerrs++;} |
|
131 | 2361 |
| year month '-' day |
136 | 2362 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'-' missing between year and month in date literal."); yynerrs++;} |
2363 |
| year '-' '-' day |
|
2364 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for month in date literal."); yynerrs++;} |
|
2365 |
| year '-' error '-' day |
|
2366 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value defined for month in date literal."); yyerrok;} |
|
2367 |
| year '-' month day |
|
2368 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "'-' missing between month and day in date literal."); yynerrs++;} |
|
2369 |
| year '-' month '-' error |
|
131 | 2370 |
{$$ = NULL; |
136 | 2371 |
if (is_current_syntax_token()) {print_err_msg(locl(@4), locf(@5), "no value defined for day in date literal.");} |
2372 |
else {print_err_msg(locf(@5), locl(@5), "invalid value for day in date literal."); yyclearin;} |
|
131 | 2373 |
yyerrok; |
2374 |
} |
|
2375 |
/* 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
|
2376 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2377 |
|
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 |
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
|
2380 |
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
|
2381 |
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
|
2382 |
|
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 |
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
|
2385 |
DATE_AND_TIME '#' date_literal '-' daytime |
257 | 2386 |
{$$ = new date_and_time_c(new dt_type_name_c(locloc(@1)), $3, $5, locloc(@$));} |
2387 |
| SAFEDATE_AND_TIME '#' date_literal '-' daytime |
|
2388 |
{$$ = new date_and_time_c(new safedt_type_name_c(locloc(@1)), $3, $5, locloc(@$));} |
|
131 | 2389 |
/* ERROR_CHECK_BEGIN */ |
2390 |
| DATE_AND_TIME date_literal '-' daytime |
|
136 | 2391 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE_AND_TIME' and date literal in date and time."); yynerrs++;} |
131 | 2392 |
| DATE_AND_TIME '#' '-' daytime |
136 | 2393 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for date literal in date and time."); yynerrs++;} |
131 | 2394 |
| DATE_AND_TIME '#' error '-' daytime |
136 | 2395 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value for date literal in date and time."); yyerrok;} |
131 | 2396 |
| DATE_AND_TIME '#' date_literal daytime |
136 | 2397 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "'-' missing between date literal and daytime in date and time."); yynerrs++;} |
131 | 2398 |
| DATE_AND_TIME '#' date_literal '-' error |
2399 |
{$$ = NULL; |
|
136 | 2400 |
if (is_current_syntax_token()) {print_err_msg(locl(@4), locf(@5), "no value defined for daytime in date and time.");} |
2401 |
else {print_err_msg(locf(@5), locl(@5), "invalid value for daytime in date and time."); yyclearin;} |
|
131 | 2402 |
yyerrok; |
2403 |
} |
|
2404 |
/* 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
|
2405 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2406 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2407 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2408 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2409 |
|
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 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2413 |
/* 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
|
2414 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2415 |
/* 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
|
2416 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2417 |
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
|
2418 |
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
|
2419 |
| 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
|
2420 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2421 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2422 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2423 |
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
|
2424 |
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
|
2425 |
| 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
|
2426 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2427 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2428 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2429 |
|
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 |
/* 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
|
2432 |
/***********************************/ |
257 | 2433 |
/******************************************************/ |
2434 |
/* SAFExxxx Symbols defined in */ |
|
2435 |
/* "Safety Software Technical Specification, */ |
|
2436 |
/* Part 1: Concepts and Function Blocks, */ |
|
2437 |
/* Version 1.0 – Official Release" */ |
|
2438 |
/* by PLCopen - Technical Committee 5 - 2006-01-31 */ |
|
2439 |
/******************************************************/ |
|
2440 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2441 |
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
|
2442 |
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
|
2443 |
| 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
|
2444 |
| 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
|
2445 |
| elementary_string_type_name |
68 | 2446 |
| TIME {$$ = new time_type_name_c(locloc(@$));} |
2447 |
| 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
|
2448 |
/* 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
|
2449 |
* 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
|
2450 |
* 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
|
2451 |
*/ |
257 | 2452 |
| SAFETIME {$$ = new safetime_type_name_c(locloc(@$));} |
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
2453 |
| 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
|
2454 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2455 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2456 |
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
|
2457 |
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
|
2458 |
| 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
|
2459 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2460 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2461 |
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
|
2462 |
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
|
2463 |
| 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
|
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 |
signed_integer_type_name: |
257 | 2467 |
SINT {$$ = new sint_type_name_c(locloc(@$));} |
2468 |
| INT {$$ = new int_type_name_c(locloc(@$));} |
|
2469 |
| DINT {$$ = new dint_type_name_c(locloc(@$));} |
|
2470 |
| LINT {$$ = new lint_type_name_c(locloc(@$));} |
|
2471 |
| SAFESINT {$$ = new safesint_type_name_c(locloc(@$));} |
|
2472 |
| SAFEINT {$$ = new safeint_type_name_c(locloc(@$));} |
|
2473 |
| SAFEDINT {$$ = new safedint_type_name_c(locloc(@$));} |
|
2474 |
| 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
|
2475 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2476 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2477 |
unsigned_integer_type_name: |
257 | 2478 |
USINT {$$ = new usint_type_name_c(locloc(@$));} |
2479 |
| UINT {$$ = new uint_type_name_c(locloc(@$));} |
|
2480 |
| UDINT {$$ = new udint_type_name_c(locloc(@$));} |
|
2481 |
| ULINT {$$ = new ulint_type_name_c(locloc(@$));} |
|
2482 |
| SAFEUSINT {$$ = new safeusint_type_name_c(locloc(@$));} |
|
2483 |
| SAFEUINT {$$ = new safeuint_type_name_c(locloc(@$));} |
|
2484 |
| SAFEUDINT {$$ = new safeudint_type_name_c(locloc(@$));} |
|
2485 |
| 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2488 |
real_type_name: |
257 | 2489 |
REAL {$$ = new real_type_name_c(locloc(@$));} |
2490 |
| LREAL {$$ = new lreal_type_name_c(locloc(@$));} |
|
2491 |
| SAFEREAL {$$ = new safereal_type_name_c(locloc(@$));} |
|
2492 |
| 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
|
2493 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2494 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2495 |
date_type_name: |
257 | 2496 |
DATE {$$ = new date_type_name_c(locloc(@$));} |
2497 |
| TIME_OF_DAY {$$ = new tod_type_name_c(locloc(@$));} |
|
2498 |
| TOD {$$ = new tod_type_name_c(locloc(@$));} |
|
2499 |
| DATE_AND_TIME {$$ = new dt_type_name_c(locloc(@$));} |
|
2500 |
| DT {$$ = new dt_type_name_c(locloc(@$));} |
|
2501 |
| SAFEDATE {$$ = new safedate_type_name_c(locloc(@$));} |
|
2502 |
| SAFETIME_OF_DAY {$$ = new safetod_type_name_c(locloc(@$));} |
|
2503 |
| SAFETOD {$$ = new safetod_type_name_c(locloc(@$));} |
|
2504 |
| SAFEDATE_AND_TIME {$$ = new safedt_type_name_c(locloc(@$));} |
|
2505 |
| 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
|
2506 |
; |
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 |
bit_string_type_name: |
257 | 2510 |
BYTE {$$ = new byte_type_name_c(locloc(@$));} |
2511 |
| WORD {$$ = new word_type_name_c(locloc(@$));} |
|
2512 |
| DWORD {$$ = new dword_type_name_c(locloc(@$));} |
|
2513 |
| LWORD {$$ = new lword_type_name_c(locloc(@$));} |
|
2514 |
| SAFEBYTE {$$ = new safebyte_type_name_c(locloc(@$));} |
|
2515 |
| SAFEWORD {$$ = new safeword_type_name_c(locloc(@$));} |
|
2516 |
| SAFEDWORD {$$ = new safedword_type_name_c(locloc(@$));} |
|
2517 |
| 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
|
2518 |
/* 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
|
2519 |
* 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
|
2520 |
* 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
|
2521 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2522 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2523 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2524 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2525 |
/* 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
|
2526 |
* 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
|
2527 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2528 |
* 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
|
2529 |
* 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
|
2530 |
* 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
|
2531 |
* 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
|
2532 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2533 |
elementary_string_type_name: |
68 | 2534 |
STRING {$$ = new string_type_name_c(locloc(@$));} |
2535 |
| WSTRING {$$ = new wstring_type_name_c(locloc(@$));} |
|
257 | 2536 |
| SAFESTRING {$$ = new safestring_type_name_c(locloc(@$));} |
2537 |
| 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
|
2538 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2539 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2540 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2541 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2542 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2543 |
/* 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
|
2544 |
/********************************/ |
68 | 2545 |
/* 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
|
2546 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2547 |
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
|
2548 |
ANY |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2549 |
| 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
|
2550 |
| 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
|
2551 |
| 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
|
2552 |
| 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
|
2553 |
| 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
|
2554 |
| 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
|
2555 |
| 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
|
2556 |
| 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
|
2557 |
| 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
|
2558 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2559 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2560 |
|
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 |
/* 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
|
2564 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2565 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2566 |
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
|
2567 |
single_element_type_name |
68 | 2568 |
| prev_declared_array_type_name |
2569 |
| prev_declared_structure_type_name |
|
2570 |
| 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
|
2571 |
| 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
|
2572 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2573 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2574 |
single_element_type_name: |
68 | 2575 |
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
|
2576 |
/* 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
|
2577 |
* 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
|
2578 |
* 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
|
2579 |
*/ |
68 | 2580 |
//| prev_declared_derived_function_block_name |
2581 |
| prev_declared_subrange_type_name |
|
2582 |
| 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
|
2583 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2584 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2585 |
/* 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
|
2586 |
* 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
|
2587 |
* 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
|
2588 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2589 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2590 |
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
|
2591 |
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
|
2592 |
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
|
2593 |
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
|
2594 |
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
|
2595 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2596 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2597 |
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
|
2598 |
TYPE type_declaration_list END_TYPE |
1012
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
2599 |
{$$ = new data_type_declaration_c($2, locloc(@$)); if (runtime_options.conversion_functions) include_string((create_enumtype_conversion_functions_c::get_declaration($$)).c_str());} |
131 | 2600 |
/* ERROR_CHECK_BEGIN */ |
2601 |
| TYPE END_TYPE |
|
136 | 2602 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no data type declared in data type(s) declaration."); yynerrs++;} |
131 | 2603 |
| TYPE error type_declaration_list END_TYPE |
136 | 2604 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'TYPE' in data type(s) declaration."); yyerrok;} |
2605 |
| TYPE type_declaration_list error END_OF_INPUT |
|
2606 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed data type(s) declaration."); yyerrok;} |
|
131 | 2607 |
| TYPE error END_TYPE |
136 | 2608 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in data type(s) declaration."); yyerrok;} |
131 | 2609 |
/* 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
|
2610 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2611 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2612 |
/* 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
|
2613 |
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
|
2614 |
type_declaration ';' |
68 | 2615 |
{$$ = 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
|
2616 |
| 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
|
2617 |
{$$ = $1; $$->add_element($2);} |
131 | 2618 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
2619 |
| error ';' |
136 | 2620 |
{$$ = new type_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid data type declaration."); yyerrok;} |
131 | 2621 |
| type_declaration error |
136 | 2622 |
{$$ = new type_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of data type declaration."); yyerrok;} |
131 | 2623 |
| type_declaration_list type_declaration error |
136 | 2624 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of data type declaration."); yyerrok;} |
133 | 2625 |
| type_declaration_list error ';' |
136 | 2626 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid data type declaration."); yyerrok;} |
131 | 2627 |
| type_declaration_list ';' |
136 | 2628 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after data type declaration."); yynerrs++;} |
131 | 2629 |
/* 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
|
2630 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2631 |
|
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_declaration: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2633 |
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
|
2634 |
| 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
|
2635 |
| 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
|
2636 |
| 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
|
2637 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2638 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2639 |
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
|
2640 |
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
|
2641 |
| 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
|
2642 |
| 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
|
2643 |
| 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
|
2644 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2645 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2646 |
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
|
2647 |
/* 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
|
2648 |
/* 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'. */ |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2649 |
/* PRE_PARSING or SINGLE_PHASE_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2650 |
/* The following rules will be run either by: |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2651 |
* - the pre_parsing phase of two phase parsing (when preparsing command line option is chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2652 |
* - the standard single phase parser (when preparsing command line option is not chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2653 |
*/ |
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
|
2654 |
identifier ':' simple_specification {library_element_symtable.insert($1, prev_declared_simple_type_name_token);} |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2655 |
{if (!get_preparse_state()) $$ = new simple_type_declaration_c($1, $3, locloc(@$));} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2656 |
| identifier ':' elementary_type_name {library_element_symtable.insert($1, prev_declared_simple_type_name_token);} ASSIGN constant |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2657 |
{if (!get_preparse_state()) $$ = new simple_type_declaration_c($1, new simple_spec_init_c($3, $6, locf(@3), locl(@5)), locloc(@$));} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2658 |
| identifier ':' prev_declared_simple_type_name {library_element_symtable.insert($1, prev_declared_simple_type_name_token);} ASSIGN constant |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2659 |
{if (!get_preparse_state()) $$ = new simple_type_declaration_c($1, new simple_spec_init_c($3, $6, locf(@3), locl(@5)), locloc(@$));} |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2660 |
/* POST_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2661 |
/* These rules will be run after the preparser phase of two phase parsing has finished (only gets to execute if preparsing command line option is chosen). */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2662 |
| prev_declared_simple_type_name ':' simple_spec_init |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2663 |
{$$ = new simple_type_declaration_c(new identifier_c(((token_c *)$1)->value, locloc(@1)), $3, locloc(@$));} // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2664 |
/* These three rules can now be safely replaced by the original rule abvoe!! */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2665 |
/* |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2666 |
| prev_declared_simple_type_name ':' simple_specification |
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
|
2667 |
{$$ = new simple_type_declaration_c($1, $3, locloc(@$));} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2668 |
| prev_declared_simple_type_name ':' elementary_type_name ASSIGN constant |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2669 |
{$$ = new simple_type_declaration_c($1, new simple_spec_init_c($3, $5, locf(@3), locl(@5)), locloc(@$));} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2670 |
| prev_declared_simple_type_name ':' prev_declared_simple_type_name ASSIGN constant |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2671 |
{$$ = new simple_type_declaration_c($1, new simple_spec_init_c($3, $5, locf(@3), locl(@5)), locloc(@$));} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2672 |
*/ |
131 | 2673 |
/* ERROR_CHECK_BEGIN */ |
136 | 2674 |
| error ':' simple_spec_init |
2675 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid name defined for data type declaration.");yyerrok;} |
|
131 | 2676 |
| identifier simple_spec_init |
136 | 2677 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in simple type declaration."); yynerrs++;} |
131 | 2678 |
| identifier ':' error |
2679 |
{$$ = NULL; |
|
136 | 2680 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in data type declaration.");} |
2681 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in data type declaration."); yyclearin;} |
|
131 | 2682 |
yyerrok; |
2683 |
} |
|
2684 |
/* 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
|
2685 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2686 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2687 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2688 |
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
|
2689 |
simple_specification |
68 | 2690 |
/* The following commented line was changed to the |
2691 |
* 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
|
2692 |
* 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
|
2693 |
* 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
|
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 |
| 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
|
2697 |
{$$ = 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
|
2698 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2699 |
| elementary_type_name ASSIGN constant |
68 | 2700 |
{$$ = 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
|
2701 |
| prev_declared_simple_type_name ASSIGN constant |
68 | 2702 |
{$$ = new simple_spec_init_c($1, $3, locloc(@$));} |
131 | 2703 |
/* ERROR_CHECK_BEGIN */ |
2704 |
| elementary_type_name constant |
|
136 | 2705 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in specification with initialization."); yynerrs++;} |
2706 |
| prev_declared_simple_type_name constant |
|
2707 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in specification with initialization."); yynerrs++;} |
|
2708 |
| elementary_type_name ASSIGN error |
|
131 | 2709 |
{$$ = NULL; |
136 | 2710 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in specification with initialization.");} |
2711 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in specification with initialization."); yyclearin;} |
|
2712 |
yyerrok; |
|
2713 |
} |
|
2714 |
| prev_declared_simple_type_name ASSIGN error |
|
131 | 2715 |
{$$ = NULL; |
136 | 2716 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in specification with initialization.");} |
2717 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in specification with initialization."); yyclearin;} |
|
2718 |
yyerrok; |
|
131 | 2719 |
} |
2720 |
/* 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
|
2721 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2722 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2723 |
/* 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
|
2724 |
* 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
|
2725 |
* 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
|
2726 |
* 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
|
2727 |
* 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
|
2728 |
* 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
|
2729 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2730 |
* 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
|
2731 |
* 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
|
2732 |
* 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
|
2733 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2734 |
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
|
2735 |
// 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
|
2736 |
elementary_type_name |
68 | 2737 |
{$$ = 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
|
2738 |
| prev_declared_simple_type_name |
68 | 2739 |
{$$ = 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
|
2740 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2741 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2742 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2743 |
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
|
2744 |
/* subrange_type_name ':' subrange_spec_init */ |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2745 |
/* PRE_PARSING or SINGLE_PHASE_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2746 |
/* The following rules will be run either by: |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2747 |
* - the pre_parsing phase of two phase parsing (when preparsing command line option is chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2748 |
* - the standard single phase parser (when preparsing command line option is not chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2749 |
*/ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2750 |
identifier ':' subrange_spec_init {library_element_symtable.insert($1, prev_declared_subrange_type_name_token);} |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2751 |
{if (!get_preparse_state()) $$ = new subrange_type_declaration_c($1, $3, locloc(@$));} |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2752 |
/* POST_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2753 |
/* These rules will be run after the preparser phase of two phase parsing has finished (only gets to execute if preparsing command line option is chosen). */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2754 |
| prev_declared_subrange_type_name ':' subrange_spec_init |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2755 |
{$$ = new subrange_type_declaration_c(new identifier_c(((token_c *)$1)->value, locloc(@1)), $3, locloc(@$));} // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
131 | 2756 |
/* ERROR_CHECK_BEGIN */ |
136 | 2757 |
| error ':' subrange_spec_init |
2758 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid name defined for subrange type declaration."); yyerrok;} |
|
131 | 2759 |
| identifier subrange_spec_init |
136 | 2760 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in subrange type declaration."); yynerrs++;} |
131 | 2761 |
/* 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
|
2762 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2763 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2764 |
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
|
2765 |
subrange_specification |
68 | 2766 |
{$$ = 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
|
2767 |
| subrange_specification ASSIGN signed_integer |
68 | 2768 |
{$$ = new subrange_spec_init_c($1, $3, locloc(@$));} |
131 | 2769 |
/* ERROR_CHECK_BEGIN */ |
2770 |
| subrange_specification signed_integer |
|
136 | 2771 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in subrange specification with initialization."); yynerrs++;} |
2772 |
| subrange_specification ASSIGN error |
|
131 | 2773 |
{$$ = NULL; |
136 | 2774 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in subrange specification with initialization.");} |
2775 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in subrange specification with initialization."); yyclearin;} |
|
2776 |
yyerrok; |
|
131 | 2777 |
} |
2778 |
/* 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
|
2779 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2780 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2781 |
subrange_specification: |
131 | 2782 |
integer_type_name '(' subrange ')' |
68 | 2783 |
{$$ = new subrange_specification_c($1, $3, locloc(@$));} |
2784 |
| prev_declared_subrange_type_name |
|
98 | 2785 |
{$$ = new subrange_specification_c($1, NULL, locloc(@$));} |
131 | 2786 |
/* ERROR_CHECK_BEGIN */ |
2787 |
| integer_type_name '(' ')' |
|
136 | 2788 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no subrange defined in subrange specification."); yynerrs++;} |
131 | 2789 |
| integer_type_name '(' error ')' |
136 | 2790 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid subrange defined in subrange specification."); yyerrok;} |
131 | 2791 |
| integer_type_name '(' subrange error |
136 | 2792 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after subrange defined in subrange specification."); yyerrok;} |
131 | 2793 |
/* 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
|
2794 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2795 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2796 |
|
960
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2797 |
/* a non standard construct, used to allow the declaration of array subranges using a variable */ |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2798 |
subrange_with_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
|
2799 |
signed_integer DOTDOT signed_integer |
68 | 2800 |
{$$ = new subrange_c($1, $3, locloc(@$));} |
960
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2801 |
| any_identifier DOTDOT signed_integer |
980
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2802 |
{$$ = new subrange_c(new symbolic_constant_c($1, locloc(@1)), $3, locloc(@$)); |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2803 |
if (!runtime_options.nonliteral_in_array_size) { |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2804 |
print_err_msg(locf(@1), locl(@1), "Use of variables in array size limits is not allowed in IEC 61131-3 (use -a option to activate support for this non-standard feature)."); |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2805 |
yynerrs++; |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2806 |
} |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2807 |
} |
960
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2808 |
| signed_integer DOTDOT any_identifier |
980
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2809 |
{$$ = new subrange_c($1, new symbolic_constant_c($3, locloc(@3)), locloc(@$)); |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2810 |
if (!runtime_options.nonliteral_in_array_size) { |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2811 |
print_err_msg(locf(@3), locl(@3), "Use of variables in array size limits is not allowed in IEC 61131-3 (use -a option to activate support for this non-standard feature)."); |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2812 |
yynerrs++; |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2813 |
} |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2814 |
} |
960
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2815 |
| any_identifier DOTDOT any_identifier |
980
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2816 |
{$$ = new subrange_c(new symbolic_constant_c($1, locloc(@1)), new symbolic_constant_c($3, locloc(@3)), locloc(@$)); |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2817 |
if (!runtime_options.nonliteral_in_array_size) { |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2818 |
print_err_msg(locf(@$), locl(@$), "Use of variables in array size limits is not allowed in IEC 61131-3 (use -a option to activate support for this non-standard feature)."); |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2819 |
yynerrs++; |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2820 |
} |
9ed5aff159db
Make support for use of variables in array size declarations a command line option (off by default)
mjsousa
parents:
971
diff
changeset
|
2821 |
} |
131 | 2822 |
/* ERROR_CHECK_BEGIN */ |
2823 |
| signed_integer signed_integer |
|
136 | 2824 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'..' missing between bounds in subrange definition."); yynerrs++;} |
131 | 2825 |
| signed_integer DOTDOT error |
2826 |
{$$ = NULL; |
|
136 | 2827 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for upper bound in subrange definition.");} |
584 | 2828 |
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
|
2829 |
yyerrok; |
131 | 2830 |
} |
2831 |
/* 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
|
2832 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2833 |
|
960
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2834 |
|
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2835 |
subrange: |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2836 |
signed_integer DOTDOT signed_integer |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2837 |
{$$ = new subrange_c($1, $3, locloc(@$));} |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2838 |
/* ERROR_CHECK_BEGIN */ |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2839 |
| signed_integer signed_integer |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2840 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'..' missing between bounds in subrange definition."); yynerrs++;} |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2841 |
| signed_integer DOTDOT error |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2842 |
{$$ = NULL; |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2843 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for upper bound in subrange definition.");} |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2844 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for upper bound in subrange definition."); yyclearin;} |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2845 |
yyerrok; |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2846 |
} |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2847 |
/* ERROR_CHECK_END */ |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2848 |
; |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2849 |
|
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
2850 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2851 |
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
|
2852 |
/* 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
|
2853 |
/* 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
|
2854 |
* 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
|
2855 |
* 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
|
2856 |
* 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
|
2857 |
* ^^^^^^^ |
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
|
2858 |
* |
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
|
2859 |
* 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
|
2860 |
* 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
|
2861 |
* |
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
|
2862 |
* 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
|
2863 |
* 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
|
2864 |
* 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
|
2865 |
*/ |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2866 |
/* PRE_PARSING or SINGLE_PHASE_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2867 |
/* The following rules will be run either by: |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2868 |
* - the pre_parsing phase of two phase parsing (when preparsing command line option is chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2869 |
* - the standard single phase parser (when preparsing command line option is not chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2870 |
*/ |
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
|
2871 |
identifier ':' enumerated_specification {library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);} |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2872 |
{if (!get_preparse_state()) $$ = new enumerated_type_declaration_c($1, new enumerated_spec_init_c($3, NULL, locloc(@3)), locloc(@$));} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2873 |
| identifier ':' enumerated_specification {library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);} ASSIGN enumerated_value |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2874 |
{if (!get_preparse_state()) $$ = new enumerated_type_declaration_c($1, new enumerated_spec_init_c($3, $6, locf(@3), locl(@6)), locloc(@$));} |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2875 |
/* POST_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2876 |
/* These rules will be run after the preparser phase of two phase parsing has finished (only gets to execute if preparsing command line option is chosen). */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2877 |
/* Since the enumerated type name is placed in the library_element_symtable during preparsing, we can now safely use the single rule: */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2878 |
| prev_declared_enumerated_type_name ':' enumerated_spec_init |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2879 |
{$$ = new enumerated_type_declaration_c(new identifier_c(((token_c *)$1)->value, locloc(@1)), $3, locloc(@$));} // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2880 |
/* These two rules are equivalent to the above rule */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2881 |
/* |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2882 |
| prev_declared_enumerated_type_name ':' 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
|
2883 |
{$$ = new enumerated_type_declaration_c($1, new enumerated_spec_init_c($3, NULL, locloc(@3)), locloc(@$));} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2884 |
| prev_declared_enumerated_type_name ':' enumerated_specification {library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);} ASSIGN enumerated_value |
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
|
2885 |
{$$ = new enumerated_type_declaration_c($1, new enumerated_spec_init_c($3, $6, locf(@3), locl(@6)), locloc(@$));} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2886 |
*/ |
131 | 2887 |
/* ERROR_CHECK_BEGIN */ |
136 | 2888 |
| error ':' enumerated_spec_init |
2889 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid name defined for enumerated type declaration."); yyerrok;} |
|
131 | 2890 |
| identifier enumerated_spec_init |
136 | 2891 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in enumerated type declaration."); yynerrs++;} |
131 | 2892 |
/* 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
|
2893 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2894 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2895 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2896 |
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
|
2897 |
enumerated_specification |
68 | 2898 |
{$$ = 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
|
2899 |
| enumerated_specification ASSIGN enumerated_value |
68 | 2900 |
{$$ = new enumerated_spec_init_c($1, $3, locloc(@$));} |
131 | 2901 |
/* ERROR_CHECK_BEGIN */ |
2902 |
| enumerated_specification enumerated_value |
|
136 | 2903 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in enumerated specification with initialization."); yynerrs++;} |
2904 |
| enumerated_specification ASSIGN error |
|
131 | 2905 |
{$$ = NULL; |
136 | 2906 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined in enumerated specification with initialization.");} |
2907 |
else {print_err_msg(locf(@3), locl(@3), "invalid value in enumerated specification with initialization."); yyclearin;} |
|
2908 |
yyerrok; |
|
131 | 2909 |
} |
2910 |
/* 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
|
2911 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2912 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2913 |
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
|
2914 |
'(' 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
|
2915 |
{$$ = $2;} |
68 | 2916 |
| prev_declared_enumerated_type_name |
131 | 2917 |
/* ERROR_CHECK_BEGIN */ |
2918 |
| '(' ')' |
|
136 | 2919 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no enumerated value list defined in enumerated specification."); yynerrs++;} |
131 | 2920 |
| '(' error ')' |
136 | 2921 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid enumerated value list defined in enumerated specification.");yyerrok;} |
131 | 2922 |
| '(' enumerated_value_list error |
136 | 2923 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of enumerated specification."); yyerrok;} |
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 |
/* 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
|
2928 |
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
|
2929 |
enumerated_value |
68 | 2930 |
{$$ = 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
|
2931 |
| 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
|
2932 |
{$$ = $1; $$->add_element($3);} |
131 | 2933 |
/* ERROR_CHECK_BEGIN */ |
2934 |
| enumerated_value_list enumerated_value |
|
136 | 2935 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in enumerated value list.");} |
131 | 2936 |
| enumerated_value_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
2937 |
{$$ = $1; |
136 | 2938 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined in enumerated value list.");} |
2939 |
else {print_err_msg(locf(@3), locl(@3), "invalid value in enumerated value list."); yyclearin;} |
|
131 | 2940 |
yyerrok; |
2941 |
} |
|
2942 |
/* 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
|
2943 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2944 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2945 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2946 |
enumerated_value: |
85 | 2947 |
identifier |
121
9e8ce092e169
Adding support for POU struct definition in POUS.h
lbessard
parents:
118
diff
changeset
|
2948 |
{$$ = 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
|
2949 |
| prev_declared_enumerated_type_name '#' any_identifier |
68 | 2950 |
{$$ = new enumerated_value_c($1, $3, locloc(@$));} |
131 | 2951 |
/* ERROR_CHECK_BEGIN */ |
2952 |
| prev_declared_enumerated_type_name any_identifier |
|
136 | 2953 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between enumerated type name and value in enumerated literal."); yynerrs++;} |
131 | 2954 |
| prev_declared_enumerated_type_name '#' error |
2955 |
{$$ = NULL; |
|
136 | 2956 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for enumerated literal.");} |
2957 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for enumerated literal."); yyclearin;} |
|
2958 |
yyerrok; |
|
131 | 2959 |
} |
2960 |
/* 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
|
2961 |
; |
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 |
|
85 | 2964 |
/* |
13 | 2965 |
enumerated_value_without_identifier: |
2966 |
prev_declared_enumerated_type_name '#' any_identifier |
|
68 | 2967 |
{$$ = new enumerated_value_c($1, $3, locloc(@$));} |
13 | 2968 |
; |
85 | 2969 |
*/ |
13 | 2970 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2971 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2972 |
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
|
2973 |
/* array_type_name ':' array_spec_init */ |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2974 |
/* PRE_PARSING or SINGLE_PHASE_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2975 |
/* The following rules will be run either by: |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2976 |
* - the pre_parsing phase of two phase parsing (when preparsing command line option is chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2977 |
* - the standard single phase parser (when preparsing command line option is not chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2978 |
*/ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2979 |
identifier ':' array_spec_init {library_element_symtable.insert($1, prev_declared_array_type_name_token);} |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
2980 |
{if (!get_preparse_state()) $$ = new array_type_declaration_c($1, $3, locloc(@$));} |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2981 |
/* POST_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2982 |
/* These rules will be run after the preparser phase of two phase parsing has finished (only gets to execute if preparsing command line option is chosen). */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
2983 |
| prev_declared_array_type_name ':' array_spec_init |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
2984 |
{$$ = new array_type_declaration_c(new identifier_c(((token_c *)$1)->value, locloc(@1)), $3, locloc(@$));} // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
131 | 2985 |
/* ERROR_CHECK_BEGIN */ |
2986 |
| identifier array_spec_init |
|
136 | 2987 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in array type declaration."); yynerrs++;} |
131 | 2988 |
/* 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
|
2989 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2990 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
2991 |
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
|
2992 |
array_specification |
68 | 2993 |
{$$ = 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
|
2994 |
| array_specification ASSIGN array_initialization |
68 | 2995 |
{$$ = new array_spec_init_c($1, $3, locloc(@$));} |
131 | 2996 |
/* ERROR_CHECK_BEGIN */ |
2997 |
| array_specification array_initialization |
|
136 | 2998 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in array specification with initialization."); yynerrs++;} |
2999 |
| array_specification ASSIGN error |
|
131 | 3000 |
{$$ = NULL; |
136 | 3001 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in array specification with initialization.");} |
3002 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in array specification with initialization."); yyclearin;} |
|
3003 |
yyerrok; |
|
131 | 3004 |
} |
3005 |
/* 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
|
3006 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3007 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3008 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3009 |
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
|
3010 |
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
|
3011 |
| ARRAY '[' array_subrange_list ']' OF non_generic_type_name |
68 | 3012 |
{$$ = new array_specification_c($3, $6, locloc(@$));} |
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3013 |
| ARRAY '[' array_subrange_list ']' OF ref_spec_non_recursive |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3014 |
/* non standard extension: Allow use of arrays storing REF_TO datatypes that are declared as 'ARRAY [1..3] OF REF_TO INT' */ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3015 |
/* ^^^^^^ */ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3016 |
/* NOTE: We use ref_spec and not ref_spec_init as for the moment I do not want to allow direct specification of initial value. |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3017 |
* I (MJS) am not too sure whether this is currently supported in code generation, so leave it out for now. |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3018 |
* It also does not seem to be a very good idea to allow initial value specification when declaring the array, |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3019 |
* since the standard syntax does not allow it either for any other datatype! |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3020 |
* NOTE: We use ref_spec_non_recursive instead of ref_spec in order to remove a reduce/reduce conflict. |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3021 |
* Note that non_generic_type_name that is used in the previous rule already include the prev_declared_ref_type_name. |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3022 |
* which leads to the reduce/reduce conflict, as it is also included in ref_spec. |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3023 |
*/ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3024 |
{$$ = new array_specification_c($3, $6, locloc(@$)); |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3025 |
if (!allow_ref_to_in_derived_datatypes) { |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3026 |
print_err_msg(locf(@$), locl(@$), "REF_TO may not be used in an ARRAY specification (use -R option to activate support for this non-standard syntax)."); |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3027 |
yynerrs++; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3028 |
} |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3029 |
} |
131 | 3030 |
/* ERROR_CHECK_BEGIN */ |
3031 |
| ARRAY array_subrange_list ']' OF non_generic_type_name |
|
136 | 3032 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'[' missing before subrange list in array specification."); yynerrs++;} |
131 | 3033 |
| ARRAY '[' ']' OF non_generic_type_name |
136 | 3034 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no subrange list defined in array specification."); yynerrs++;} |
131 | 3035 |
| ARRAY '[' error ']' OF non_generic_type_name |
136 | 3036 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid subrange list defined in array specification."); yyerrok;} |
131 | 3037 |
| ARRAY OF non_generic_type_name |
136 | 3038 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no subrange list defined in array specification."); yynerrs++;} |
131 | 3039 |
| ARRAY error OF non_generic_type_name |
136 | 3040 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid subrange list defined in array specification."); yyerrok;} |
131 | 3041 |
| ARRAY '[' array_subrange_list OF non_generic_type_name |
136 | 3042 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "']' missing after subrange list in array specification."); yynerrs++;} |
131 | 3043 |
| ARRAY '[' array_subrange_list ']' non_generic_type_name |
136 | 3044 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "'OF' missing between subrange list and item type name in array specification."); yynerrs++;} |
131 | 3045 |
| ARRAY '[' array_subrange_list ']' OF error |
3046 |
{$$ = NULL; |
|
136 | 3047 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no item data type defined in array specification.");} |
3048 |
else {print_err_msg(locf(@3), locl(@3), "invalid item data type in array specification."); yyclearin;} |
|
131 | 3049 |
yyerrok; |
3050 |
} |
|
3051 |
/* 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
|
3052 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3053 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3054 |
/* 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
|
3055 |
array_subrange_list: |
960
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
3056 |
/* the construct 'subrange' has been replaced with 'subrange_with_var' in order to support the declaration of array ranges using a varable: e.g. ARRAY [2..max] OF INT */ |
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
3057 |
subrange_with_var |
68 | 3058 |
{$$ = new array_subrange_list_c(locloc(@$)); $$->add_element($1);} |
960
27063736913f
Allow variables to be used when declaring the dimension of an array.
mjsousa
parents:
946
diff
changeset
|
3059 |
| array_subrange_list ',' subrange_with_var |
98 | 3060 |
{$$ = $1; $$->add_element($3);} |
131 | 3061 |
/* ERROR_CHECK_BEGIN */ |
3062 |
| array_subrange_list subrange |
|
136 | 3063 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in subrange list."); yynerrs++;} |
131 | 3064 |
| array_subrange_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3065 |
{$$ = $1; |
136 | 3066 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no subrange defined in subrange list.");} |
3067 |
else {print_err_msg(locf(@3), locl(@3), "invalid subrange in subrange list."); yyclearin;} |
|
131 | 3068 |
yyerrok; |
3069 |
} |
|
3070 |
/* 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
|
3071 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3072 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3073 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3074 |
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
|
3075 |
'[' 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
|
3076 |
{$$ = $2;} |
131 | 3077 |
/* ERROR_CHECK_BEGIN */ |
3078 |
| '[' ']' |
|
136 | 3079 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no initial values list defined in array initialization."); yynerrs++;} |
131 | 3080 |
| '[' error ']' |
136 | 3081 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid initial values list defined in array initialization."); yyerrok;} |
131 | 3082 |
| '[' array_initial_elements_list error |
136 | 3083 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "']' missing at the end of array initialization."); yyerrok;} |
131 | 3084 |
/* 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
|
3085 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3086 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3087 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3088 |
/* 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
|
3089 |
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
|
3090 |
array_initial_elements |
68 | 3091 |
{$$ = 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
|
3092 |
| 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
|
3093 |
{$$ = $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
|
3094 |
/* ERROR_CHECK_BEGIN */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3095 |
/* 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
|
3096 |
* 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
|
3097 |
*/ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3098 |
/* |
131 | 3099 |
| array_initial_elements_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3100 |
{$$ = $1; |
136 | 3101 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no array initial value in array initial values list.");} |
3102 |
else {print_err_msg(locf(@3), locl(@3), "invalid array initial value in array initial values list."); yyclearin;} |
|
131 | 3103 |
yyerrok; |
3104 |
} |
|
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3105 |
*/ |
131 | 3106 |
/* 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
|
3107 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3108 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3109 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3110 |
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
|
3111 |
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
|
3112 |
| integer '(' ')' |
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
354
diff
changeset
|
3113 |
{$$ = 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
|
3114 |
| integer '(' array_initial_element ')' |
68 | 3115 |
{$$ = new array_initial_elements_c($1, $3, locloc(@$));} |
136 | 3116 |
/* ERROR_CHECK_BEGIN */ |
131 | 3117 |
| integer '(' error ')' |
136 | 3118 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid array initial value in array initial values list."); yyerrok;} |
131 | 3119 |
| integer '(' array_initial_element error |
136 | 3120 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of array initial value in array initial values list."); yyerrok;} |
131 | 3121 |
/* 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
|
3122 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3123 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3124 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3125 |
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
|
3126 |
constant |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3127 |
| 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
|
3128 |
| 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
|
3129 |
| 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
|
3130 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3131 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3132 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3133 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3134 |
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
|
3135 |
/* structure_type_name ':' structure_specification */ |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3136 |
/* PRE_PARSING or SINGLE_PHASE_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3137 |
/* The following rules will be run either by: |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3138 |
* - the pre_parsing phase of two phase parsing (when preparsing command line option is chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3139 |
* - the standard single phase parser (when preparsing command line option is not chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3140 |
*/ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
3141 |
identifier ':' structure_specification {library_element_symtable.insert($1, prev_declared_structure_type_name_token);} |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3142 |
{if (!get_preparse_state()) $$ = new structure_type_declaration_c($1, $3, locloc(@$));} |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3143 |
/* POST_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3144 |
/* These rules will be run after the preparser phase of two phase parsing has finished (only gets to execute if preparsing command line option is chosen). */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
3145 |
| prev_declared_structure_type_name ':' structure_specification |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3146 |
{$$ = new structure_type_declaration_c(new identifier_c(((token_c *)$1)->value, locloc(@1)), $3, locloc(@$));} // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
131 | 3147 |
/* ERROR_CHECK_BEGIN */ |
3148 |
| identifier structure_specification |
|
136 | 3149 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in structure type declaration."); yynerrs++;} |
131 | 3150 |
/* 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
|
3151 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3152 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3153 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3154 |
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
|
3155 |
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
|
3156 |
| 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
|
3157 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3158 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3159 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3160 |
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
|
3161 |
prev_declared_structure_type_name |
68 | 3162 |
{$$ = 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
|
3163 |
| prev_declared_structure_type_name ASSIGN structure_initialization |
68 | 3164 |
{$$ = new initialized_structure_c($1, $3, locloc(@$));} |
131 | 3165 |
/* ERROR_CHECK_BEGIN */ |
3166 |
| prev_declared_structure_type_name structure_initialization |
|
136 | 3167 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in structure specification with initialization."); yynerrs++;} |
3168 |
| prev_declared_structure_type_name ASSIGN error |
|
131 | 3169 |
{$$ = NULL; |
136 | 3170 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined in structure specification with initialization.");} |
3171 |
else {print_err_msg(locf(@3), locl(@3), "invalid value in structure specification with initialization."); yyclearin;} |
|
3172 |
yyerrok; |
|
131 | 3173 |
} |
3174 |
/* 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
|
3175 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3176 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3177 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3178 |
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
|
3179 |
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
|
3180 |
{$$ = $2;} |
131 | 3181 |
/* ERROR_CHECK_BEGIN */ |
3182 |
| STRUCT END_STRUCT |
|
136 | 3183 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no structure element declared in structure type declaration."); yynerrs++;} |
131 | 3184 |
| STRUCT error structure_element_declaration_list END_STRUCT |
136 | 3185 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'STRUCT' in structure type declaration."); yyerrok;} |
3186 |
| STRUCT structure_element_declaration_list error END_OF_INPUT |
|
3187 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed structure type declaration."); yyerrok;} |
|
131 | 3188 |
| STRUCT error END_STRUCT |
136 | 3189 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in structure type declaration."); yyerrok;} |
131 | 3190 |
/* 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
|
3191 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3192 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3193 |
/* 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
|
3194 |
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
|
3195 |
structure_element_declaration ';' |
68 | 3196 |
{$$ = 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
|
3197 |
| 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
|
3198 |
{$$ = $1; $$->add_element($2);} |
131 | 3199 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3200 |
| error ';' |
136 | 3201 |
{$$ = new structure_element_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid structure element declaration."); yyerrok;} |
131 | 3202 |
| structure_element_declaration error |
136 | 3203 |
{$$ = new structure_element_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of structure element declaration."); yyerrok;} |
131 | 3204 |
| structure_element_declaration_list structure_element_declaration error |
136 | 3205 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of structure element declaration."); yyerrok;} |
133 | 3206 |
| structure_element_declaration_list error ';' |
136 | 3207 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid structure element declaration."); yyerrok;} |
131 | 3208 |
| structure_element_declaration_list ';' |
136 | 3209 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after structure element declaration."); yynerrs++;} |
131 | 3210 |
/* 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
|
3211 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3212 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3213 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3214 |
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
|
3215 |
structure_element_name ':' simple_spec_init |
1044
519a30dbf96c
Add token references in structure_element_declaration_c
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
3216 |
{$$ = new structure_element_declaration_c($1, $3, locloc(@$)); $$->token = $1->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
|
3217 |
| structure_element_name ':' subrange_spec_init |
1044
519a30dbf96c
Add token references in structure_element_declaration_c
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
3218 |
{$$ = new structure_element_declaration_c($1, $3, locloc(@$)); $$->token = $1->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
|
3219 |
| structure_element_name ':' enumerated_spec_init |
1044
519a30dbf96c
Add token references in structure_element_declaration_c
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
3220 |
{$$ = new structure_element_declaration_c($1, $3, locloc(@$)); $$->token = $1->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
|
3221 |
| structure_element_name ':' array_spec_init |
1044
519a30dbf96c
Add token references in structure_element_declaration_c
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
3222 |
{$$ = new structure_element_declaration_c($1, $3, locloc(@$)); $$->token = $1->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
|
3223 |
| structure_element_name ':' initialized_structure |
1044
519a30dbf96c
Add token references in structure_element_declaration_c
Mario de Sousa <msousa@fe.up.pt>
parents:
1041
diff
changeset
|
3224 |
{$$ = new structure_element_declaration_c($1, $3, locloc(@$)); $$->token = $1->token;} |
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3225 |
| structure_element_name ':' ref_spec_init /* non standard extension: Allow use of struct elements storing REF_TO datatypes (either using REF_TO or a previosuly declared ref type) */ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3226 |
{ $$ = new structure_element_declaration_c($1, $3, locloc(@$)); |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3227 |
if (!allow_ref_to_in_derived_datatypes) { |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3228 |
print_err_msg(locf(@$), locl(@$), "REF_TO and reference datatypes may not be used in a STRUCT element (use -R option to activate support for this non-standard syntax)."); |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3229 |
yynerrs++; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3230 |
} |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3231 |
} |
131 | 3232 |
/* ERROR_CHECK_BEGIN */ |
3233 |
| structure_element_name simple_spec_init |
|
136 | 3234 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and simple specification."); yynerrs++;} |
131 | 3235 |
| structure_element_name subrange_spec_init |
136 | 3236 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and subrange specification."); yynerrs++;} |
131 | 3237 |
| structure_element_name enumerated_spec_init |
136 | 3238 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and enumerated specification."); yynerrs++;} |
131 | 3239 |
| structure_element_name array_spec_init |
136 | 3240 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and array specification."); yynerrs++;} |
131 | 3241 |
| structure_element_name initialized_structure |
136 | 3242 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and structure specification."); yynerrs++;} |
131 | 3243 |
| structure_element_name ':' error |
3244 |
{$$ = NULL; |
|
136 | 3245 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in structure element declaration.");} |
3246 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in structure element declaration."); yyclearin;} |
|
131 | 3247 |
yyerrok; |
3248 |
} |
|
3249 |
/* 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
|
3250 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3251 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3252 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3253 |
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
|
3254 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3255 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3256 |
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
|
3257 |
'(' 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
|
3258 |
{$$ = $2;} |
131 | 3259 |
/* ERROR_CHECK_BEGIN */ |
3260 |
| '(' error ')' |
|
136 | 3261 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid structure element initialization list in structure initialization."); yyerrok;} |
131 | 3262 |
| '(' structure_element_initialization_list error |
136 | 3263 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "expecting ')' at the end of structure element initialization list in structure initialization."); yyerrok;} |
131 | 3264 |
/* 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
|
3265 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3266 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3267 |
/* 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
|
3268 |
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
|
3269 |
structure_element_initialization |
68 | 3270 |
{$$ = 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
|
3271 |
| 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
|
3272 |
{$$ = $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
|
3273 |
/* ERROR_CHECK_BEGIN */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3274 |
/* 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
|
3275 |
* 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
|
3276 |
*/ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3277 |
/* |
131 | 3278 |
| structure_element_initialization_list structure_element_initialization |
136 | 3279 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in structure element initialization list in structure initialization."); yynerrs++;} |
131 | 3280 |
| structure_element_initialization_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3281 |
{$$ = $1; |
136 | 3282 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no structure element initialization defined in structure initialization.");} |
3283 |
else {print_err_msg(locf(@3), locl(@3), "invalid structure element initialization in structure initialization."); yyclearin;} |
|
131 | 3284 |
yyerrok; |
3285 |
} |
|
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
3286 |
*/ |
131 | 3287 |
/* 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
|
3288 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3289 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3290 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3291 |
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
|
3292 |
structure_element_name ASSIGN constant |
68 | 3293 |
{$$ = 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
|
3294 |
| structure_element_name ASSIGN enumerated_value |
68 | 3295 |
{$$ = 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
|
3296 |
| structure_element_name ASSIGN array_initialization |
68 | 3297 |
{$$ = 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
|
3298 |
| structure_element_name ASSIGN structure_initialization |
68 | 3299 |
{$$ = new structure_element_initialization_c($1, $3, locloc(@$));} |
131 | 3300 |
/* ERROR_CHECK_BEGIN */ |
3301 |
| structure_element_name constant |
|
136 | 3302 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in structure element initialization."); yynerrs++;} |
3303 |
| structure_element_name enumerated_value |
|
3304 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in enumerated structure element initialization."); yynerrs++;} |
|
3305 |
| structure_element_name array_initialization |
|
3306 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in array structure element initialization."); yynerrs++;} |
|
3307 |
| structure_element_name structure_initialization |
|
3308 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in structured structure element initialization."); yynerrs++;} |
|
3309 |
| structure_element_name ASSIGN error |
|
131 | 3310 |
{$$ = NULL; |
136 | 3311 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in structured structure element initialization.");} |
3312 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in structured structure element initialization."); yyclearin;} |
|
3313 |
yyerrok; |
|
131 | 3314 |
} |
3315 |
/* 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
|
3316 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3317 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3318 |
/* 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
|
3319 |
* 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
|
3320 |
* 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
|
3321 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3322 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3323 |
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
|
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 |
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
|
3327 |
/* string_type_name ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init */ |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3328 |
/* PRE_PARSING or SINGLE_PHASE_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3329 |
/* The following rules will be run either by: |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3330 |
* - the pre_parsing phase of two phase parsing (when preparsing command line option is chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3331 |
* - the standard single phase parser (when preparsing command line option is not chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3332 |
*/ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
3333 |
identifier ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init {library_element_symtable.insert($1, prev_declared_string_type_name_token);} |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3334 |
{if (!get_preparse_state()) $$ = new string_type_declaration_c($1, $3, $4, $5, locloc(@$));} |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3335 |
/* POST_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3336 |
/* These rules will be run after the preparser phase of two phase parsing has finished (only gets to execute if preparsing command line option is chosen). */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
3337 |
| prev_declared_string_type_name ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3338 |
{$$ = new string_type_declaration_c(new identifier_c(((token_c *)$1)->value, locloc(@1)), $3, $4, $5, locloc(@$));} // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an 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
|
3339 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3340 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3341 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3342 |
/* 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
|
3343 |
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
|
3344 |
'[' integer ']' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3345 |
{$$ = $2;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3346 |
/* REMOVED !! */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3347 |
//| /* empty */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3348 |
// {$$ = NULL;} |
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 |
/* 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
|
3351 |
* 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
|
3352 |
* 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
|
3353 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3354 |
* 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
|
3355 |
* 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
|
3356 |
* 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
|
3357 |
* 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
|
3358 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3359 |
* 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
|
3360 |
* 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
|
3361 |
* 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
|
3362 |
* 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
|
3363 |
* 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
|
3364 |
* 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
|
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 |
/* 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
|
3368 |
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
|
3369 |
/* empty */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3370 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3371 |
| 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
|
3372 |
{$$ = $2;} |
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3375 |
|
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
|
3376 |
/* 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
|
3377 |
* // 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
|
3378 |
* 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
|
3379 |
* 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
|
3380 |
* 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
|
3381 |
* 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
|
3382 |
* 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
|
3383 |
* 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
|
3384 |
* 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
|
3385 |
* 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
|
3386 |
* 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
|
3387 |
*/ |
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
|
3388 |
|
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
|
3389 |
/* 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
|
3390 |
* 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
|
3391 |
* We have therefore explicitly added the "REF_TO function_block_type_name" to this rule! |
923
0ad7843d3790
Add support for non standard REF_TO ANY (equivalent to void *)
mjsousa
parents:
919
diff
changeset
|
3392 |
* NOTE: the REF_TO ANY is a non-standard extension to the standard. This is basically equivalent to a (void *) |
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
|
3393 |
*/ |
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3394 |
ref_spec_non_recursive: /* helper symbol, used to remove a reduce/reduce conflict in a non-standard syntax I (Mario) have added!! */ |
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
|
3395 |
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
|
3396 |
{$$ = 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
|
3397 |
| 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
|
3398 |
{$$ = new ref_spec_c($2, locloc(@$));} |
923
0ad7843d3790
Add support for non standard REF_TO ANY (equivalent to void *)
mjsousa
parents:
919
diff
changeset
|
3399 |
| REF_TO ANY |
924 | 3400 |
{$$ = new ref_spec_c(new generic_type_any_c(locloc(@2)), locloc(@$)); |
3401 |
if (!allow_ref_to_any) { |
|
3402 |
print_err_msg(locf(@$), locl(@$), "REF_TO ANY datatypes are not allowed (use -R option to activate support for this non-standard syntax)."); |
|
3403 |
yynerrs++; |
|
3404 |
} |
|
3405 |
} |
|
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3406 |
; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3407 |
|
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3408 |
ref_spec: /* defined in IEC 61131-3 v3 */ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3409 |
ref_spec_non_recursive |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3410 |
| prev_declared_ref_type_name |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3411 |
; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3412 |
|
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3413 |
|
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3414 |
/* The IEC 61131-3 v3 standard actually only defines the following syntax: |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3415 |
* |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3416 |
* Ref_Type_Decl: Ref_Type_Name ':' Ref_Spec_Init; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3417 |
* Ref_Spec_Init: Ref_Spec ( ':=' Ref_Value )?; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3418 |
* Ref_Spec : 'REF_TO' + Data_Type_Access; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3419 |
* |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3420 |
* Note that the above syntax it is not possible to define a REF_TO datatype as |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3421 |
* an alias to an already previously declared REF_TO datatype. |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3422 |
* |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3423 |
* I (Mario) believe that this is probably a bug in the IEC 61131-3 syntax, and I have therefore |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3424 |
* changed that standard definition to... |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3425 |
* |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3426 |
* Ref_Type_Decl: Ref_Type_Name ':' Ref_Spec_Init; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3427 |
* Ref_Spec_Init: Ref_Spec ( ':=' Ref_Value )?; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3428 |
* Ref_Spec : ('REF_TO' + Data_Type_Access) | Ref_Type_Name; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3429 |
* |
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
|
3430 |
* 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
|
3431 |
* TYPE |
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3432 |
* ref1_t: REF_TO INT; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3433 |
* ref2_t: ref1_t; <-- without the above changes, this would not be allowed!! |
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
|
3434 |
* 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
|
3435 |
* |
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3436 |
* This change also makes it possible to declare variables using a previously declared REF_TO datatype |
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
|
3437 |
* For example: |
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3438 |
* VAR refvar: ref1_t; END_VAR |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3439 |
* |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3440 |
* This change also makes it possible to declare arrays containing a previously declared ref type. |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3441 |
* For example: |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3442 |
* VAR refvar: ARRAY [1..3] OF ref1_t; END_VAR <--- becomes OK |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3443 |
* VAR refvar: ARRAY [1..3] OF REF_TO INT; END_VAR <--- still not OK. (Only becomes OK with other non-standard rules in another location of this file!) |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3444 |
* |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3445 |
* Interestingly, this change does NOT make it possible to declare structure elements of a previously declared ref type. |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3446 |
* For example: |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3447 |
* TYPE struct_t: STRUCT elem1: ref1_t; END_STRUCT; END_TYPE; <--- still not OK. (Only becomes OK with other non-standard rules in another location of this file!) |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3448 |
* TYPE struct_t: STRUCT elem1: REF_TO INT; END_STRUCT; END_TYPE; <--- still not OK. (Only becomes OK with other non-standard rules in another location of this file!) |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3449 |
*/ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3450 |
|
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
|
3451 |
|
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
|
3452 |
|
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
|
3453 |
ref_spec_init: /* defined in IEC 61131-3 v3 */ |
909
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
894
diff
changeset
|
3454 |
ref_spec |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
894
diff
changeset
|
3455 |
{$$ = new ref_spec_init_c($1, NULL, locloc(@$));} |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
894
diff
changeset
|
3456 |
/* For the moment, we do not support initialising reference data types... |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
894
diff
changeset
|
3457 |
| ref_spec ASSIGN ... |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
894
diff
changeset
|
3458 |
{$$ = new ref_spec_init_c($1, $3, locloc(@$));} |
8b2a31dea131
Add support for REF_TO derived datatypes (along with datatype verification)
mjsousa
parents:
894
diff
changeset
|
3459 |
*/ |
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
|
3460 |
; |
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
|
3461 |
|
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
|
3462 |
ref_type_decl: /* defined in IEC 61131-3 v3 */ |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3463 |
/* PRE_PARSING or SINGLE_PHASE_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3464 |
/* The following rules will be run either by: |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3465 |
* - the pre_parsing phase of two phase parsing (when preparsing command line option is chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3466 |
* - the standard single phase parser (when preparsing command line option is not chosen). |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3467 |
*/ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
3468 |
identifier ':' ref_spec_init {library_element_symtable.insert($1, prev_declared_ref_type_name_token);} |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3469 |
{if (!get_preparse_state()) $$ = new ref_type_decl_c($1, $3, locloc(@$));} |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3470 |
/* POST_PARSING */ |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3471 |
/* These rules will be run after the preparser phase of two phase parsing has finished (only gets to execute if preparsing command line option is chosen). */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
3472 |
| prev_declared_ref_type_name ':' ref_spec_init |
954
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3473 |
{$$ = new ref_type_decl_c(new identifier_c(((token_c *)$1)->value, locloc(@1)), $3, locloc(@$));} // change the derived_datatype_identifier_c into an identifier_c, as it will be taking the place of an identifier! |
a3f6039f1684
Fix AST generated by parsing with preparsing switched on, and allow parsing to work with preparsing off.
mjsousa
parents:
953
diff
changeset
|
3474 |
; |
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
|
3475 |
|
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
|
3476 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3477 |
|
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3478 |
|
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3479 |
|
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
3480 |
|
0
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 |
/* 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
|
3483 |
/*********************/ |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3484 |
/* 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
|
3485 |
* - 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
|
3486 |
* - ...=> 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
|
3487 |
* - ...=> 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
|
3488 |
* - 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
|
3489 |
* 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
|
3490 |
* 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
|
3491 |
* 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
|
3492 |
* 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
|
3493 |
* 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
|
3494 |
* 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
|
3495 |
* 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
|
3496 |
* (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
|
3497 |
* 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
|
3498 |
* 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
|
3499 |
* 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
|
3500 |
* 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
|
3501 |
* 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
|
3502 |
* 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
|
3503 |
* 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
|
3504 |
* 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
|
3505 |
* 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
|
3506 |
* 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
|
3507 |
* 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
|
3508 |
* 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
|
3509 |
* 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
|
3510 |
* 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
|
3511 |
* (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
|
3512 |
* (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
|
3513 |
* 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
|
3514 |
* 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
|
3515 |
* (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
|
3516 |
* 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
|
3517 |
* 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
|
3518 |
* 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
|
3519 |
* 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
|
3520 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3521 |
* 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
|
3522 |
* 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
|
3523 |
* 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
|
3524 |
* - 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
|
3525 |
* - 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
|
3526 |
* 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
|
3527 |
* 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
|
3528 |
* 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
|
3529 |
* 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
|
3530 |
* 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
|
3531 |
* 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
|
3532 |
* 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
|
3533 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3534 |
variable: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3535 |
symbolic_variable |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
3536 |
| prev_declared_direct_variable |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3537 |
| eno_identifier |
1053
e94368340160
Set the symbol->token member in symbolic_variables_c objects.
Mario de Sousa <msousa@fe.up.pt>
parents:
1044
diff
changeset
|
3538 |
{$$ = new symbolic_variable_c($1, locloc(@$)); $$->token = $1->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
|
3539 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3540 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3541 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3542 |
symbolic_variable: |
68 | 3543 |
/* 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
|
3544 |
* 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
|
3545 |
*/ |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
3546 |
prev_declared_fb_name |
1053
e94368340160
Set the symbol->token member in symbolic_variables_c objects.
Mario de Sousa <msousa@fe.up.pt>
parents:
1044
diff
changeset
|
3547 |
{$$ = new symbolic_variable_c($1, locloc(@$)); $$->token = $1->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
|
3548 |
| prev_declared_global_var_name |
1053
e94368340160
Set the symbol->token member in symbolic_variables_c objects.
Mario de Sousa <msousa@fe.up.pt>
parents:
1044
diff
changeset
|
3549 |
{$$ = new symbolic_variable_c($1, locloc(@$)); $$->token = $1->token;} |
13 | 3550 |
| prev_declared_variable_name |
1053
e94368340160
Set the symbol->token member in symbolic_variables_c objects.
Mario de Sousa <msousa@fe.up.pt>
parents:
1044
diff
changeset
|
3551 |
{$$ = new symbolic_variable_c($1, locloc(@$)); $$->token = $1->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
|
3552 |
| multi_element_variable |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
3553 |
/* |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
3554 |
| identifier |
1053
e94368340160
Set the symbol->token member in symbolic_variables_c objects.
Mario de Sousa <msousa@fe.up.pt>
parents:
1044
diff
changeset
|
3555 |
{$$ = new symbolic_variable_c($1, locloc(@$)); $$->token = $1->token;} |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
3556 |
*/ |
933
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3557 |
| symbolic_variable '^' |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3558 |
/* Dereferencing operator defined in IEC 61131-3 v3. However, implemented here differently then how it is defined in the standard! See following note for explanation! */ |
936
0f7bcc160568
Fix bug: Add support for de-referencing pointers to struct (struct_ptr^.elem1) when used inside FB.
mjsousa
parents:
934
diff
changeset
|
3559 |
{$$ = new deref_operator_c($1, locloc(@$)); |
934
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
3560 |
if (!allow_ref_dereferencing) { |
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
3561 |
print_err_msg(locf(@$), locl(@$), "Derefencing REF_TO datatypes with '^' is not allowed (use -r option to activate support for this IEC 61131-3 v3 feature)."); |
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
3562 |
yynerrs++; |
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
3563 |
} |
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
3564 |
} |
933
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3565 |
; |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3566 |
/* |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3567 |
* NOTE: The syntax defined in the v3 standard for the dereferencing operator '^' seems to me to be un-intentionally |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3568 |
* limited. For example |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3569 |
* ref_to_bool_var := REF( array_of_bool [1] ); <--- Allowed! |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3570 |
* ref_to_bool_var := REF( ref_to_array_of_bool^[1] ); <--- Allowed! |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3571 |
* bool_var := array_of_ref_to_bool[1]^; <--- NOT Allowed! |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3572 |
* ref_to_array_of_bool^[1] := FALSE; <--- Allowed! |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3573 |
* I consider this a bug in the v3 standard!! |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3574 |
* I have therefore opted to implement this by simply adding a rule to symbolic_variable |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3575 |
* symbolic_variable: |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3576 |
* ... |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3577 |
* | symbolic_variable '^' |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3578 |
* This simple rule should be able to cover all the needed dereferencing syntax! |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3579 |
* I have also added a dereferencing expression for the DREF() operator. |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3580 |
* Since both of them do the exact same operation, they will both be translated to the exact same |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3581 |
* entry type in the abstract syntax tree (an deref_expression_c) |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
3582 |
*/ |
0
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3585 |
/* 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
|
3586 |
* 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
|
3587 |
* 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
|
3588 |
* 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
|
3589 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3590 |
* 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
|
3591 |
* 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
|
3592 |
* 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
|
3593 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3594 |
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
|
3595 |
// 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
|
3596 |
any_identifier |
1053
e94368340160
Set the symbol->token member in symbolic_variables_c objects.
Mario de Sousa <msousa@fe.up.pt>
parents:
1044
diff
changeset
|
3597 |
{$$ = new symbolic_variable_c($1, locloc(@$)); $$->token = $1->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
|
3598 |
| 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
|
3599 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3600 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3601 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3602 |
/* 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
|
3603 |
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
|
3604 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3605 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3606 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3607 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3608 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3609 |
/********************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3610 |
/* 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
|
3611 |
/********************************************/ |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
3612 |
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
|
3613 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3614 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3615 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3616 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3617 |
/*************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3618 |
/* 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
|
3619 |
/*************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3620 |
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
|
3621 |
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
|
3622 |
| 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
|
3623 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3624 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3625 |
/* 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
|
3626 |
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
|
3627 |
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
|
3628 |
| 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
|
3629 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3630 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3631 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3632 |
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
|
3633 |
subscripted_variable '[' subscript_list ']' |
68 | 3634 |
{$$ = 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
|
3635 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3636 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3637 |
/* 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
|
3638 |
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
|
3639 |
any_subscripted_variable '[' subscript_list ']' |
68 | 3640 |
{$$ = 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
|
3641 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3642 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3643 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3644 |
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
|
3645 |
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
|
3646 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3647 |
|
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 |
/* 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
|
3650 |
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
|
3651 |
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
|
3652 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3653 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3654 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3655 |
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
|
3656 |
subscript |
68 | 3657 |
{$$ = 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
|
3658 |
| 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
|
3659 |
{$$ = $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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3662 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3663 |
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
|
3664 |
|
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 |
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
|
3667 |
record_variable '.' field_selector |
68 | 3668 |
{$$ = 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
|
3669 |
| 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
|
3670 |
{$$ = 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
|
3671 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3672 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3673 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3674 |
/* 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
|
3675 |
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
|
3676 |
any_record_variable '.' field_selector |
68 | 3677 |
{$$ = 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
|
3678 |
| 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
|
3679 |
{$$ = 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
|
3680 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3681 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3682 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3683 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3684 |
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
|
3685 |
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
|
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 |
/* 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
|
3690 |
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
|
3691 |
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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3694 |
|
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3695 |
field_selector: |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3696 |
any_identifier |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3697 |
| eno_identifier |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3698 |
; |
0
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3701 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3702 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3703 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3704 |
|
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 |
/* 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
|
3707 |
/******************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3708 |
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
|
3709 |
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
|
3710 |
{$$ = 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
|
3711 |
| 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
|
3712 |
{$$ = 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
|
3713 |
| 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
|
3714 |
{$$ = new input_declarations_c(new non_retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));} |
95 | 3715 |
/* ERROR_CHECK_BEGIN */ |
131 | 3716 |
| VAR_INPUT END_VAR |
136 | 3717 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in input variable(s) declaration."); yynerrs++;} |
131 | 3718 |
| VAR_INPUT RETAIN END_VAR |
136 | 3719 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive input variable(s) declaration."); yynerrs++;} |
131 | 3720 |
| VAR_INPUT NON_RETAIN END_VAR |
136 | 3721 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in non-retentive input variable(s) declaration."); yynerrs++;} |
131 | 3722 |
| VAR_INPUT error input_declaration_list END_VAR |
136 | 3723 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_INPUT' in input variable(s) declaration."); yyerrok;} |
131 | 3724 |
| VAR_INPUT RETAIN error input_declaration_list END_VAR |
136 | 3725 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive input variable(s) declaration."); yyerrok;} |
131 | 3726 |
| VAR_INPUT NON_RETAIN error input_declaration_list END_VAR |
136 | 3727 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive input variable(s) declaration."); yyerrok;} |
3728 |
| VAR_INPUT input_declaration_list error END_OF_INPUT |
|
3729 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed input variable(s) declaration."); yyerrok;} |
|
3730 |
| VAR_INPUT RETAIN input_declaration_list error END_OF_INPUT |
|
3731 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive input variable(s) declaration."); yyerrok;} |
|
3732 |
| VAR_INPUT NON_RETAIN input_declaration_list error END_OF_INPUT |
|
3733 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive input variable(s) declaration."); yyerrok;} |
|
95 | 3734 |
| VAR_INPUT error END_VAR |
136 | 3735 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in input variable(s) declaration."); yyerrok;} |
131 | 3736 |
| VAR_INPUT RETAIN error END_VAR |
136 | 3737 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive input variable(s) declaration."); yyerrok;} |
131 | 3738 |
| VAR_INPUT NON_RETAIN error END_VAR |
136 | 3739 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non-retentive input variable(s) declaration."); yyerrok;} |
95 | 3740 |
/* 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
|
3741 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3742 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3743 |
/* 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
|
3744 |
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
|
3745 |
input_declaration ';' |
68 | 3746 |
{$$ = 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
|
3747 |
| 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
|
3748 |
{$$ = $1; $$->add_element($2);} |
131 | 3749 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3750 |
| error ';' |
136 | 3751 |
{$$ = new input_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid input variable(s) declaration."); yyerrok;} |
131 | 3752 |
| input_declaration error |
136 | 3753 |
{$$ = new input_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of input variable(s) declaration."); yyerrok;} |
131 | 3754 |
| input_declaration_list input_declaration error |
136 | 3755 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of input variable(s) declaration."); yyerrok;} |
133 | 3756 |
| input_declaration_list error ';' |
136 | 3757 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid input variable(s) declaration."); yyerrok;} |
131 | 3758 |
| input_declaration_list ';' |
136 | 3759 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after input variable(s) declaration."); yynerrs++;} |
131 | 3760 |
/* 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
|
3761 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3762 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3763 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3764 |
/* 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
|
3765 |
* 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
|
3766 |
* 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
|
3767 |
* 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
|
3768 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3769 |
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
|
3770 |
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
|
3771 |
| 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
|
3772 |
| 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3775 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3776 |
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
|
3777 |
var1_list ':' BOOL R_EDGE |
68 | 3778 |
{$$ = 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
|
3779 |
| var1_list ':' BOOL F_EDGE |
68 | 3780 |
{$$ = new edge_declaration_c(new falling_edge_option_c(locloc(@3)), $1, locloc(@$));} |
131 | 3781 |
/* ERROR_CHECK_BEGIN */ |
3782 |
| 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
|
3783 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;} |
131 | 3784 |
| 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
|
3785 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;} |
131 | 3786 |
| 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
|
3787 |
{$$ = 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
|
3788 |
| 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
|
3789 |
{$$ = 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 | 3790 |
| var1_list ':' R_EDGE |
136 | 3791 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;} |
131 | 3792 |
| var1_list ':' F_EDGE |
136 | 3793 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;} |
131 | 3794 |
/* 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
|
3795 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3796 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3797 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3798 |
/* 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
|
3799 |
* 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
|
3800 |
* 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
|
3801 |
* 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
|
3802 |
* 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
|
3803 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
3804 |
* 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
|
3805 |
*/ |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3806 |
en_param_declaration: |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3807 |
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
|
3808 |
{$$ = 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
|
3809 |
| 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
|
3810 |
{$$ = 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
|
3811 |
/* ERROR_CHECK_BEGIN */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
3812 |
| 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
|
3813 |
{$$ = 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
|
3814 |
| 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
|
3815 |
{$$ = 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
|
3816 |
| 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
|
3817 |
{$$ = 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
|
3818 |
| 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
|
3819 |
{$$ = 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
|
3820 |
| 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
|
3821 |
{$$ = NULL; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3822 |
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
|
3823 |
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
|
3824 |
yyerrok; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3825 |
} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
3826 |
/* 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
|
3827 |
; |
0
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 |
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
|
3830 |
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
|
3831 |
| 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
|
3832 |
| 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
|
3833 |
| 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
|
3834 |
| 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
|
3835 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3836 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3837 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3838 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3839 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3840 |
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
|
3841 |
var1_list ':' simple_spec_init |
68 | 3842 |
{$$ = 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
|
3843 |
| var1_list ':' subrange_spec_init |
68 | 3844 |
{$$ = 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
|
3845 |
| var1_list ':' enumerated_spec_init |
68 | 3846 |
{$$ = 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
|
3847 |
| 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
|
3848 |
{$$ = new var1_init_decl_c($1, $3, locloc(@$));} |
131 | 3849 |
/* ERROR_CHECK_BEGIN */ |
3850 |
| var1_list simple_spec_init |
|
136 | 3851 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and simple specification."); yynerrs++;} |
131 | 3852 |
| var1_list subrange_spec_init |
136 | 3853 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and subrange specification."); yynerrs++;} |
131 | 3854 |
| var1_list enumerated_spec_init |
136 | 3855 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and enumerated specification."); yynerrs++;} |
131 | 3856 |
| var1_list ':' error |
3857 |
{$$ = NULL; |
|
136 | 3858 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in variable declaration.");} |
3859 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in variable declaration."); yyclearin;} |
|
131 | 3860 |
yyerrok; |
3861 |
} |
|
3862 |
/* 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
|
3863 |
; |
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 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3866 |
/* NOTE: |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3867 |
* The syntax |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3868 |
* variable_name DOTDOT |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3869 |
* 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
|
3870 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3871 |
* 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
|
3872 |
* (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
|
3873 |
* 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
|
3874 |
* 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
|
3875 |
* 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
|
3876 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3877 |
* 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
|
3878 |
* 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
|
3879 |
* 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
|
3880 |
* user defined functions. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3881 |
* 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
|
3882 |
* 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
|
3883 |
* 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
|
3884 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3885 |
* 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
|
3886 |
* 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
|
3887 |
* '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
|
3888 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3889 |
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
|
3890 |
variable_name |
68 | 3891 |
{$$ = 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
|
3892 |
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
|
3893 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3894 |
| 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
|
3895 |
{$$ = 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
|
3896 |
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
|
3897 |
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
|
3898 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3899 |
| 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
|
3900 |
{$$ = $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
|
3901 |
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
|
3902 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
3903 |
| 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
|
3904 |
{$$ = $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
|
3905 |
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
|
3906 |
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
|
3907 |
} |
131 | 3908 |
/* ERROR_CHECK_BEGIN */ |
3909 |
| var1_list variable_name |
|
136 | 3910 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in variable list."); yynerrs++;} |
131 | 3911 |
| var1_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
3912 |
{$$ = $1; |
136 | 3913 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no variable name defined in variable declaration.");} |
3914 |
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
|
3915 |
yyerrok; |
131 | 3916 |
} |
3917 |
/* 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3921 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3922 |
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
|
3923 |
var1_list ':' array_spec_init |
68 | 3924 |
{$$ = new array_var_init_decl_c($1, $3, locloc(@$));} |
131 | 3925 |
/* ERROR_CHECK_BEGIN */ |
3926 |
| var1_list array_spec_init |
|
136 | 3927 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and array specification."); yynerrs++;} |
131 | 3928 |
/* 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
|
3929 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3930 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3931 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3932 |
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
|
3933 |
var1_list ':' initialized_structure |
68 | 3934 |
{$$ = new structured_var_init_decl_c($1, $3, locloc(@$));} |
131 | 3935 |
/* ERROR_CHECK_BEGIN */ |
3936 |
| var1_list initialized_structure |
|
136 | 3937 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and structured specification."); yynerrs++;} |
131 | 3938 |
/* 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
|
3939 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3940 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3941 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3942 |
/* 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
|
3943 |
* 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
|
3944 |
* 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
|
3945 |
* 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
|
3946 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3947 |
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
|
3948 |
/* 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
|
3949 |
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
|
3950 |
{$$ = 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
|
3951 |
/*| 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
|
3952 |
| 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
|
3953 |
{$$ = new fb_name_decl_c($1, new fb_spec_init_c($2, $4, locf(@2), locl(@4)), locloc(@$));} |
131 | 3954 |
/* ERROR_CHECK_BEGIN */ |
3955 |
| fb_name_list_with_colon ASSIGN structure_initialization |
|
136 | 3956 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block type name defined in function block declaration with initialization."); yynerrs++;} |
131 | 3957 |
| fb_name_list_with_colon function_block_type_name structure_initialization |
136 | 3958 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':=' missing in function block declaration with initialization."); yynerrs++;} |
131 | 3959 |
| fb_name_list_with_colon function_block_type_name ASSIGN error |
3960 |
{$$ = NULL; |
|
136 | 3961 |
if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no initialization defined in function block declaration.");} |
3962 |
else {print_err_msg(locf(@4), locl(@4), "invalid initialization in function block declaration."); yyclearin;} |
|
131 | 3963 |
yyerrok; |
3964 |
} |
|
3965 |
/* 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
|
3966 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3967 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3968 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3969 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3970 |
/* 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
|
3971 |
* 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
|
3972 |
* 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
|
3973 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3974 |
* 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
|
3975 |
* 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
|
3976 |
* (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
|
3977 |
* 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
|
3978 |
* 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
|
3979 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3980 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3981 |
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
|
3982 |
(* 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
|
3983 |
identifier |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3984 |
{$$ = 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
|
3985 |
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
|
3986 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3987 |
(* | 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
|
3988 |
| 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
|
3989 |
{$$ = $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
|
3990 |
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
|
3991 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3992 |
; |
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 |
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
|
3996 |
var1_list_with_colon |
68 | 3997 |
{$$ = 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
|
3998 |
/* 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
|
3999 |
* 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
|
4000 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4001 |
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
|
4002 |
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
|
4003 |
/* 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
|
4004 |
* 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
|
4005 |
* 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
|
4006 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4007 |
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
|
4008 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4009 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4010 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4011 |
/* 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
|
4012 |
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
|
4013 |
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
|
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 |
// 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
|
4018 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4019 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4020 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4021 |
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
|
4022 |
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
|
4023 |
{$$ = 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
|
4024 |
| 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
|
4025 |
{$$ = 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
|
4026 |
| 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
|
4027 |
{$$ = new output_declarations_c(new non_retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));} |
96 | 4028 |
/* ERROR_CHECK_BEGIN */ |
131 | 4029 |
| VAR_OUTPUT END_VAR |
136 | 4030 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in output variable(s) declaration."); yynerrs++;} |
131 | 4031 |
| VAR_OUTPUT RETAIN END_VAR |
136 | 4032 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive output variable(s) declaration."); yynerrs++;} |
131 | 4033 |
| VAR_OUTPUT NON_RETAIN END_VAR |
136 | 4034 |
{$$ = 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
|
4035 |
| VAR_OUTPUT error var_output_init_decl_list END_VAR |
136 | 4036 |
{$$ = 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
|
4037 |
| VAR_OUTPUT RETAIN error var_output_init_decl_list END_VAR |
136 | 4038 |
{$$ = 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
|
4039 |
| VAR_OUTPUT NON_RETAIN error var_output_init_decl_list END_VAR |
136 | 4040 |
{$$ = 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
|
4041 |
| VAR_OUTPUT var_output_init_decl_list error END_OF_INPUT |
136 | 4042 |
{$$ = 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
|
4043 |
| VAR_OUTPUT RETAIN var_output_init_decl_list error END_OF_INPUT |
136 | 4044 |
{$$ = 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
|
4045 |
| VAR_OUTPUT NON_RETAIN var_output_init_decl_list error END_OF_INPUT |
136 | 4046 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive output variable(s) declaration."); yyerrok;} |
96 | 4047 |
| VAR_OUTPUT error END_VAR |
136 | 4048 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in output variable(s) declaration."); yyerrok;} |
131 | 4049 |
| VAR_OUTPUT RETAIN error END_VAR |
136 | 4050 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive output variable(s) declaration."); yyerrok;} |
131 | 4051 |
| VAR_OUTPUT NON_RETAIN error END_VAR |
136 | 4052 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non-retentive output variable(s) declaration."); yyerrok;} |
96 | 4053 |
/* 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
|
4054 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4055 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
4056 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
4057 |
/* 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
|
4058 |
* 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
|
4059 |
* 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
|
4060 |
* 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
|
4061 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
4062 |
* 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
|
4063 |
*/ |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
4064 |
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
|
4065 |
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
|
4066 |
| 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
|
4067 |
; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
4068 |
|
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
4069 |
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
|
4070 |
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
|
4071 |
{$$ = 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
|
4072 |
| 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
|
4073 |
{$$ = $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
|
4074 |
/* 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
|
4075 |
| 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
|
4076 |
{$$ = $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
|
4077 |
| 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
|
4078 |
{$$ = $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
|
4079 |
/* 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
|
4080 |
; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
4081 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
4082 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
4083 |
/* 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
|
4084 |
* 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
|
4085 |
* 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
|
4086 |
* 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
|
4087 |
* 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
|
4088 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
4089 |
* 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
|
4090 |
*/ |
146
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
4091 |
eno_param_declaration: |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
4092 |
eno_identifier ':' BOOL |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
4093 |
/* 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
|
4094 |
* 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
|
4095 |
*/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
4096 |
{$$ = 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
|
4097 |
/* ERROR_CHECK_BEGIN */ |
207 | 4098 |
| eno_identifier BOOL |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
4099 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in ENO declaration."); yynerrs++;} |
207 | 4100 |
| 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
|
4101 |
{$$ = NULL; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
4102 |
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
|
4103 |
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
|
4104 |
yyerrok; |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
4105 |
} |
eef5e62048c7
Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents:
143
diff
changeset
|
4106 |
/* 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
|
4107 |
; |
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 |
|
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 |
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
|
4111 |
VAR_IN_OUT var_declaration_list END_VAR |
68 | 4112 |
{$$ = new input_output_declarations_c($2, locloc(@$));} |
96 | 4113 |
/* ERROR_CHECK_BEGIN */ |
131 | 4114 |
| VAR_IN_OUT END_VAR |
136 | 4115 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in in_out variable(s) declaration."); yynerrs++;} |
4116 |
| VAR_IN_OUT error var_declaration_list END_VAR |
|
4117 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_IN_OUT' in in_out variable(s) declaration."); yyerrok;} |
|
4118 |
| VAR_IN_OUT var_declaration_list error END_OF_INPUT |
|
4119 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed in_out variable(s) declaration."); yyerrok;} |
|
96 | 4120 |
| VAR_IN_OUT error END_VAR |
136 | 4121 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in in_out variable(s) declaration."); yyerrok;} |
96 | 4122 |
/* 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
|
4123 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4124 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4125 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4126 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4127 |
/* 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
|
4128 |
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
|
4129 |
var_declaration ';' |
68 | 4130 |
{$$ = 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
|
4131 |
| 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
|
4132 |
{$$ = $1; $$->add_element($2);} |
131 | 4133 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4134 |
| error ';' |
136 | 4135 |
{$$ = new var_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid variable(s) declaration."); yyerrok;} |
131 | 4136 |
| var_declaration error |
136 | 4137 |
{$$ = new var_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of variable(s) declaration."); yyerrok;} |
131 | 4138 |
| var_declaration_list var_declaration error |
136 | 4139 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of variable(s) declaration."); yyerrok;} |
133 | 4140 |
| var_declaration_list error ';' |
136 | 4141 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid variable(s) declaration."); yyerrok;} |
131 | 4142 |
| var_declaration_list ';' |
136 | 4143 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after variable(s) declaration."); yynerrs++;} |
131 | 4144 |
/* 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
|
4145 |
; |
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 |
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
|
4149 |
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
|
4150 |
| 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
|
4151 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4152 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4153 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4154 |
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
|
4155 |
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
|
4156 |
| 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
|
4157 |
| 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
|
4158 |
| 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
|
4159 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4160 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4161 |
var1_declaration: |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4162 |
var1_list ':' simple_specification |
68 | 4163 |
{$$ = 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
|
4164 |
| var1_list ':' subrange_specification |
68 | 4165 |
{$$ = 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
|
4166 |
| var1_list ':' enumerated_specification |
68 | 4167 |
{$$ = 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
|
4168 |
| 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
|
4169 |
{$$ = new var1_init_decl_c($1, $3, locloc(@$));} |
131 | 4170 |
/* ERROR_CHECK_BEGIN */ |
4171 |
| var1_list simple_specification |
|
136 | 4172 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and simple specification."); yynerrs++;} |
131 | 4173 |
| var1_list subrange_specification |
136 | 4174 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and subrange specification."); yynerrs++;} |
131 | 4175 |
| var1_list enumerated_specification |
136 | 4176 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and enumerated specification."); yynerrs++;} |
131 | 4177 |
/* 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
|
4178 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4179 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4180 |
|
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 |
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
|
4183 |
var1_list ':' array_specification |
68 | 4184 |
{$$ = new array_var_declaration_c($1, $3, locloc(@$));} |
131 | 4185 |
/* ERROR_CHECK_BEGIN */ |
4186 |
| var1_list array_specification |
|
136 | 4187 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and array specification."); yynerrs++;} |
131 | 4188 |
/* 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
|
4189 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4190 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4191 |
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
|
4192 |
var1_list ':' prev_declared_structure_type_name |
68 | 4193 |
{$$ = new structured_var_declaration_c($1, $3, locloc(@$));} |
131 | 4194 |
/* ERROR_CHECK_BEGIN */ |
4195 |
| var1_list prev_declared_structure_type_name |
|
136 | 4196 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and structured specification."); yynerrs++;} |
131 | 4197 |
/* 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
|
4198 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4199 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4200 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4201 |
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
|
4202 |
VAR var_init_decl_list END_VAR |
68 | 4203 |
{$$ = 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
|
4204 |
| VAR CONSTANT var_init_decl_list END_VAR |
68 | 4205 |
{$$ = new var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));} |
131 | 4206 |
/* ERROR_CHECK_BEGIN */ |
4207 |
| VAR END_VAR |
|
136 | 4208 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in variable(s) declaration."); yynerrs++;} |
131 | 4209 |
| VAR CONSTANT END_VAR |
136 | 4210 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in constant variable(s) declaration."); yynerrs++;} |
131 | 4211 |
| VAR error var_init_decl_list END_VAR |
136 | 4212 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "unexpected token after 'VAR' in variable(s) declaration."); yyerrok;} |
131 | 4213 |
| VAR CONSTANT error var_init_decl_list END_VAR |
136 | 4214 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant variable(s) declaration."); yyerrok;} |
4215 |
| VAR var_init_decl_list error END_OF_INPUT |
|
4216 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed variable(s) declaration."); yyerrok;} |
|
4217 |
| VAR CONSTANT var_init_decl_list error END_OF_INPUT |
|
4218 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant variable(s) declaration."); yyerrok;} |
|
131 | 4219 |
| VAR error END_VAR |
136 | 4220 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in variable(s) declaration."); yyerrok;} |
131 | 4221 |
| VAR CONSTANT error END_VAR |
136 | 4222 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant variable(s) declaration."); yyerrok;} |
131 | 4223 |
/* 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
|
4224 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4225 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4226 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4227 |
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
|
4228 |
VAR RETAIN var_init_decl_list END_VAR |
68 | 4229 |
{$$ = new retentive_var_declarations_c($3, locloc(@$));} |
96 | 4230 |
/* ERROR_CHECK_BEGIN */ |
131 | 4231 |
| VAR RETAIN END_VAR |
136 | 4232 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive variable(s) declaration."); yynerrs++;} |
131 | 4233 |
| VAR RETAIN error var_init_decl_list END_VAR |
136 | 4234 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive variable(s) declaration."); yyerrok;} |
4235 |
| VAR RETAIN var_init_decl_list error END_OF_INPUT |
|
4236 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive variable(s) declaration."); yyerrok;} |
|
96 | 4237 |
| VAR RETAIN error END_VAR |
136 | 4238 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive variable(s) declaration."); yyerrok;} |
96 | 4239 |
/* 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4243 |
located_var_declarations: |
131 | 4244 |
VAR located_var_decl_list END_VAR |
68 | 4245 |
{$$ = 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
|
4246 |
| VAR CONSTANT located_var_decl_list END_VAR |
68 | 4247 |
{$$ = 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
|
4248 |
| VAR RETAIN located_var_decl_list END_VAR |
68 | 4249 |
{$$ = 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
|
4250 |
| VAR NON_RETAIN located_var_decl_list END_VAR |
68 | 4251 |
{$$ = new located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));} |
131 | 4252 |
/* ERROR_CHECK_BEGIN */ |
4253 |
| VAR NON_RETAIN END_VAR |
|
136 | 4254 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in non-retentive located variable(s) declaration."); yynerrs++;} |
131 | 4255 |
| VAR error located_var_decl_list END_VAR |
136 | 4256 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR' in located variable(s) declaration."); yyerrok;} |
131 | 4257 |
| VAR CONSTANT error located_var_decl_list END_VAR |
136 | 4258 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant located variable(s) declaration."); yyerrok;} |
131 | 4259 |
| VAR RETAIN error located_var_decl_list END_VAR |
136 | 4260 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive located variable(s) declaration."); yyerrok;} |
131 | 4261 |
| VAR NON_RETAIN error located_var_decl_list END_VAR |
136 | 4262 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive located variable(s) declaration."); yyerrok;} |
4263 |
| VAR located_var_decl_list error END_OF_INPUT |
|
4264 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed located variable(s) declaration."); yyerrok;} |
|
4265 |
| VAR CONSTANT located_var_decl_list error END_OF_INPUT |
|
4266 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant located variable(s) declaration."); yyerrok;} |
|
4267 |
| VAR RETAIN located_var_decl_list error END_OF_INPUT |
|
4268 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive located variable(s) declaration."); yyerrok;} |
|
4269 |
| VAR NON_RETAIN located_var_decl_list error END_OF_INPUT |
|
4270 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive located variable(s) declaration."); yyerrok;} |
|
131 | 4271 |
| VAR NON_RETAIN error END_VAR |
136 | 4272 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non retentive variable(s) declaration."); yyerrok;} |
131 | 4273 |
/* 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
|
4274 |
; |
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4277 |
/* 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
|
4278 |
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
|
4279 |
located_var_decl ';' |
68 | 4280 |
{$$ = 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
|
4281 |
| 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
|
4282 |
{$$ = $1; $$->add_element($2);} |
131 | 4283 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4284 |
| error ';' |
136 | 4285 |
{$$ = new located_var_decl_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid located variable declaration."); yyerrok;} |
131 | 4286 |
| located_var_decl error |
136 | 4287 |
{$$ = new located_var_decl_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of located variable declaration."); yyerrok;} |
131 | 4288 |
| located_var_decl_list located_var_decl error |
136 | 4289 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of located variable declaration."); yyerrok;} |
133 | 4290 |
| located_var_decl_list error ';' |
136 | 4291 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid located variable declaration."); yyerrok;} |
131 | 4292 |
| located_var_decl_list ';' |
136 | 4293 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after located variable declaration."); yynerrs++;} |
131 | 4294 |
/* 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
|
4295 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4296 |
|
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 |
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
|
4299 |
variable_name location ':' located_var_spec_init |
68 | 4300 |
{$$ = 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
|
4301 |
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
|
4302 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4303 |
| location ':' located_var_spec_init |
68 | 4304 |
{$$ = new located_var_decl_c(NULL, $1, $3, locloc(@$));} |
131 | 4305 |
/* ERROR_CHECK_BEGIN */ |
4306 |
| variable_name location located_var_spec_init |
|
136 | 4307 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between located variable location and specification."); yynerrs++;} |
131 | 4308 |
| location located_var_spec_init |
136 | 4309 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between located variable location and specification."); yynerrs++;} |
131 | 4310 |
| variable_name location ':' error |
4311 |
{$$ = NULL; |
|
136 | 4312 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in located variable declaration.");} |
4313 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in located variable declaration."); yyclearin;} |
|
131 | 4314 |
yyerrok; |
4315 |
} |
|
4316 |
| location ':' error |
|
4317 |
{$$ = NULL; |
|
136 | 4318 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in located variable declaration.");} |
4319 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in located variable declaration."); yyclearin;} |
|
131 | 4320 |
yyerrok; |
4321 |
} |
|
4322 |
/* 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4325 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4326 |
|
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 |
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
|
4329 |
VAR_EXTERNAL external_declaration_list END_VAR |
68 | 4330 |
{$$ = 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
|
4331 |
| VAR_EXTERNAL CONSTANT external_declaration_list END_VAR |
68 | 4332 |
{$$ = new external_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));} |
96 | 4333 |
/* ERROR_CHECK_BEGIN */ |
131 | 4334 |
| VAR_EXTERNAL END_VAR |
136 | 4335 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in external variable(s) declaration."); yynerrs++;} |
131 | 4336 |
| VAR_EXTERNAL CONSTANT END_VAR |
136 | 4337 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in constant external variable(s) declaration."); yynerrs++;} |
131 | 4338 |
| VAR_EXTERNAL error external_declaration_list END_VAR |
136 | 4339 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_EXTERNAL' in external variable(s) declaration."); yyerrok;} |
131 | 4340 |
| VAR_EXTERNAL CONSTANT error external_declaration_list END_VAR |
136 | 4341 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant external variable(s) declaration."); yyerrok;} |
4342 |
| VAR_EXTERNAL external_declaration_list error END_OF_INPUT |
|
4343 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed external variable(s) declaration."); yyerrok;} |
|
4344 |
| VAR_EXTERNAL CONSTANT external_declaration_list error END_OF_INPUT |
|
4345 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant external variable(s) declaration."); yyerrok;} |
|
96 | 4346 |
| VAR_EXTERNAL error END_VAR |
136 | 4347 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in external variable(s) declaration."); yyerrok;} |
131 | 4348 |
| VAR_EXTERNAL CONSTANT error END_VAR |
136 | 4349 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant external variable(s) declaration."); yyerrok;} |
96 | 4350 |
/* 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
|
4351 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4352 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4353 |
/* 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
|
4354 |
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
|
4355 |
external_declaration ';' |
68 | 4356 |
{$$ = new external_declaration_list_c(locloc(@$)); $$->add_element($1);} |
131 | 4357 |
| 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
|
4358 |
{$$ = $1; $$->add_element($2);} |
131 | 4359 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4360 |
| error ';' |
136 | 4361 |
{$$ = new external_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid external variable declaration."); yyerrok;} |
131 | 4362 |
| external_declaration error |
136 | 4363 |
{$$ = new external_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of external variable declaration."); yyerrok;} |
131 | 4364 |
| external_declaration_list external_declaration error |
136 | 4365 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of external variable declaration."); yyerrok;} |
133 | 4366 |
| external_declaration_list error ';' |
136 | 4367 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid external variable declaration."); yyerrok;} |
131 | 4368 |
| external_declaration_list ';' |
136 | 4369 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after external variable declaration."); yynerrs++;} |
131 | 4370 |
/* 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
|
4371 |
; |
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 |
|
963
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4374 |
|
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4375 |
/* Warning: When handling VAR_EXTERNAL declarations, the constant folding algorithm may (depending on the command line parameters) |
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4376 |
* set the symbol_c->const_value annotations on both the external_var_name as well as on its VAR_EXTERNAL datatype specification symbol. |
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4377 |
* Setting the const_value on the datatype specification symbol of a VAR_EXTERNAL declaration is only possible if the declaration of |
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4378 |
* several external variables in a list is not allowed (as each variable could have a potentially distinct initial value). |
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4379 |
* VAR_EXTERNAL |
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4380 |
* a, b, c, d: INT; (* incorrect syntax! *) |
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4381 |
* END_VAR |
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4382 |
* |
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4383 |
* If anybody considers extending this standard syntax to allow the above syntax (several variables in a list), then be sure to go |
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4384 |
* and fix the constant folding algorithm (more precisely, the constant_folding_c::handle_var_extern_global_pair() function. |
e3d4dca7520b
Do constant folding of variable's initial value (allows correct C code generation with variables in the subrange of an array declaration: ARRAY [1..max] of INT).
mjsousa
parents:
961
diff
changeset
|
4385 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4386 |
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
|
4387 |
global_var_name ':' simple_specification |
68 | 4388 |
{$$ = 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
|
4389 |
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
|
4390 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4391 |
| global_var_name ':' subrange_specification |
68 | 4392 |
{$$ = 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
|
4393 |
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
|
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 |
| global_var_name ':' enumerated_specification |
68 | 4396 |
{$$ = 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
|
4397 |
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
|
4398 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4399 |
| global_var_name ':' array_specification |
68 | 4400 |
{$$ = 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
|
4401 |
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
|
4402 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4403 |
| global_var_name ':' prev_declared_structure_type_name |
68 | 4404 |
{$$ = 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
|
4405 |
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
|
4406 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4407 |
| 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
|
4408 |
{$$ = 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
|
4409 |
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
|
4410 |
} |
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
|
4411 |
| 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
|
4412 |
{$$ = 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
|
4413 |
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
|
4414 |
} |
131 | 4415 |
/* ERROR_CHECK_BEGIN */ |
4416 |
| global_var_name simple_specification |
|
136 | 4417 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and simple specification."); yynerrs++;} |
131 | 4418 |
| global_var_name subrange_specification |
136 | 4419 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and subrange specification."); yynerrs++;} |
131 | 4420 |
| global_var_name enumerated_specification |
136 | 4421 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and enumerated specification."); yynerrs++;} |
131 | 4422 |
| global_var_name array_specification |
136 | 4423 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and array specification."); yynerrs++;} |
131 | 4424 |
| global_var_name prev_declared_structure_type_name |
136 | 4425 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and structured specification."); yynerrs++;} |
131 | 4426 |
| global_var_name function_block_type_name |
136 | 4427 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and function block type specification."); yynerrs++;} |
131 | 4428 |
| global_var_name ':' error |
4429 |
{$$ = NULL; |
|
136 | 4430 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in external variable declaration.");} |
4431 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in external variable declaration."); yyclearin;} |
|
131 | 4432 |
yyerrok; |
4433 |
} |
|
4434 |
/* 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
|
4435 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4436 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4437 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4438 |
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
|
4439 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4440 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4441 |
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
|
4442 |
VAR_GLOBAL global_var_decl_list END_VAR |
68 | 4443 |
{$$ = 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
|
4444 |
| VAR_GLOBAL CONSTANT global_var_decl_list END_VAR |
68 | 4445 |
{$$ = 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
|
4446 |
| VAR_GLOBAL RETAIN global_var_decl_list END_VAR |
68 | 4447 |
{$$ = new global_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));} |
96 | 4448 |
/* ERROR_CHECK_BEGIN */ |
131 | 4449 |
| VAR_GLOBAL END_VAR |
136 | 4450 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in global variable(s) declaration."); yynerrs++;} |
131 | 4451 |
| VAR_GLOBAL CONSTANT END_VAR |
136 | 4452 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in constant global variable(s) declaration."); yynerrs++;} |
131 | 4453 |
| VAR_GLOBAL RETAIN END_VAR |
136 | 4454 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive global variable(s) declaration."); yynerrs++;} |
131 | 4455 |
| VAR_GLOBAL error global_var_decl_list END_VAR |
136 | 4456 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_GLOBAL' in global variable(s) declaration."); yyerrok;} |
131 | 4457 |
| VAR_GLOBAL CONSTANT error global_var_decl_list END_VAR |
136 | 4458 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant global variable(s) declaration."); yyerrok;} |
131 | 4459 |
| VAR_GLOBAL RETAIN error global_var_decl_list END_VAR |
136 | 4460 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive global variable(s) declaration."); yyerrok;} |
4461 |
| VAR_GLOBAL global_var_decl_list error END_OF_INPUT |
|
4462 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed global variable(s) declaration."); yyerrok;} |
|
4463 |
| VAR_GLOBAL CONSTANT global_var_decl_list error END_OF_INPUT |
|
4464 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant global variable(s) declaration."); yyerrok;} |
|
4465 |
| VAR_GLOBAL RETAIN global_var_decl_list error END_OF_INPUT |
|
4466 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive global variable(s) declaration."); yyerrok;} |
|
96 | 4467 |
| VAR_GLOBAL error END_VAR |
136 | 4468 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in global variable(s) declaration."); yyerrok;} |
131 | 4469 |
| VAR_GLOBAL CONSTANT error END_VAR |
136 | 4470 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant global variable(s) declaration."); yyerrok;} |
131 | 4471 |
| VAR_GLOBAL RETAIN error END_VAR |
136 | 4472 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant global variable(s) declaration."); yyerrok;} |
96 | 4473 |
/* 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
|
4474 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4475 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4476 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4477 |
/* 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
|
4478 |
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
|
4479 |
global_var_decl ';' |
68 | 4480 |
{$$ = 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
|
4481 |
| 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
|
4482 |
{$$ = $1; $$->add_element($2);} |
131 | 4483 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4484 |
| error ';' |
136 | 4485 |
{$$ = new global_var_decl_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid global variable(s) declaration."); yyerrok;} |
131 | 4486 |
| global_var_decl error |
136 | 4487 |
{$$ = new global_var_decl_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of global variable(s) declaration."); yyerrok;} |
131 | 4488 |
| global_var_decl_list global_var_decl error |
136 | 4489 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "';' missing at end of global variable(s) declaration."); yyerrok;} |
133 | 4490 |
| global_var_decl_list error ';' |
136 | 4491 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid global variable(s) declaration."); yyerrok;} |
131 | 4492 |
| global_var_decl_list ';' |
136 | 4493 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after global variable(s) declaration."); yynerrs++;} |
131 | 4494 |
/* 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4497 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4498 |
global_var_decl: |
131 | 4499 |
/* 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
|
4500 |
global_var_spec ':' |
68 | 4501 |
{$$ = new global_var_decl_c($1, NULL, locloc(@$));} |
131 | 4502 |
*/ |
4503 |
global_var_spec ':' located_var_spec_init |
|
68 | 4504 |
{$$ = 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
|
4505 |
| 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
|
4506 |
{$$ = new global_var_decl_c($1, new fb_spec_init_c($3, NULL, locloc(@3)), locloc(@$));} |
131 | 4507 |
/* ERROR_CHECK_BEGIN */ |
4508 |
| global_var_list located_var_spec_init |
|
136 | 4509 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between global variable list and type specification."); yynerrs++;} |
131 | 4510 |
| global_var_name location located_var_spec_init |
136 | 4511 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between global variable specification and type specification."); yynerrs++;} |
131 | 4512 |
| global_var_spec function_block_type_name |
136 | 4513 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between global variable specification and function block type specification."); yynerrs++;} |
131 | 4514 |
| global_var_spec ':' error |
4515 |
{$$ = NULL; |
|
136 | 4516 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in global variable declaration.");} |
4517 |
else {print_err_msg(locf(@3), locl(@3), "invalid specification in global variable declaration."); yyclearin;} |
|
131 | 4518 |
yyerrok; |
4519 |
} |
|
4520 |
/* 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
|
4521 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4522 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4523 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4524 |
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
|
4525 |
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
|
4526 |
| location |
68 | 4527 |
{$$ = 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
|
4528 |
| global_var_name location |
68 | 4529 |
{$$ = 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
|
4530 |
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
|
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 |
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
|
4536 |
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
|
4537 |
| 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
|
4538 |
| 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
|
4539 |
| 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
|
4540 |
| 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
|
4541 |
| 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
|
4542 |
| 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
|
4543 |
| 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
|
4544 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4545 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4546 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4547 |
location: |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
4548 |
AT direct_variable_token |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
4549 |
{$$ = 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
|
4550 |
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
|
4551 |
} |
131 | 4552 |
/* ERROR_CHECK_BEGIN */ |
4553 |
| AT error |
|
4554 |
{$$ = NULL; |
|
136 | 4555 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no location defined in location declaration.");} |
4556 |
else {print_err_msg(locf(@2), locl(@2), "invalid location in global location declaration."); yyclearin;} |
|
131 | 4557 |
yyerrok; |
4558 |
} |
|
4559 |
/* 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
|
4560 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4561 |
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4564 |
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
|
4565 |
global_var_name |
68 | 4566 |
{$$ = 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
|
4567 |
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
|
4568 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4569 |
| 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
|
4570 |
{$$ = $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
|
4571 |
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
|
4572 |
} |
131 | 4573 |
/* ERROR_CHECK_BEGIN */ |
4574 |
| global_var_list global_var_name |
|
136 | 4575 |
{$$ = new global_var_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "',' missing in global variable list."); yynerrs++;} |
131 | 4576 |
| global_var_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4577 |
{$$ = $1; |
136 | 4578 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no variable name defined in global variable declaration.");} |
4579 |
else {print_err_msg(locf(@3), locl(@3), "invalid variable name in global variable declaration."); yyclearin;} |
|
131 | 4580 |
yyerrok; |
4581 |
} |
|
4582 |
/* 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
|
4583 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4584 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4585 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4586 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4587 |
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
|
4588 |
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
|
4589 |
| 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
|
4590 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4591 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4592 |
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
|
4593 |
var1_list ':' single_byte_string_spec |
68 | 4594 |
{$$ = new single_byte_string_var_declaration_c($1, $3, locloc(@$));} |
131 | 4595 |
/* ERROR_CHECK_BEGIN */ |
4596 |
| var1_list single_byte_string_spec |
|
136 | 4597 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and string type specification."); yynerrs++;} |
131 | 4598 |
/* 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
|
4599 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4600 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4601 |
/* 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
|
4602 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4603 |
* [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
|
4604 |
* and |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4605 |
* [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
|
4606 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4607 |
* 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
|
4608 |
* 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
|
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 |
* 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
|
4611 |
* - 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
|
4612 |
* -> 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
|
4613 |
* |--> 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
|
4614 |
* |--> 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
|
4615 |
* - 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
|
4616 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4617 |
* 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
|
4618 |
* -> 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
|
4619 |
* -> 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
|
4620 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4621 |
* 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
|
4622 |
* -> 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
|
4623 |
* -> 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
|
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 |
* 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
|
4626 |
* -> 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
|
4627 |
* -> 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
|
4628 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4629 |
* 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
|
4630 |
* -> 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
|
4631 |
* -> 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
|
4632 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4633 |
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
|
4634 |
/* STRING |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4635 |
{$$ = 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
|
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 |
STRING '[' integer ']' |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4638 |
{$$ = 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
|
4639 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4640 |
| 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
|
4641 |
{$$ = 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
|
4642 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4643 |
| 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
|
4644 |
{$$ = 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 | 4645 |
/* ERROR_CHECK_BEGIN */ |
4646 |
| STRING '[' error ']' |
|
136 | 4647 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited string type specification."); yyerrok;} |
131 | 4648 |
| STRING '[' error ']' ASSIGN single_byte_character_string |
136 | 4649 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited string type specification."); yyerrok;} |
131 | 4650 |
| STRING '[' ']' |
136 | 4651 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited string type specification."); yynerrs++;} |
131 | 4652 |
| STRING '[' ']' ASSIGN single_byte_character_string |
136 | 4653 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited string type specification."); yynerrs++;} |
131 | 4654 |
| STRING '[' integer error |
136 | 4655 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "expecting ']' after length definition for limited string type specification."); yyerrok;} |
131 | 4656 |
| STRING '[' integer ']' single_byte_character_string |
136 | 4657 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "':=' missing before limited string type initialization."); yynerrs++;} |
131 | 4658 |
| STRING '[' integer ']' ASSIGN error |
4659 |
{$$ = NULL; |
|
136 | 4660 |
if (is_current_syntax_token()) {print_err_msg(locl(@5), locf(@6), "no initial value defined in limited string type initialization.");} |
4661 |
else {print_err_msg(locf(@6), locl(@6), "invalid initial value in limited string type initialization."); yyclearin;} |
|
131 | 4662 |
yyerrok; |
4663 |
} |
|
4664 |
/* 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
|
4665 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4666 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4667 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4668 |
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
|
4669 |
var1_list ':' double_byte_string_spec |
68 | 4670 |
{$$ = new double_byte_string_var_declaration_c($1, $3, locloc(@$));} |
131 | 4671 |
/* ERROR_CHECK_BEGIN */ |
4672 |
| var1_list double_byte_string_spec |
|
136 | 4673 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and double byte string type specification."); yynerrs++;} |
131 | 4674 |
/* 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
|
4675 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4676 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4677 |
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
|
4678 |
/* WSTRING |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4679 |
{$$ = 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
|
4680 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4681 |
WSTRING '[' integer ']' |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4682 |
{$$ = 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
|
4683 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4684 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4685 |
| 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
|
4686 |
{$$ = 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
|
4687 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4688 |
| 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
|
4689 |
{$$ = 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 | 4690 |
/* ERROR_CHECK_BEGIN */ |
4691 |
| WSTRING '[' error ']' |
|
136 | 4692 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited double byte string type specification."); yyerrok;} |
131 | 4693 |
| WSTRING '[' error ']' ASSIGN single_byte_character_string |
136 | 4694 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited double byte string type specification."); yyerrok;} |
131 | 4695 |
| WSTRING '[' ']' |
136 | 4696 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited double byte string type specification."); yynerrs++;} |
131 | 4697 |
| WSTRING '[' ']' ASSIGN single_byte_character_string |
136 | 4698 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited double byte string type specification."); yynerrs++;} |
131 | 4699 |
| WSTRING '[' integer error |
136 | 4700 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "expecting ']' after length definition for limited double byte string type specification."); yyerrok;} |
131 | 4701 |
| WSTRING '[' integer ']' single_byte_character_string |
136 | 4702 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "':=' missing before limited double byte string type initialization."); yynerrs++;} |
131 | 4703 |
| WSTRING '[' integer ']' ASSIGN error |
4704 |
{$$ = NULL; |
|
136 | 4705 |
if (is_current_syntax_token()) {print_err_msg(locl(@5), locf(@6), "no initial value defined double byte in limited string type initialization.");} |
4706 |
else {print_err_msg(locf(@6), locl(@6), "invalid initial value in limited double byte string type initialization."); yyclearin;} |
|
131 | 4707 |
yyerrok; |
4708 |
} |
|
4709 |
/* 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
|
4710 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4711 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4712 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4713 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4714 |
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
|
4715 |
VAR incompl_located_var_decl_list END_VAR |
68 | 4716 |
{$$ = 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
|
4717 |
| VAR RETAIN incompl_located_var_decl_list END_VAR |
68 | 4718 |
{$$ = 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
|
4719 |
| VAR NON_RETAIN incompl_located_var_decl_list END_VAR |
68 | 4720 |
{$$ = new incompl_located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));} |
131 | 4721 |
/* ERROR_CHECK_BEGIN */ |
136 | 4722 |
| VAR incompl_located_var_decl_list error END_OF_INPUT |
4723 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed incomplete located variable(s) declaration."); yyerrok;} |
|
4724 |
| VAR RETAIN incompl_located_var_decl_list error END_OF_INPUT |
|
4725 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed incomplete retentive located variable(s) declaration."); yyerrok;} |
|
4726 |
| VAR NON_RETAIN incompl_located_var_decl_list error END_OF_INPUT |
|
4727 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed incomplete non-retentive located variable(s) declaration."); yyerrok;} |
|
131 | 4728 |
| VAR error incompl_located_var_decl_list END_VAR |
136 | 4729 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR' in incomplete located variable(s) declaration."); yyerrok;} |
131 | 4730 |
| VAR RETAIN error incompl_located_var_decl_list END_VAR |
136 | 4731 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive located variable(s) declaration."); yyerrok;} |
131 | 4732 |
| VAR NON_RETAIN error incompl_located_var_decl_list END_VAR |
136 | 4733 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive located variable(s) declaration."); yyerrok;} |
131 | 4734 |
/* 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
|
4735 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4736 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4737 |
/* 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
|
4738 |
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
|
4739 |
incompl_located_var_decl ';' |
68 | 4740 |
{$$ = 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
|
4741 |
| 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
|
4742 |
{$$ = $1; $$->add_element($2);} |
131 | 4743 |
/* ERROR_CHECK_BEGIN */ |
4744 |
| incompl_located_var_decl error |
|
136 | 4745 |
{$$ = 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 | 4746 |
| incompl_located_var_decl_list incompl_located_var_decl error |
136 | 4747 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of incomplete located variable declaration."); yyerrok;} |
133 | 4748 |
| incompl_located_var_decl_list error ';' |
136 | 4749 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid incomplete located variable declaration."); yyerrok;} |
131 | 4750 |
| incompl_located_var_decl_list ';' |
136 | 4751 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after incomplete located variable declaration."); yynerrs++;} |
131 | 4752 |
/* 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
|
4753 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4754 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4755 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4756 |
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
|
4757 |
variable_name incompl_location ':' var_spec |
68 | 4758 |
{$$ = new incompl_located_var_decl_c($1, $2, $4, locloc(@$));} |
131 | 4759 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
4760 |
| variable_name incompl_location var_spec |
136 | 4761 |
{$$ = 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
|
4762 |
} |
131 | 4763 |
| variable_name incompl_location ':' error |
4764 |
{$$ = NULL; |
|
136 | 4765 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in incomplete located variable declaration.");} |
4766 |
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
|
4767 |
yyerrok; |
131 | 4768 |
} |
4769 |
/* 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
|
4770 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4771 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4772 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4773 |
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
|
4774 |
AT incompl_location_token |
68 | 4775 |
{$$ = 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
|
4776 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4777 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4778 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4779 |
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
|
4780 |
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
|
4781 |
| 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
|
4782 |
| 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
|
4783 |
| 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
|
4784 |
| 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
|
4785 |
| 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
|
4786 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4787 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4788 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4789 |
/* 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
|
4790 |
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
|
4791 |
/* STRING |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4792 |
{$$ = 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
|
4793 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4794 |
STRING '[' integer ']' |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4795 |
{$$ = 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
|
4796 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4797 |
| WSTRING |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4798 |
{$$ = 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
|
4799 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4800 |
| WSTRING '[' integer ']' |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4801 |
{$$ = 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4804 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4805 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4806 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4807 |
/* 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
|
4808 |
* - 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
|
4809 |
* - 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
|
4810 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4811 |
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
|
4812 |
var_init_decl ';' |
68 | 4813 |
{$$ = 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
|
4814 |
| 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
|
4815 |
{$$ = $1; $$->add_element($2);} |
131 | 4816 |
/* ERROR_CHECK_BEGIN */ |
4817 |
| var_init_decl_list var_init_decl error |
|
136 | 4818 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of variable(s) declaration."); yyerrok;} |
133 | 4819 |
| var_init_decl_list error ';' |
136 | 4820 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid variable(s) declaration."); yyerrok;} |
131 | 4821 |
/* 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
|
4822 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4823 |
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4826 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4827 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4828 |
/* 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
|
4829 |
/***********************/ |
68 | 4830 |
/* |
4831 |
function_name: |
|
4832 |
prev_declared_derived_function_name |
|
4833 |
| standard_function_name |
|
4834 |
; |
|
4835 |
*/ |
|
4836 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4837 |
/* 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
|
4838 |
* 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
|
4839 |
* 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
|
4840 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4841 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4842 |
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
|
4843 |
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
|
4844 |
//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
|
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 |
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
|
4847 |
//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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4850 |
/* 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
|
4851 |
* 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
|
4852 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4853 |
* 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
|
4854 |
* 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
|
4855 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4856 |
* 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
|
4857 |
* 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
|
4858 |
* 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
|
4859 |
* 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
|
4860 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4861 |
* 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
|
4862 |
* 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
|
4863 |
* 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
|
4864 |
* 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
|
4865 |
* 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
|
4866 |
* 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
|
4867 |
* 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
|
4868 |
* 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
|
4869 |
* 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
|
4870 |
* 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
|
4871 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4872 |
* 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
|
4873 |
* 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
|
4874 |
* 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
|
4875 |
* 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
|
4876 |
* 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
|
4877 |
* 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
|
4878 |
* 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
|
4879 |
* 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
|
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 |
* 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
|
4882 |
* 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
|
4883 |
* 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
|
4884 |
* |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
4885 |
* 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
|
4886 |
* 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
|
4887 |
* 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
|
4888 |
* 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
|
4889 |
* 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
|
4890 |
* 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
|
4891 |
* 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
|
4892 |
* 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
|
4893 |
* 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
|
4894 |
* 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
|
4895 |
* 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
|
4896 |
* 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
|
4897 |
* 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
|
4898 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4899 |
/* 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
|
4900 |
* 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
|
4901 |
* 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
|
4902 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4903 |
|
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 |
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
|
4906 |
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
|
4907 |
| 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
|
4908 |
| 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
|
4909 |
//| 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
|
4910 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4911 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4912 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4913 |
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
|
4914 |
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
|
4915 |
| 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
|
4916 |
//| 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
|
4917 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4918 |
|
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4919 |
/* standard_function_name_no_clashes is only used in function invocations, so we use the poutype_identifier_c class! */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4920 |
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
|
4921 |
standard_function_name_token |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4922 |
{$$ = new poutype_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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4926 |
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
|
4927 |
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
|
4928 |
//| 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
|
4929 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4930 |
|
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4931 |
/* standard_function_name_NOT_clashes is only used in function invocations, so we use the poutype_identifier_c class! */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4932 |
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
|
4933 |
NOT |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4934 |
{$$ = new poutype_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
|
4935 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4936 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4937 |
/* 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
|
4938 |
* 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
|
4939 |
* 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
|
4940 |
* - 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
|
4941 |
* - 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
|
4942 |
* - 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
|
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 |
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
|
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 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4948 |
|
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4949 |
/* standard_function_name_expression_clashes is only used in function invocations, so we use the poutype_identifier_c class! */ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4950 |
standard_function_name_expression_clashes: |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4951 |
AND {$$ = new poutype_identifier_c(strdup("AND"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4952 |
| OR {$$ = new poutype_identifier_c(strdup("OR"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4953 |
| XOR {$$ = new poutype_identifier_c(strdup("XOR"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4954 |
| ADD {$$ = new poutype_identifier_c(strdup("ADD"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4955 |
| SUB {$$ = new poutype_identifier_c(strdup("SUB"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4956 |
| MUL {$$ = new poutype_identifier_c(strdup("MUL"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4957 |
| DIV {$$ = new poutype_identifier_c(strdup("DIV"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4958 |
| MOD {$$ = new poutype_identifier_c(strdup("MOD"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4959 |
| GT {$$ = new poutype_identifier_c(strdup("GT"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4960 |
| GE {$$ = new poutype_identifier_c(strdup("GE"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4961 |
| EQ {$$ = new poutype_identifier_c(strdup("EQ"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4962 |
| LT {$$ = new poutype_identifier_c(strdup("LT"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4963 |
| LE {$$ = new poutype_identifier_c(strdup("LE"), locloc(@$));} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4964 |
| NE {$$ = new poutype_identifier_c(strdup("NE"), locloc(@$));} |
91 | 4965 |
/* |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4966 |
AND_operator {$$ = il_operator_c_2_poutype_identifier_c($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
|
4967 |
//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
|
4968 |
// with a standard function name, so should be commented out! |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4969 |
//| AND2_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4970 |
| OR_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4971 |
| XOR_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4972 |
| ADD_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4973 |
| SUB_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4974 |
| MUL_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4975 |
| DIV_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4976 |
| MOD_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4977 |
| GT_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4978 |
| GE_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4979 |
| EQ_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4980 |
| LT_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4981 |
| LE_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4982 |
| NE_operator {$$ = il_operator_c_2_poutype_identifier_c($1);} |
91 | 4983 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4984 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4985 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4986 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4987 |
derived_function_name: |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
4988 |
identifier /* will never occur during normal parsing, only needed for preparsing to change it to a prev_declared_derived_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
|
4989 |
| prev_declared_derived_function_name |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
4990 |
{$$ = new identifier_c(((token_c *)$1)->value, locloc(@$)); // transform the poutype_identifier_c into an identifier_c |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
4991 |
if (get_preparse_state() && !allow_function_overloading) {print_err_msg(locloc(@$), "Function overloading not allowed. Invalid identifier.\n"); yynerrs++;} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
4992 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4993 |
| AND |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4994 |
{$$ = new identifier_c("AND", locloc(@$)); |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
4995 |
if (!allow_function_overloading) {print_err_msg(locloc(@$), "Function overloading not allowed. Invalid identifier.\n"); yynerrs++;} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4996 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4997 |
| OR |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
4998 |
{$$ = new identifier_c("OR", locloc(@$)); |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
4999 |
if (!allow_function_overloading) {print_err_msg(locloc(@$), "Function overloading not allowed. Invalid identifier.\n"); yynerrs++;} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
5000 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
5001 |
| XOR |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
5002 |
{$$ = new identifier_c("XOR", locloc(@$)); |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5003 |
if (!allow_function_overloading) {print_err_msg(locloc(@$), "Function overloading not allowed. Invalid identifier.\n"); yynerrs++;} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
5004 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
5005 |
| NOT |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
5006 |
{$$ = new identifier_c("NOT", locloc(@$)); |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5007 |
if (!allow_function_overloading) {print_err_msg(locloc(@$), "Function overloading not allowed. Invalid identifier.\n"); yynerrs++;} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
5008 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
5009 |
| MOD |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
5010 |
{$$ = new identifier_c("MOD", locloc(@$)); |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5011 |
if (!allow_function_overloading) {print_err_msg(locloc(@$), "Function overloading not allowed. Invalid identifier.\n"); yynerrs++;} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
5012 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5013 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5014 |
|
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 |
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
|
5017 |
/* FUNCTION derived_function_name ':' elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5018 |
/* PRE_PARSING: The rules expected to be applied by the preparser. */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5019 |
FUNCTION derived_function_name END_FUNCTION /* rule that is only expected to be used during preparse state => MUST print an error if used outside preparse() state!! */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5020 |
{$$ = NULL; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5021 |
if (get_preparse_state()) {library_element_symtable.insert($2, prev_declared_derived_function_name_token);} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5022 |
else {print_err_msg(locl(@1), locf(@3), "FUNCTION with no variable declarations and no body."); yynerrs++;} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5023 |
} |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
5024 |
/* POST_PARSING and STANDARD_PARSING: The rules expected to be applied after the preparser has finished. */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5025 |
| function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION |
68 | 5026 |
{$$ = new function_declaration_c($1, $3, $4, $5, locloc(@$)); |
1012
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
5027 |
if (!runtime_options.disable_implicit_en_eno) 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
|
5028 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5029 |
direct_variable_symtable.pop(); |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5030 |
library_element_symtable.insert($1, prev_declared_derived_function_name_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
|
5031 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5032 |
/* | 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
|
5033 |
| function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION |
68 | 5034 |
{$$ = new function_declaration_c($1, $3, $4, $5, locloc(@$)); |
1012
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
5035 |
if (!runtime_options.disable_implicit_en_eno) 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
|
5036 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5037 |
direct_variable_symtable.pop(); |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5038 |
library_element_symtable.insert($1, prev_declared_derived_function_name_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
|
5039 |
} |
1014
a61f8f58f612
Add support for non-standard VOID datatype. May ony be used to define functions returning VOID.
mjsousa
parents:
1012
diff
changeset
|
5040 |
/* | FUNCTION derived_function_name ':' VOID io_OR_function_var_declarations_list function_body END_FUNCTION */ |
a61f8f58f612
Add support for non-standard VOID datatype. May ony be used to define functions returning VOID.
mjsousa
parents:
1012
diff
changeset
|
5041 |
| function_name_declaration ':' VOID io_OR_function_var_declarations_list function_body END_FUNCTION |
1016
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5042 |
{$$ = new function_declaration_c($1, new void_type_name_c(locloc(@3)), $4, $5, locloc(@$)); |
1014
a61f8f58f612
Add support for non-standard VOID datatype. May ony be used to define functions returning VOID.
mjsousa
parents:
1012
diff
changeset
|
5043 |
if (!runtime_options.disable_implicit_en_eno) add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */ |
a61f8f58f612
Add support for non-standard VOID datatype. May ony be used to define functions returning VOID.
mjsousa
parents:
1012
diff
changeset
|
5044 |
variable_name_symtable.pop(); |
a61f8f58f612
Add support for non-standard VOID datatype. May ony be used to define functions returning VOID.
mjsousa
parents:
1012
diff
changeset
|
5045 |
direct_variable_symtable.pop(); |
a61f8f58f612
Add support for non-standard VOID datatype. May ony be used to define functions returning VOID.
mjsousa
parents:
1012
diff
changeset
|
5046 |
library_element_symtable.insert($1, prev_declared_derived_function_name_token); |
a61f8f58f612
Add support for non-standard VOID datatype. May ony be used to define functions returning VOID.
mjsousa
parents:
1012
diff
changeset
|
5047 |
} |
68 | 5048 |
/* ERROR_CHECK_BEGIN */ |
131 | 5049 |
| function_name_declaration elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION |
136 | 5050 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after function name in function declaration."); yynerrs++;} |
131 | 5051 |
| function_name_declaration derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION |
136 | 5052 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after function name in function declaration."); yynerrs++;} |
131 | 5053 |
| function_name_declaration ':' io_OR_function_var_declarations_list function_body END_FUNCTION |
136 | 5054 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no return type defined in function declaration."); yynerrs++;} |
131 | 5055 |
| function_name_declaration ':' error io_OR_function_var_declarations_list function_body END_FUNCTION |
136 | 5056 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid return type defined in function declaration."); yyerrok;} |
131 | 5057 |
| function_name_declaration ':' elementary_type_name function_body END_FUNCTION |
136 | 5058 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared in function declaration."); yynerrs++;} |
131 | 5059 |
| function_name_declaration ':' derived_type_name function_body END_FUNCTION |
136 | 5060 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared in function declaration."); yynerrs++;} |
131 | 5061 |
| function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list END_FUNCTION |
136 | 5062 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no body defined in function declaration."); yynerrs++;} |
131 | 5063 |
| function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list END_FUNCTION |
136 | 5064 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no body defined in function declaration."); yynerrs++;} |
131 | 5065 |
| function_name_declaration ':' elementary_type_name END_FUNCTION |
136 | 5066 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared and body defined in function declaration."); yynerrs++;} |
131 | 5067 |
| function_name_declaration ':' derived_type_name END_FUNCTION |
136 | 5068 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared and body defined in function declaration."); yynerrs++;} |
5069 |
| function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list function_body END_OF_INPUT |
|
5070 |
{$$ = NULL; print_err_msg(locf(@1), locf(@3), "unclosed function declaration."); yynerrs++;} |
|
5071 |
| function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list function_body END_OF_INPUT |
|
5072 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed function declaration."); yynerrs++;} |
|
131 | 5073 |
| function_name_declaration error END_FUNCTION |
136 | 5074 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in function declaration."); yyerrok;} |
68 | 5075 |
/* ERROR_CHECK_END */ |
5076 |
; |
|
5077 |
||
5078 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5079 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5080 |
/* 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
|
5081 |
/* 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
|
5082 |
* 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
|
5083 |
* 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
|
5084 |
* 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
|
5085 |
* 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
|
5086 |
* 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
|
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 |
* 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
|
5089 |
* 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
|
5090 |
* 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
|
5091 |
* 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
|
5092 |
* 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
|
5093 |
* 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
|
5094 |
* 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
|
5095 |
* 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
|
5096 |
* 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
|
5097 |
* 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
|
5098 |
* 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
|
5099 |
* 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
|
5100 |
* 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
|
5101 |
* 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
|
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 |
* 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
|
5104 |
* 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
|
5105 |
* 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
|
5106 |
* 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
|
5107 |
* 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
|
5108 |
* 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
|
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 |
function_name_declaration: |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5111 |
/* FUNCTION derived_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
|
5112 |
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
|
5113 |
{$$ = $2; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5114 |
/* 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
|
5115 |
* 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
|
5116 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5117 |
* 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
|
5118 |
* 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
|
5119 |
* 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
|
5120 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5121 |
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
|
5122 |
} |
131 | 5123 |
/* ERROR_CHECK_BEGIN */ |
5124 |
| FUNCTION error |
|
5125 |
{$$ = NULL; |
|
136 | 5126 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no function name defined in function declaration.");} |
5127 |
else {print_err_msg(locf(@2), locl(@2), "invalid function name in function declaration."); yyclearin;} |
|
131 | 5128 |
yyerrok; |
5129 |
} |
|
5130 |
/* 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
|
5131 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5132 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5133 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5134 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5135 |
/* 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
|
5136 |
io_OR_function_var_declarations_list: |
131 | 5137 |
io_var_declarations |
5138 |
{$$ = new var_declarations_list_c(locloc(@1));$$->add_element($1);} |
|
5139 |
| function_var_decls |
|
5140 |
{$$ = 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
|
5141 |
| 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
|
5142 |
{$$ = $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
|
5143 |
| 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
|
5144 |
{$$ = $1; $$->add_element($2);} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5145 |
/* ERROR_CHECK_BEGIN */ |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5146 |
| io_OR_function_var_declarations_list retentive_var_declarations |
136 | 5147 |
{$$ = $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
|
5148 |
| io_OR_function_var_declarations_list located_var_declarations |
136 | 5149 |
{$$ = $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
|
5150 |
| io_OR_function_var_declarations_list external_var_declarations |
136 | 5151 |
{$$ = $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
|
5152 |
| io_OR_function_var_declarations_list global_var_declarations |
136 | 5153 |
{$$ = $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
|
5154 |
| io_OR_function_var_declarations_list incompl_located_var_declarations |
136 | 5155 |
{$$ = $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
|
5156 |
| io_OR_function_var_declarations_list temp_var_decls |
136 | 5157 |
{$$ = $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
|
5158 |
| io_OR_function_var_declarations_list non_retentive_var_decls |
136 | 5159 |
{$$ = $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
|
5160 |
/*| io_OR_function_var_declarations_list access_declarations |
136 | 5161 |
{$$ = $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
|
5162 |
| io_OR_function_var_declarations_list instance_specific_initializations |
136 | 5163 |
{$$ = $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
|
5164 |
/* 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
|
5165 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5166 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5167 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5168 |
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
|
5169 |
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
|
5170 |
| 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
|
5171 |
| 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
|
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 |
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
|
5176 |
VAR CONSTANT var2_init_decl_list END_VAR |
68 | 5177 |
{$$ = 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
|
5178 |
| VAR var2_init_decl_list END_VAR |
68 | 5179 |
{$$ = new function_var_decls_c(NULL, $2, locloc(@$));} |
131 | 5180 |
/* ERROR_CHECK_BEGIN */ |
136 | 5181 |
| VAR error var2_init_decl_list END_VAR |
5182 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR' in function variable(s) declaration."); yyerrok;} |
|
5183 |
| VAR CONSTANT error var2_init_decl_list END_VAR |
|
5184 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant function variable(s) declaration."); yyerrok;} |
|
5185 |
| VAR var2_init_decl_list error END_OF_INPUT |
|
5186 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed function variable(s) declaration."); yyerrok;} |
|
5187 |
| VAR CONSTANT var2_init_decl_list error END_OF_INPUT |
|
5188 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant function variable(s) declaration."); yyerrok;} |
|
131 | 5189 |
/* 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5192 |
/* 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
|
5193 |
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
|
5194 |
var2_init_decl ';' |
68 | 5195 |
{$$ = 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
|
5196 |
| 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
|
5197 |
{$$ = $1; $$->add_element($2);} |
131 | 5198 |
/* ERROR_CHECK_BEGIN */ |
5199 |
| var2_init_decl error |
|
136 | 5200 |
{$$ = new var2_init_decl_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of function variable(s) declaration."); yyerrok;} |
131 | 5201 |
| var2_init_decl_list var2_init_decl error |
136 | 5202 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of function variable(s) declaration."); yyerrok;} |
133 | 5203 |
| var2_init_decl_list error ';' |
136 | 5204 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid function variable(s) declaration."); yyerrok;} |
131 | 5205 |
| var2_init_decl_list ';' |
136 | 5206 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after function variable(s) declaration."); yynerrs++;} |
131 | 5207 |
/* 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5211 |
function_body: |
1016
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5212 |
start_ST_body_token statement_list {$$ = $2;} |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5213 |
| start_IL_body_token instruction_list {$$ = $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
|
5214 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5215 |
| 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
|
5216 |
| 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
|
5217 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5218 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5219 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5220 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5221 |
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
|
5222 |
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
|
5223 |
| 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
|
5224 |
| 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
|
5225 |
| 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
|
5226 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5227 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5228 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5229 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5230 |
/*****************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5231 |
/* 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
|
5232 |
/*****************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5233 |
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
|
5234 |
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
|
5235 |
| 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
|
5236 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5237 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5238 |
|
68 | 5239 |
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
|
5240 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5241 |
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
|
5242 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5243 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5244 |
function_block_declaration: |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5245 |
/* PRE_PARSING: The rules expected to be applied by the preparser. Will only run if pre-parsing command line option is ON. */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5246 |
FUNCTION_BLOCK derived_function_block_name END_FUNCTION_BLOCK /* rule that is only expected to be used during preparse state => MUST print an error if used outside preparse() state!! */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5247 |
{$$ = NULL; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5248 |
if (get_preparse_state()) {library_element_symtable.insert($2, prev_declared_derived_function_block_name_token);} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5249 |
else {print_err_msg(locl(@1), locf(@3), "FUNCTION_BLOCK with no variable declarations and no body."); yynerrs++;} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5250 |
} |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5251 |
/* POST_PARSING: The rules expected to be applied after the preparser runs. Will only run if pre-parsing command line option is ON. */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5252 |
| FUNCTION_BLOCK prev_declared_derived_function_block_name io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK |
68 | 5253 |
{$$ = new function_block_declaration_c($2, $3, $4, locloc(@$)); |
1012
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
5254 |
if (!runtime_options.disable_implicit_en_eno) add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */ |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5255 |
/* Clear the variable_name_symtable. Since we have finished parsing the function block, |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5256 |
* the variable names are now out of scope, so are no longer valid! |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5257 |
*/ |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5258 |
variable_name_symtable.pop(); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5259 |
direct_variable_symtable.pop(); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5260 |
} |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5261 |
/* STANDARD_PARSING: The rules expected to be applied in single-phase parsing. Will only run if pre-parsing command line option is OFF. */ |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5262 |
| FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5263 |
{$$ = new function_block_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
|
5264 |
library_element_symtable.insert($2, prev_declared_derived_function_block_name_token); |
1012
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
5265 |
if (!runtime_options.disable_implicit_en_eno) add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */ |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5266 |
/* Clear the variable_name_symtable. Since we have finished parsing the function block, |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5267 |
* the variable names are now out of scope, so are no longer valid! |
0
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 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5270 |
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
|
5271 |
} |
68 | 5272 |
/* ERROR_CHECK_BEGIN */ |
131 | 5273 |
| FUNCTION_BLOCK io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK |
136 | 5274 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in function block declaration."); yynerrs++;} |
131 | 5275 |
| FUNCTION_BLOCK error io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK |
136 | 5276 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name in function block declaration."); yyerrok;} |
131 | 5277 |
| FUNCTION_BLOCK derived_function_block_name function_block_body END_FUNCTION_BLOCK |
136 | 5278 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared in function declaration."); yynerrs++;} |
131 | 5279 |
| FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list END_FUNCTION_BLOCK |
136 | 5280 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no body defined in function block declaration."); yynerrs++;} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5281 |
/* Rule already covered by the rule to handle the preparse state! |
131 | 5282 |
| FUNCTION_BLOCK derived_function_block_name END_FUNCTION_BLOCK |
136 | 5283 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared and body defined in function block declaration."); yynerrs++;} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5284 |
*/ |
136 | 5285 |
| FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list function_block_body END_OF_INPUT |
1016
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5286 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "expecting END_FUNCTION_BLOCK before end of file."); yynerrs++;} |
68 | 5287 |
| FUNCTION_BLOCK error END_FUNCTION_BLOCK |
136 | 5288 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in function block declaration."); yyerrok;} |
68 | 5289 |
/* 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
|
5290 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5291 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5292 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5293 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5294 |
/* 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
|
5295 |
/* { 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
|
5296 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5297 |
* 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
|
5298 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5299 |
io_OR_other_var_declarations_list: |
131 | 5300 |
io_var_declarations |
5301 |
{$$ = new var_declarations_list_c(locloc(@$));$$->add_element($1);} |
|
5302 |
| other_var_declarations |
|
5303 |
{$$ = 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
|
5304 |
| 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
|
5305 |
{$$ = $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
|
5306 |
| 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
|
5307 |
{$$ = $1; $$->add_element($2);} |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5308 |
/* ERROR_CHECK_BEGIN */ |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5309 |
| io_OR_other_var_declarations_list located_var_declarations |
136 | 5310 |
{$$ = $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
|
5311 |
| io_OR_other_var_declarations_list global_var_declarations |
136 | 5312 |
{$$ = $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
|
5313 |
/*| io_OR_other_var_declarations_list access_declarations |
136 | 5314 |
{$$ = $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
|
5315 |
| io_OR_other_var_declarations_list instance_specific_initializations |
136 | 5316 |
{$$ = $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
|
5317 |
/* 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
|
5318 |
; |
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 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5321 |
* 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
|
5322 |
* 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
|
5323 |
* 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
|
5324 |
* | 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
|
5325 |
* | 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
|
5326 |
* | 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
|
5327 |
* | 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
|
5328 |
* | 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
|
5329 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5330 |
* 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
|
5331 |
* 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
|
5332 |
* 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
|
5333 |
* 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
|
5334 |
* 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
|
5335 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5336 |
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
|
5337 |
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
|
5338 |
| 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
|
5339 |
| 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
|
5340 |
| 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
|
5341 |
| 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
|
5342 |
| 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
|
5343 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5344 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5345 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5346 |
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
|
5347 |
VAR_TEMP temp_var_decls_list END_VAR |
68 | 5348 |
{$$ = new temp_var_decls_c($2, locloc(@$));} |
131 | 5349 |
/* ERROR_CHECK_BEGIN */ |
5350 |
| VAR_TEMP END_VAR |
|
136 | 5351 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in temporary variable(s) declaration."); yynerrs++;} |
5352 |
| VAR_TEMP temp_var_decls_list error END_OF_INPUT |
|
5353 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "unclosed temporary variable(s) declaration."); yyerrok;} |
|
131 | 5354 |
| VAR_TEMP error temp_var_decls_list END_VAR |
136 | 5355 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_TEMP' in function variable(s) declaration."); yyerrok;} |
131 | 5356 |
/* 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
|
5357 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5358 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5359 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5360 |
/* 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
|
5361 |
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
|
5362 |
temp_var_decl ';' |
68 | 5363 |
{$$ = 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
|
5364 |
| 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
|
5365 |
{$$ = $1; $$->add_element($2);} |
131 | 5366 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5367 |
| error ';' |
136 | 5368 |
{$$ = new temp_var_decls_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid temporary variable(s) declaration."); yyerrok;} |
131 | 5369 |
| temp_var_decl error |
136 | 5370 |
{$$ = new temp_var_decls_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of temporary variable(s) declaration."); yyerrok;} |
131 | 5371 |
| temp_var_decls_list temp_var_decl error |
136 | 5372 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of temporary variable(s) declaration."); yyerrok;} |
133 | 5373 |
| temp_var_decls_list error ';' |
136 | 5374 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid temporary variable(s) declaration."); yyerrok;} |
131 | 5375 |
| temp_var_decls_list ';' |
136 | 5376 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after temporary variable(s) declaration."); yynerrs++;} |
131 | 5377 |
/* 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
|
5378 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5379 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5380 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5381 |
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
|
5382 |
VAR NON_RETAIN var_init_decl_list END_VAR |
68 | 5383 |
{$$ = new non_retentive_var_decls_c($3, locloc(@$));} |
131 | 5384 |
/* ERROR_CHECK_BEGIN */ |
136 | 5385 |
| VAR NON_RETAIN var_init_decl_list error END_OF_INPUT |
5386 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unclosed non-retentive temporary variable(s) declaration."); yyerrok;} |
|
131 | 5387 |
| VAR NON_RETAIN error var_init_decl_list END_VAR |
136 | 5388 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive temporary variable(s) declaration."); yyerrok;} |
131 | 5389 |
/* 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
|
5390 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5391 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5392 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5393 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5394 |
function_block_body: |
1016
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5395 |
/* NOTE: start_ST_body_token is a dummy token generated by flex when it determines it is starting to parse a POU body in ST |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5396 |
* start_IL_body_token is a dummy token generated by flex when it determines it is starting to parse a POU body in IL |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5397 |
* These tokens help remove a reduce/reduce conflict in bison, between a formal function invocation in IL, and a |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5398 |
* function invocation used as a statement (a non-standard extension added to matiec) |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5399 |
* e.g: FUNCTION_BLOCK foo |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5400 |
* VAR ... END_VAR |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5401 |
* func_returning_void(in1 := 3 |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5402 |
* ); --> only the presence or absence of ';' will determine whether this is a IL or ST |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5403 |
* function invocation. (In standard ST this would be ilegal, in matiec we allow it |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5404 |
* when activated by a command line option) |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5405 |
* END_FUNCTION |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5406 |
*/ |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5407 |
start_ST_body_token statement_list {$$ = $2;} |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5408 |
| start_IL_body_token instruction_list {$$ = $2;} |
91bef6704b44
Add support for functions returning VOID (i.e. non-standard extension, allowing functions that do not return any data)
mjsousa
parents:
1014
diff
changeset
|
5409 |
| 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
|
5410 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5411 |
| 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
|
5412 |
| 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
|
5413 |
| <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
|
5414 |
*/ |
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5417 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5418 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5419 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5420 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5421 |
/* 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
|
5422 |
/**********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5423 |
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
|
5424 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5425 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5426 |
program_declaration: |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5427 |
/* PRE_PARSING: The rules expected to be applied by the preparser. Will only run if pre-parsing command line option is ON. */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5428 |
PROGRAM program_type_name END_PROGRAM /* rule that is only expected to be used during preparse state => MUST print an error if used outside preparse() state!! */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5429 |
{$$ = NULL; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5430 |
if (get_preparse_state()) {library_element_symtable.insert($2, prev_declared_program_type_name_token);} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5431 |
else {print_err_msg(locl(@1), locf(@3), "PROGRAM with no variable declarations and no body."); yynerrs++;} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5432 |
} |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5433 |
/* POST_PARSING: The rules expected to be applied after the preparser runs. Will only run if pre-parsing command line option is ON. */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5434 |
| PROGRAM prev_declared_program_type_name program_var_declarations_list function_block_body END_PROGRAM |
68 | 5435 |
{$$ = new program_declaration_c($2, $3, $4, locloc(@$)); |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5436 |
/* Clear the variable_name_symtable. Since we have finished parsing the program declaration, |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5437 |
* the variable names are now out of scope, so are no longer valid! |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5438 |
*/ |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5439 |
variable_name_symtable.pop(); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5440 |
direct_variable_symtable.pop(); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5441 |
} |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5442 |
/* STANDARD_PARSING: The rules expected to be applied in single-phase parsing. Will only run if pre-parsing command line option is OFF. */ |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5443 |
| PROGRAM program_type_name {library_element_symtable.insert($2, prev_declared_program_type_name_token);} program_var_declarations_list function_block_body END_PROGRAM |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5444 |
{$$ = new program_declaration_c($2, $4, $5, locloc(@$)); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5445 |
/* Clear the variable_name_symtable. Since we have finished parsing the program declaration, |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5446 |
* the variable names are now out of scope, so are no longer valid! |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5447 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5448 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5449 |
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
|
5450 |
} |
68 | 5451 |
/* ERROR_CHECK_BEGIN */ |
131 | 5452 |
| PROGRAM program_var_declarations_list function_block_body END_PROGRAM |
136 | 5453 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no program name defined in program declaration.");} |
131 | 5454 |
| PROGRAM error program_var_declarations_list function_block_body END_PROGRAM |
136 | 5455 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid program name in program declaration."); yyerrok;} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5456 |
| PROGRAM prev_declared_program_type_name function_block_body END_PROGRAM |
136 | 5457 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared in program declaration."); yynerrs++;} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5458 |
| PROGRAM prev_declared_program_type_name program_var_declarations_list END_PROGRAM |
136 | 5459 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no body defined in program declaration."); yynerrs++;} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5460 |
/* Rule already covered by the rule to handle the preparse state! |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5461 |
| PROGRAM prev_declared_program_type_name END_PROGRAM |
136 | 5462 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared and body defined in program declaration."); yynerrs++;} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5463 |
*/ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5464 |
| PROGRAM prev_declared_program_type_name program_var_declarations_list function_block_body END_OF_INPUT |
136 | 5465 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed program declaration."); yynerrs++;} |
68 | 5466 |
| PROGRAM error END_PROGRAM |
136 | 5467 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in program declaration."); yyerrok;} |
68 | 5468 |
/* 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
|
5469 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5470 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5471 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5472 |
/* 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
|
5473 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5474 |
* 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
|
5475 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5476 |
program_var_declarations_list: |
131 | 5477 |
io_var_declarations |
5478 |
{$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);} |
|
5479 |
| other_var_declarations |
|
5480 |
{$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);} |
|
5481 |
| located_var_declarations |
|
5482 |
{$$ = 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
|
5483 |
| 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
|
5484 |
{$$ = $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
|
5485 |
| 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
|
5486 |
{$$ = $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
|
5487 |
| 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
|
5488 |
{$$ = $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
|
5489 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5490 |
| 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
|
5491 |
{$$ = $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
|
5492 |
*/ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5493 |
/* ERROR_CHECK_BEGIN */ |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5494 |
| program_var_declarations_list global_var_declarations |
136 | 5495 |
{$$ = $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
|
5496 |
/*| program_var_declarations_list access_declarations |
136 | 5497 |
{$$ = $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
|
5498 |
| program_var_declarations_list instance_specific_initializations |
136 | 5499 |
{$$ = $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
|
5500 |
} |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5501 |
/* 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
|
5502 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5503 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5504 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5505 |
/* TODO ... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5506 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5507 |
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
|
5508 |
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
|
5509 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5510 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5511 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5512 |
/* 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
|
5513 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5514 |
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
|
5515 |
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
|
5516 |
| 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
|
5517 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5518 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5519 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5520 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5521 |
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
|
5522 |
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
|
5523 |
| 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
|
5524 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5525 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5526 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5527 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5528 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5529 |
/********************************************/ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5530 |
/* B 1.6 Sequential Function Chart elements * |
3 | 5531 |
/********************************************/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5532 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5533 |
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
|
5534 |
sfc_network |
68 | 5535 |
{$$ = 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
|
5536 |
| sequential_function_chart sfc_network |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5537 |
{$$ = $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
|
5538 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5539 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5540 |
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
|
5541 |
initial_step |
68 | 5542 |
{$$ = 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
|
5543 |
| sfc_network step |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5544 |
{$$ = $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
|
5545 |
| sfc_network transition |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5546 |
{$$ = $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
|
5547 |
| sfc_network action |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5548 |
{$$ = $1; $$->add_element($2);} |
131 | 5549 |
/* ERROR_CHECK_BEGIN */ |
5550 |
| sfc_network error |
|
136 | 5551 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "unexpected token after SFC network in sequencial function chart."); yyerrok;} |
131 | 5552 |
/* 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
|
5553 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5554 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5555 |
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
|
5556 |
INITIAL_STEP step_name ':' action_association_list END_STEP |
13 | 5557 |
// 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
|
5558 |
{$$ = 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
|
5559 |
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
|
5560 |
} |
131 | 5561 |
/* ERROR_CHECK_BEGIN */ |
5562 |
| INITIAL_STEP ':' action_association_list END_STEP |
|
136 | 5563 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "no step name defined in initial step declaration."); yynerrs++;} |
131 | 5564 |
| INITIAL_STEP error ':' action_association_list END_STEP |
136 | 5565 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid step name defined in initial step declaration."); yyerrok;} |
131 | 5566 |
| INITIAL_STEP step_name action_association_list END_STEP |
136 | 5567 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':' missing after step name in initial step declaration."); yynerrs++;} |
131 | 5568 |
| INITIAL_STEP step_name ':' error END_STEP |
136 | 5569 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid action association list in initial step declaration."); yyerrok;} |
5570 |
| INITIAL_STEP step_name ':' action_association_list END_OF_INPUT |
|
5571 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed initial step declaration."); yynerrs++;} |
|
131 | 5572 |
| INITIAL_STEP error END_STEP |
136 | 5573 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in initial step declaration."); yyerrok;} |
131 | 5574 |
/* 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5577 |
step: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5578 |
STEP step_name ':' action_association_list END_STEP |
13 | 5579 |
// 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
|
5580 |
{$$ = 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
|
5581 |
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
|
5582 |
} |
131 | 5583 |
/* ERROR_CHECK_BEGIN */ |
5584 |
| STEP ':' action_association_list END_STEP |
|
136 | 5585 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no step name defined in step declaration."); yynerrs++;} |
131 | 5586 |
| STEP error ':' action_association_list END_STEP |
136 | 5587 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid step name defined in step declaration."); yyerrok;} |
131 | 5588 |
| STEP step_name action_association_list END_STEP |
136 | 5589 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':' missing after step name in step declaration."); yynerrs++;} |
131 | 5590 |
| STEP step_name ':' error END_STEP |
136 | 5591 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid action association list in step declaration."); yyerrok;} |
5592 |
| STEP step_name ':' action_association_list END_OF_INPUT |
|
5593 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "invalid action association list in step declaration."); yynerrs++;} |
|
131 | 5594 |
| STEP error END_STEP |
136 | 5595 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in step declaration."); yyerrok;} |
131 | 5596 |
/* 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
|
5597 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5598 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5599 |
/* 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
|
5600 |
* - 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
|
5601 |
* - step |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5602 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5603 |
action_association_list: |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5604 |
/* empty */ |
68 | 5605 |
{$$ = 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
|
5606 |
| action_association_list action_association ';' |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5607 |
{$$ = $1; $$->add_element($2);} |
131 | 5608 |
/* ERROR_CHECK_BEGIN */ |
5609 |
| action_association_list action_association error |
|
136 | 5610 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of action association declaration."); yyerrok;} |
131 | 5611 |
| action_association_list ';' |
136 | 5612 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after action association declaration."); yynerrs++;} |
131 | 5613 |
/* ERROR_CHECK_END */ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5614 |
; |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5615 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5616 |
|
13 | 5617 |
// step_name: identifier; |
5618 |
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
|
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 |
action_association: |
295
e7ce7c6bbb5d
Adding missing semicolons.
Mario de Sousa <msousa@fe.up.pt>
parents:
287
diff
changeset
|
5621 |
action_name '(' {cmd_goto_sfc_qualifier_state();} action_qualifier {cmd_pop_state();} indicator_name_list ')' |
68 | 5622 |
{$$ = new action_association_c($1, $4, $6, locloc(@$));} |
131 | 5623 |
/* ERROR_CHECK_BEGIN */ |
136 | 5624 |
/*| action_name '(' error ')' |
5625 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid qualifier defined in action association."); yyerrok;}*/ |
|
131 | 5626 |
/* ERROR_CHECK_END */ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5627 |
; |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5628 |
|
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5629 |
/* 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
|
5630 |
indicator_name_list: |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5631 |
/* empty */ |
68 | 5632 |
{$$ = 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
|
5633 |
| indicator_name_list ',' indicator_name |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5634 |
{$$ = $1; $$->add_element($3);} |
131 | 5635 |
/* ERROR_CHECK_BEGIN */ |
5636 |
| indicator_name_list indicator_name |
|
136 | 5637 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing at end of action association declaration."); yynerrs++;} |
131 | 5638 |
| indicator_name_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5639 |
{$$ = $1; |
136 | 5640 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no indicator defined in indicator list.");} |
5641 |
else {print_err_msg(locf(@3), locl(@3), "invalid indicator in indicator list."); yyclearin;} |
|
131 | 5642 |
yyerrok; |
5643 |
} |
|
5644 |
/* 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
|
5645 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5646 |
|
13 | 5647 |
// action_name: identifier; |
5648 |
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
|
5649 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5650 |
action_qualifier: |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5651 |
/* empty */ |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5652 |
{$$ = NULL;} |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5653 |
| qualifier |
68 | 5654 |
{$$ = 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
|
5655 |
| timed_qualifier ',' action_time |
68 | 5656 |
{$$ = new action_qualifier_c($1, $3, locloc(@$));} |
131 | 5657 |
/* ERROR_CHECK_BEGIN */ |
5658 |
| timed_qualifier action_time |
|
136 | 5659 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "',' missing between timed qualifier and action time in action qualifier."); yynerrs++;} |
131 | 5660 |
| timed_qualifier ',' error |
5661 |
{$$ = NULL; |
|
136 | 5662 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no action time defined in action qualifier.");} |
5663 |
else {print_err_msg(locf(@3), locl(@3), "invalid action time in action qualifier."); yyclearin;} |
|
131 | 5664 |
yyerrok; |
5665 |
} |
|
5666 |
/* ERROR_CHECK_END */ |
|
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5667 |
; |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5668 |
|
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5669 |
qualifier: |
94 | 5670 |
N {$$ = new qualifier_c(strdup("N"), locloc(@$));} |
68 | 5671 |
| R {$$ = new qualifier_c(strdup("R"), locloc(@$));} |
5672 |
| S {$$ = new qualifier_c(strdup("S"), locloc(@$));} |
|
5673 |
| 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
|
5674 |
| 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
|
5675 |
| 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
|
5676 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5677 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5678 |
timed_qualifier: |
94 | 5679 |
L {$$ = new timed_qualifier_c(strdup("L"), locloc(@$));} |
68 | 5680 |
| D {$$ = new timed_qualifier_c(strdup("D"), locloc(@$));} |
5681 |
| SD {$$ = new timed_qualifier_c(strdup("SD"), locloc(@$));} |
|
5682 |
| DS {$$ = new timed_qualifier_c(strdup("DS"), locloc(@$));} |
|
5683 |
| 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
|
5684 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5685 |
|
616
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5686 |
/* 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
|
5687 |
* 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
|
5688 |
* 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
|
5689 |
* 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
|
5690 |
* 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
|
5691 |
* 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
|
5692 |
* 'variable' is previously 'declared'. |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5693 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5694 |
* 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
|
5695 |
* 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
|
5696 |
* e.g. |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5697 |
* ... |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5698 |
* STEP step1: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5699 |
* action1 (D,t#100ms); |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5700 |
* end_step |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5701 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5702 |
* STEP step2: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5703 |
* 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
|
5704 |
* end_step |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5705 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5706 |
* STEP step3: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5707 |
* 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
|
5708 |
* end_step |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5709 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5710 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5711 |
* 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
|
5712 |
* 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
|
5713 |
* 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
|
5714 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5715 |
* 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
|
5716 |
* (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
|
5717 |
* Time literal, or a variable. |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5718 |
* 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
|
5719 |
* action_time: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5720 |
* duration |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5721 |
* | variable |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5722 |
* ; |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5723 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5724 |
* to: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5725 |
* action_time: |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5726 |
* duration |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5727 |
* | any_symbolic_variable |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5728 |
* ; |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5729 |
* |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5730 |
* 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
|
5731 |
* 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
|
5732 |
*/ |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5733 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5734 |
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
|
5735 |
duration |
616
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5736 |
//| variable |
0c7663fdc8d3
Aloow use of SFC STEPs as variables.
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
5737 |
| any_symbolic_variable |
10 | 5738 |
; |
5739 |
||
5740 |
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
|
5741 |
|
13 | 5742 |
// transition_name: identifier; |
5743 |
transition_name: any_identifier; |
|
5744 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5745 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5746 |
steps: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5747 |
step_name |
68 | 5748 |
{$$ = 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
|
5749 |
| '(' step_name_list ')' |
68 | 5750 |
{$$ = new steps_c(NULL, $2, locloc(@$));} |
131 | 5751 |
/* ERROR_CHECK_BEGIN */ |
5752 |
| '(' step_name_list error |
|
136 | 5753 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "expecting ')' at the end of step list in transition declaration."); yyerrok;} |
131 | 5754 |
| '(' error ')' |
136 | 5755 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid step list in transition declaration."); yyerrok;} |
131 | 5756 |
/* ERROR_CHECK_END */ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5757 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5758 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5759 |
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
|
5760 |
step_name ',' step_name |
68 | 5761 |
{$$ = 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
|
5762 |
| step_name_list ',' step_name |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5763 |
{$$ = $1; $$->add_element($3);} |
131 | 5764 |
/* ERROR_CHECK_BEGIN */ |
5765 |
| step_name_list step_name |
|
136 | 5766 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in step list."); yynerrs++;} |
131 | 5767 |
| step_name_list ',' error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5768 |
{$$ = $1; |
136 | 5769 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no step name defined in step list.");} |
5770 |
else {print_err_msg(locf(@3), locl(@3), "invalid step name in step list."); yyclearin;} |
|
131 | 5771 |
yyerrok; |
5772 |
} |
|
5773 |
/* ERROR_CHECK_END */ |
|
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5774 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5775 |
|
13 | 5776 |
|
85 | 5777 |
/* NOTE: flex will automatically pop() out of body_state to previous state. |
94 | 5778 |
* We do not need to give a command from bison to return to previous flex state, |
5779 |
* after forcing flex to go to body_state. |
|
85 | 5780 |
*/ |
5781 |
transition: |
|
131 | 5782 |
TRANSITION transition_priority |
85 | 5783 |
FROM steps TO steps |
5784 |
{cmd_goto_body_state();} transition_condition |
|
5785 |
END_TRANSITION |
|
131 | 5786 |
{$$ = new transition_c(NULL, $2, $4, $6, $8, locloc(@$));} |
85 | 5787 |
//| TRANSITION identifier FROM steps TO steps ... |
131 | 5788 |
| TRANSITION transition_name transition_priority |
85 | 5789 |
FROM steps TO steps |
5790 |
{cmd_goto_body_state();} transition_condition |
|
5791 |
END_TRANSITION |
|
131 | 5792 |
{$$ = new transition_c($2, $3, $5, $7, $9, locloc(@$));} |
5793 |
/* ERROR_CHECK_BEGIN */ |
|
5794 |
| TRANSITION error transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
|
136 | 5795 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid transition name defined in transition declaration."); yyerrok;} |
131 | 5796 |
| TRANSITION transition_name error FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5797 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid transition priority defined in transition declaration."); yyerrok;} |
131 | 5798 |
| TRANSITION transition_priority FROM TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5799 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no origin step(s) defined in transition declaration."); yynerrs++;} |
131 | 5800 |
| TRANSITION transition_name transition_priority FROM TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5801 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no origin step(s) defined in transition declaration."); yynerrs++;} |
131 | 5802 |
| TRANSITION transition_priority FROM error TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5803 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid origin step(s) defined in transition declaration."); yyerrok;} |
131 | 5804 |
| TRANSITION transition_name transition_priority FROM error TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5805 |
{$$ = NULL; print_err_msg(locf(@5), locl(@5), "invalid origin step(s) defined in transition declaration."); yyerrok;} |
131 | 5806 |
| TRANSITION transition_priority FROM steps steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5807 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "'TO' missing between origin step(s) and destination step(s) in transition declaration."); yynerrs++;} |
131 | 5808 |
| TRANSITION transition_name transition_priority FROM steps steps {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5809 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "'TO' missing between origin step(s) and destination step(s) in transition declaration."); yynerrs++;} |
131 | 5810 |
| TRANSITION transition_priority FROM steps TO {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5811 |
{$$ = NULL; print_err_msg(locl(@5), locf(@7), "no destination step(s) defined in transition declaration."); yynerrs++;} |
131 | 5812 |
| TRANSITION transition_name transition_priority FROM steps TO {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5813 |
{$$ = NULL; print_err_msg(locl(@6), locf(@8), "no destination step(s) defined in transition declaration."); yynerrs++;} |
131 | 5814 |
| TRANSITION transition_priority FROM steps TO error {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5815 |
{$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid destination step(s) defined in transition declaration."); yyerrok;} |
131 | 5816 |
| TRANSITION transition_name transition_priority FROM steps TO error {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5817 |
{$$ = NULL; print_err_msg(locf(@7), locl(@7), "invalid destination step(s) defined in transition declaration."); yyerrok;} |
131 | 5818 |
| TRANSITION transition_priority {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5819 |
{$$ = NULL; print_err_msg(locl(@2), locf(@4), "no origin and destination step(s) defined in transition declaration."); yynerrs++;} |
131 | 5820 |
| TRANSITION transition_name transition_priority {cmd_goto_body_state();} transition_condition END_TRANSITION |
136 | 5821 |
{$$ = NULL; print_err_msg(locl(@3), locf(@5), "no origin and destination step(s) defined in transition declaration."); yynerrs++;} |
5822 |
/*| TRANSITION transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition error END_OF_INPUT |
|
5823 |
{$$ = NULL; print_err_msg(locf(@1), locl(@6), "unclosed transition declaration."); yyerrok;} |
|
5824 |
| TRANSITION transition_name transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition error END_OF_INPUT |
|
5825 |
{$$ = NULL; print_err_msg(locf(@1), locl(@7), "unclosed transition declaration."); yyerrok;}*/ |
|
131 | 5826 |
| TRANSITION error END_TRANSITION |
136 | 5827 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in transition declaration."); yyerrok;} |
131 | 5828 |
/* ERROR_CHECK_END */ |
5829 |
; |
|
5830 |
||
5831 |
transition_priority: |
|
5832 |
/* empty */ |
|
5833 |
{$$ = NULL;} |
|
5834 |
| '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')' |
|
5835 |
{$$ = $6;} |
|
547
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
5836 |
/* ERROR_CHECK_BEGIN */ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
5837 |
/* 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
|
5838 |
/* |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
5839 |
| '(' ASSIGN integer ')' |
136 | 5840 |
{$$ = 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
|
5841 |
| '(' error ASSIGN integer ')' |
136 | 5842 |
{$$ = 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
|
5843 |
*/ |
dab341e80664
Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents:
520
diff
changeset
|
5844 |
/* ERROR_CHECK_END */ |
131 | 5845 |
; |
85 | 5846 |
|
5847 |
||
5848 |
transition_condition: |
|
1031
ce026aee03e0
fix compilation of SFC transitions written in IL (compiler was entering endless loop)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1019
diff
changeset
|
5849 |
start_IL_body_token ':' eol_list simple_instr_list |
ce026aee03e0
fix compilation of SFC transitions written in IL (compiler was entering endless loop)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1019
diff
changeset
|
5850 |
{$$ = new transition_condition_c($4, NULL, locloc(@$));} |
85 | 5851 |
| ASSIGN expression ';' |
88 | 5852 |
{$$ = new transition_condition_c(NULL, $2, locloc(@$));} |
131 | 5853 |
/* ERROR_CHECK_BEGIN */ |
1031
ce026aee03e0
fix compilation of SFC transitions written in IL (compiler was entering endless loop)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1019
diff
changeset
|
5854 |
| start_IL_body_token eol_list simple_instr_list |
1032 | 5855 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':' missing before IL condition in transition declaration."); yynerrs++;} |
1031
ce026aee03e0
fix compilation of SFC transitions written in IL (compiler was entering endless loop)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1019
diff
changeset
|
5856 |
| start_IL_body_token ':' eol_list error |
131 | 5857 |
{$$ = NULL; |
1032 | 5858 |
if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no instructions defined in IL condition of transition declaration.");} |
5859 |
else {print_err_msg(locf(@4), locl(@4), "invalid instructions in IL condition of transition declaration."); yyclearin;} |
|
131 | 5860 |
yyerrok; |
5861 |
} |
|
5862 |
| ASSIGN ';' |
|
136 | 5863 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no expression defined in ST condition of transition declaration."); yynerrs++;} |
131 | 5864 |
| ASSIGN error ';' |
136 | 5865 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid expression defined in ST condition of transition declaration."); yyerrok;} |
131 | 5866 |
| ASSIGN expression error |
136 | 5867 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "expecting ';' after expression defined in ST condition of transition declaration."); yyerrok;} |
131 | 5868 |
/* ERROR_CHECK_END */ |
10 | 5869 |
; |
3 | 5870 |
|
68 | 5871 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5872 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5873 |
action: |
85 | 5874 |
// ACTION identifier ':' ... |
151 | 5875 |
ACTION action_name {cmd_goto_body_state();} action_body END_ACTION |
5876 |
{$$ = new action_c($2, $4, locloc(@$));} |
|
5877 |
/* ERROR_CHECK_BEGIN */ |
|
5878 |
| ACTION {cmd_goto_body_state();} action_body END_ACTION |
|
5879 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "no action name defined in action declaration."); yynerrs++;} |
|
5880 |
| ACTION error {cmd_goto_body_state();} action_body END_ACTION |
|
136 | 5881 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid action name defined in action declaration."); yyerrok;} |
131 | 5882 |
| ACTION action_name {cmd_goto_body_state();} function_block_body END_ACTION |
136 | 5883 |
{$$ = NULL; print_err_msg(locl(@2), locf(@4), "':' missing after action name in action declaration."); yynerrs++;} |
151 | 5884 |
/*| ACTION action_name {cmd_goto_body_state();} action_body END_OF_INPUT |
5885 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed action declaration."); yyerrok;}*/ |
|
131 | 5886 |
| ACTION error END_ACTION |
136 | 5887 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in action declaration."); yyerrok;} |
131 | 5888 |
/* ERROR_CHECK_END */ |
1
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5889 |
; |
5d893a68be6e
Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents:
0
diff
changeset
|
5890 |
|
151 | 5891 |
action_body: |
5892 |
':' function_block_body |
|
5893 |
{$$ = $2;} |
|
5894 |
/* ERROR_CHECK_BEGIN */ |
|
5895 |
| ':' error |
|
5896 |
{$$ = NULL; |
|
5897 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no body defined in action declaration.");} |
|
5898 |
else {print_err_msg(locf(@2), locl(@2), "invalid body defined in action declaration."); yyclearin;} |
|
5899 |
yyerrok; |
|
5900 |
} |
|
5901 |
/* ERROR_CHECK_END */ |
|
5902 |
; |
|
5903 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5904 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5905 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5906 |
/* 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
|
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 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5909 |
* 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
|
5910 |
* 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
|
5911 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5912 |
* 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
|
5913 |
* 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
|
5914 |
* 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
|
5915 |
* 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
|
5916 |
* 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
|
5917 |
* 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
|
5918 |
* 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
|
5919 |
* 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
|
5920 |
* 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
|
5921 |
* 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
|
5922 |
* 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
|
5923 |
* 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
|
5924 |
* 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
|
5925 |
* 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
|
5926 |
* 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
|
5927 |
* 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
|
5928 |
* 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
|
5929 |
* 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
|
5930 |
* the resource names that need to be distinguished into a |
131 | 5931 |
* 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
|
5932 |
* 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
|
5933 |
* 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
|
5934 |
* 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
|
5935 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5936 |
* 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
|
5937 |
* 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
|
5938 |
* 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
|
5939 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5940 |
* 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
|
5941 |
* 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
|
5942 |
*/ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5943 |
prev_declared_global_var_name: prev_declared_global_var_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5944 |
prev_declared_resource_name: prev_declared_resource_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5945 |
prev_declared_program_name: prev_declared_program_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5946 |
prev_declared_configuration_name: prev_declared_configuration_name_token {$$ = new identifier_c($1, locloc(@$));}; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5947 |
// 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5951 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5952 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5953 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5954 |
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
|
5955 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5956 |
/* 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
|
5957 |
* 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
|
5958 |
* 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
|
5959 |
* 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
|
5960 |
* 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
|
5961 |
* 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
|
5962 |
* 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
|
5963 |
* 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
|
5964 |
* 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
|
5965 |
* 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
|
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 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5968 |
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
|
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 |
configuration_declaration: |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5971 |
/* PRE_PARSING: The rules expected to be applied by the preparser. Will only run if pre-parsing command line option is ON. */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5972 |
CONFIGURATION configuration_name END_CONFIGURATION /* rule that is only expected to be used during preparse state */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5973 |
{$$ = NULL; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5974 |
if (get_preparse_state()) {library_element_symtable.insert($2, prev_declared_configuration_name_token);} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5975 |
else {print_err_msg(locl(@1), locf(@3), "no resource(s) nor program(s) defined in configuration declaration."); yynerrs++;} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5976 |
} |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
5977 |
/* POST_PARSING: The rules expected to be applied after the preparser runs. Will only run if pre-parsing command line option is ON. */ |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5978 |
| CONFIGURATION prev_declared_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
|
5979 |
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
|
5980 |
single_resource_declaration |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5981 |
{variable_name_symtable.pop(); |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5982 |
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
|
5983 |
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
|
5984 |
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
|
5985 |
END_CONFIGURATION |
68 | 5986 |
{$$ = 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
|
5987 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5988 |
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
|
5989 |
} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
5990 |
| CONFIGURATION prev_declared_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
|
5991 |
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
|
5992 |
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
|
5993 |
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
|
5994 |
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
|
5995 |
END_CONFIGURATION |
68 | 5996 |
{$$ = 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
|
5997 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
5998 |
direct_variable_symtable.pop(); |
85 | 5999 |
} |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6000 |
/* STANDARD_PARSING: The rules expected to be applied in single-phase parsing. Will only run if pre-parsing command line option is OFF. */ |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6001 |
| CONFIGURATION configuration_name |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6002 |
global_var_declarations_list |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6003 |
single_resource_declaration |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6004 |
{variable_name_symtable.pop(); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6005 |
direct_variable_symtable.pop();} |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6006 |
optional_access_declarations |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6007 |
optional_instance_specific_initializations |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6008 |
END_CONFIGURATION |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6009 |
{$$ = new configuration_declaration_c($2, $3, $4, $6, $7, locloc(@$)); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6010 |
variable_name_symtable.pop(); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6011 |
direct_variable_symtable.pop(); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6012 |
library_element_symtable.insert($2, prev_declared_configuration_name_token); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6013 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6014 |
| 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
|
6015 |
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
|
6016 |
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
|
6017 |
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
|
6018 |
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
|
6019 |
END_CONFIGURATION |
68 | 6020 |
{$$ = 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
|
6021 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6022 |
direct_variable_symtable.pop(); |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
6023 |
library_element_symtable.insert($2, prev_declared_configuration_name_token); |
85 | 6024 |
} |
68 | 6025 |
/* ERROR_CHECK_BEGIN */ |
131 | 6026 |
| 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
|
6027 |
global_var_declarations_list |
131 | 6028 |
single_resource_declaration |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6029 |
{variable_name_symtable.pop(); |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6030 |
direct_variable_symtable.pop();} |
131 | 6031 |
optional_access_declarations |
6032 |
optional_instance_specific_initializations |
|
6033 |
END_CONFIGURATION |
|
136 | 6034 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no configuration name defined in configuration declaration."); yynerrs++;} |
131 | 6035 |
| 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
|
6036 |
global_var_declarations_list |
131 | 6037 |
resource_declaration_list |
6038 |
optional_access_declarations |
|
6039 |
optional_instance_specific_initializations |
|
6040 |
END_CONFIGURATION |
|
136 | 6041 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no configuration name defined in configuration declaration."); yynerrs++;} |
131 | 6042 |
| 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
|
6043 |
global_var_declarations_list |
131 | 6044 |
single_resource_declaration |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6045 |
{variable_name_symtable.pop(); |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6046 |
direct_variable_symtable.pop();} |
131 | 6047 |
optional_access_declarations |
6048 |
optional_instance_specific_initializations |
|
6049 |
END_CONFIGURATION |
|
136 | 6050 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid configuration name defined in configuration declaration."); yyerrok;} |
131 | 6051 |
| 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
|
6052 |
global_var_declarations_list |
131 | 6053 |
resource_declaration_list |
6054 |
optional_access_declarations |
|
6055 |
optional_instance_specific_initializations |
|
6056 |
END_CONFIGURATION |
|
136 | 6057 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid configuration name defined in configuration declaration."); yyerrok;} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
6058 |
/* Rule already covered by the rule to handle the preparse state! |
131 | 6059 |
| 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
|
6060 |
global_var_declarations_list |
131 | 6061 |
optional_access_declarations |
6062 |
optional_instance_specific_initializations |
|
6063 |
END_CONFIGURATION |
|
136 | 6064 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no resource(s) defined in configuration declaration."); yynerrs++;} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
6065 |
*/ |
131 | 6066 |
| 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
|
6067 |
global_var_declarations_list |
131 | 6068 |
error |
6069 |
optional_access_declarations |
|
6070 |
optional_instance_specific_initializations |
|
6071 |
END_CONFIGURATION |
|
136 | 6072 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid resource(s) defined in configuration declaration."); yyerrok;} |
6073 |
/*| 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
|
6074 |
global_var_declarations_list |
136 | 6075 |
single_resource_declaration |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6076 |
{variable_name_symtable.pop(); |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6077 |
direct_variable_symtable.pop();} |
136 | 6078 |
optional_access_declarations |
6079 |
optional_instance_specific_initializations |
|
6080 |
END_OF_INPUT |
|
6081 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed configuration declaration."); yyerrok;}*/ |
|
6082 |
| 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
|
6083 |
global_var_declarations_list |
136 | 6084 |
resource_declaration_list |
6085 |
optional_access_declarations |
|
6086 |
optional_instance_specific_initializations |
|
6087 |
END_OF_INPUT |
|
6088 |
{$$ = 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
|
6089 |
| CONFIGURATION error END_CONFIGURATION |
136 | 6090 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in configuration declaration."); yyerrok;} |
68 | 6091 |
/* 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
|
6092 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6093 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6094 |
// 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
|
6095 |
// - 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
|
6096 |
// - 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
|
6097 |
// |
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
|
6098 |
/* 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
|
6099 |
* 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
|
6100 |
* '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
|
6101 |
* |
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
|
6102 |
* 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
|
6103 |
* 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
|
6104 |
* 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
|
6105 |
* 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
|
6106 |
* 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
|
6107 |
* 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
|
6108 |
* 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
|
6109 |
* 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
|
6110 |
* '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
|
6111 |
* |
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
|
6112 |
* 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
|
6113 |
* {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
|
6114 |
* [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
|
6115 |
*/ |
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
|
6116 |
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
|
6117 |
// 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
|
6118 |
{$$ = 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
|
6119 |
| 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
|
6120 |
{$$ = $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
|
6121 |
; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6122 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6123 |
// 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
|
6124 |
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
|
6125 |
// empty |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6126 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6127 |
//| 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
|
6128 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6129 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6130 |
// 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
|
6131 |
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
|
6132 |
// empty |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6133 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6134 |
| 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
|
6135 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6136 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6137 |
// 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
|
6138 |
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
|
6139 |
resource_declaration |
68 | 6140 |
{$$ = 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
|
6141 |
| 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
|
6142 |
{$$ = $1; $$->add_element($2);} |
131 | 6143 |
/* ERROR_CHECK_BEGIN */ |
6144 |
| resource_declaration_list error |
|
136 | 6145 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected token after resource declaration."); yyerrok;} |
131 | 6146 |
/* 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
|
6147 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6148 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6149 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6150 |
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
|
6151 |
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
|
6152 |
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
|
6153 |
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
|
6154 |
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
|
6155 |
{$$ = new resource_declaration_c($3, $6, $7, $8, locloc(@$)); |
13 | 6156 |
variable_name_symtable.pop(); |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6157 |
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
|
6158 |
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
|
6159 |
} |
131 | 6160 |
/* ERROR_CHECK_BEGIN */ |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6161 |
| 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
|
6162 |
global_var_declarations_list |
131 | 6163 |
single_resource_declaration |
6164 |
END_RESOURCE |
|
136 | 6165 |
{$$ = 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
|
6166 |
/*| 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
|
6167 |
global_var_declarations_list |
136 | 6168 |
single_resource_declaration |
6169 |
END_OF_INPUT |
|
6170 |
{$$ = NULL; print_err_msg(locf(@1), locl(@5), "unclosed resource declaration."); yyerrok;}*/ |
|
131 | 6171 |
| RESOURCE error END_RESOURCE |
136 | 6172 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in resource declaration."); yyerrok;} |
131 | 6173 |
/* 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6176 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6177 |
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
|
6178 |
task_configuration_list program_configuration_list |
68 | 6179 |
{$$ = 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6182 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6183 |
// 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
|
6184 |
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
|
6185 |
// empty |
68 | 6186 |
{$$ = 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
|
6187 |
| 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
|
6188 |
{$$ = $1; $$->add_element($2);} |
131 | 6189 |
/* ERROR_CHECK_BEGIN */ |
6190 |
| task_configuration_list task_configuration error |
|
136 | 6191 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "';' missing at the end of task configuration in resource declaration."); yyerrok;} |
131 | 6192 |
| task_configuration_list ';' |
136 | 6193 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after task configuration in resource declaration."); yynerrs++;} |
131 | 6194 |
/* 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
|
6195 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6196 |
|
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 |
// 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
|
6199 |
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
|
6200 |
program_configuration ';' |
68 | 6201 |
{$$ = 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
|
6202 |
| 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
|
6203 |
{$$ = $1; $$->add_element($2);} |
131 | 6204 |
/* ERROR_CHECK_BEGIN */ |
6205 |
| program_configuration error |
|
136 | 6206 |
{$$ = 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 | 6207 |
| program_configuration_list program_configuration error |
136 | 6208 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at the end of program configuration in resource declaration."); yyerrok;} |
133 | 6209 |
| program_configuration_list error ';' |
136 | 6210 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid program configuration in resource declaration."); yyerrok;} |
131 | 6211 |
| program_configuration_list ';' |
136 | 6212 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after program configuration in resource declaration."); yynerrs++;} |
131 | 6213 |
/* 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
|
6214 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6215 |
|
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 |
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
|
6218 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6219 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6220 |
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
|
6221 |
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
|
6222 |
{$$ = NULL;} |
131 | 6223 |
// ERROR_CHECK_BEGIN // |
6224 |
| VAR_ACCESS END_VAR |
|
136 | 6225 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in access variable(s) declaration."); yynerrs++;} |
131 | 6226 |
| VAR_ACCESS error access_declaration_list END_VAR |
136 | 6227 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_ACCESS' in access variable(s) declaration."); yyerrok;} |
6228 |
| VAR_ACCESS access_declaration_list error END_VAR |
|
6229 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed access variable(s) declaration."); yyerrok;} |
|
131 | 6230 |
| VAR_ACCESS error END_VAR |
136 | 6231 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in access variable(s) declaration."); yyerrok;} |
131 | 6232 |
// 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
|
6233 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6234 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6235 |
// 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
|
6236 |
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
|
6237 |
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
|
6238 |
| access_declaration_list access_declaration ';' |
131 | 6239 |
// ERROR_CHECK_BEGIN // |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
6240 |
| error ';' |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
6241 |
{$$ = // create a new list //; |
136 | 6242 |
print_err_msg(locf(@1), locl(@1), "invalid access variable declaration."); yyerrok;} |
131 | 6243 |
| access_declaration error |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
6244 |
{$$ = // create a new list //; |
136 | 6245 |
print_err_msg(locl(@1), locf(@2), "';' missing at the end of access variable declaration."); yyerrok;} |
131 | 6246 |
| access_declaration_list access_declaration error |
136 | 6247 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at the end of access variable declaration."); yyerrok;} |
133 | 6248 |
| access_declaration_list error ';' |
136 | 6249 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid access variable declaration."); yyerrok;} |
131 | 6250 |
| access_declaration_list ';' |
136 | 6251 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after access variable declaration."); yynerrs++;} |
131 | 6252 |
// 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
|
6253 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6254 |
|
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 |
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
|
6257 |
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
|
6258 |
| 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
|
6259 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6260 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6261 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6262 |
access_path: |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6263 |
prev_declared_direct_variable |
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6264 |
| 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
|
6265 |
| any_fb_name_list symbolic_variable |
131 | 6266 |
| prev_declared_resource_name '.' any_fb_name_list symbolic_variable |
6267 |
| prev_declared_program_name '.' any_fb_name_list symbolic_variable |
|
6268 |
| 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
|
6269 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6270 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6271 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6272 |
// 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
|
6273 |
// - 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
|
6274 |
// - 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
|
6275 |
// |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6276 |
/* 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
|
6277 |
* 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
|
6278 |
* 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
|
6279 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6280 |
* 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
|
6281 |
* 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
|
6282 |
* 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
|
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 |
* 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
|
6285 |
* 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
|
6286 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6287 |
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
|
6288 |
// empty |
68 | 6289 |
{$$ = 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
|
6290 |
//| 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
|
6291 |
| 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
|
6292 |
{$$ = $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
|
6293 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6294 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6295 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6296 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6297 |
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
|
6298 |
// [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
|
6299 |
prev_declared_global_var_name |
68 | 6300 |
{$$ = 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
|
6301 |
| prev_declared_global_var_name '.' structure_element_name |
68 | 6302 |
{$$ = 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
|
6303 |
| prev_declared_resource_name '.' prev_declared_global_var_name |
68 | 6304 |
{$$ = 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
|
6305 |
| prev_declared_resource_name '.' prev_declared_global_var_name '.' structure_element_name |
68 | 6306 |
{$$ = 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
|
6307 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6308 |
|
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 |
//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
|
6311 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6312 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6313 |
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
|
6314 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6315 |
* 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
|
6316 |
* 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
|
6317 |
* 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
|
6318 |
* _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
|
6319 |
* 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
|
6320 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6321 |
* 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
|
6322 |
* 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
|
6323 |
* initialization! |
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 |
// 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
|
6326 |
program_name '.' symbolic_variable |
68 | 6327 |
{$$ = 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
|
6328 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6329 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6330 |
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
|
6331 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6332 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6333 |
direction: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6334 |
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
|
6335 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6336 |
| 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
|
6337 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6338 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6339 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6340 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6341 |
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
|
6342 |
TASK task_name task_initialization |
68 | 6343 |
{$$ = new task_configuration_c($2, $3, locloc(@$));} |
131 | 6344 |
/* ERROR_CHECK_BEGIN */ |
6345 |
| TASK task_initialization |
|
136 | 6346 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no task name defined in task declaration."); yynerrs++;} |
131 | 6347 |
| TASK error task_initialization |
136 | 6348 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid task name defined in task declaration."); yyerrok;} |
131 | 6349 |
| TASK task_name error |
6350 |
{$$ = NULL; |
|
136 | 6351 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no task initialization defined in task declaration.");} |
6352 |
else {print_err_msg(locf(@3), locl(@3), "invalid task initialization in task declaration."); yyclearin;} |
|
131 | 6353 |
yyerrok; |
6354 |
} |
|
6355 |
/* 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
|
6356 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6357 |
|
75 | 6358 |
/* 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
|
6359 |
* 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
|
6360 |
* 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
|
6361 |
* 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
|
6362 |
* 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
|
6363 |
* 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
|
6364 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6365 |
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
|
6366 |
|
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6367 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6368 |
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
|
6369 |
// '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' // |
75 | 6370 |
'(' {cmd_goto_task_init_state();} task_initialization_single task_initialization_interval task_initialization_priority ')' |
6371 |
{$$ = new task_initialization_c($3, $4, $5, locloc(@$));} |
|
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6372 |
; |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6373 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6374 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6375 |
task_initialization_single: |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6376 |
// [SINGLE ASSIGN data_source ','] |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6377 |
/* empty */ |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6378 |
{$$ = NULL;} |
75 | 6379 |
| SINGLE ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} |
6380 |
{$$ = $4;} |
|
131 | 6381 |
/* ERROR_CHECK_BEGIN */ |
6382 |
| SINGLE {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} |
|
136 | 6383 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "':=' missing after 'SINGLE' in task initialization."); yynerrs++;} |
131 | 6384 |
| SINGLE ASSIGN {cmd_pop_state();} ',' {cmd_goto_task_init_state();} |
136 | 6385 |
{$$ = NULL; print_err_msg(locl(@2), locf(@4), "no data source defined in 'SINGLE' statement of task initialization."); yynerrs++;} |
131 | 6386 |
| SINGLE ASSIGN {cmd_pop_state();} error ',' {cmd_goto_task_init_state();} |
136 | 6387 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid data source defined in 'SINGLE' statement of task initialization."); yyerrok;} |
131 | 6388 |
/* ERROR_CHECK_END */ |
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6389 |
; |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6390 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6391 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6392 |
task_initialization_interval: |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6393 |
// [INTERVAL ASSIGN data_source ','] |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6394 |
/* empty */ |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6395 |
{$$ = NULL;} |
75 | 6396 |
| INTERVAL ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} |
6397 |
{$$ = $4;} |
|
131 | 6398 |
/* ERROR_CHECK_BEGIN */ |
6399 |
| INTERVAL {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} |
|
136 | 6400 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "':=' missing after 'INTERVAL' in task initialization.");} |
131 | 6401 |
| INTERVAL ASSIGN {cmd_pop_state();} ',' {cmd_goto_task_init_state();} |
136 | 6402 |
{$$ = NULL; print_err_msg(locl(@2), locf(@4), "no data source defined in 'INTERVAL' statement of task initialization."); yynerrs++;} |
131 | 6403 |
| INTERVAL ASSIGN {cmd_pop_state();} error ',' {cmd_goto_task_init_state();} |
136 | 6404 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid data source defined in 'INTERVAL' statement of task initialization."); yyerrok;} |
131 | 6405 |
/* ERROR_CHECK_END */ |
75 | 6406 |
; |
6407 |
||
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6408 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6409 |
|
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6410 |
task_initialization_priority: |
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6411 |
// PRIORITY ASSIGN integer |
75 | 6412 |
PRIORITY ASSIGN {cmd_pop_state();} integer |
6413 |
{$$ = $4;} |
|
131 | 6414 |
/* ERROR_CHECK_BEGIN */ |
6415 |
| PRIORITY {cmd_pop_state();} integer |
|
136 | 6416 |
{$$ = NULL; print_err_msg(locl(@1), locf(@3), "':=' missing after 'PRIORITY' in task initialization."); yynerrs++;} |
131 | 6417 |
| PRIORITY ASSIGN {cmd_pop_state();} error |
6418 |
{$$ = NULL; |
|
136 | 6419 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@4), "no priority number defined in 'PRIORITY' statement of task initialization.");} |
6420 |
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
|
6421 |
yyerrok; |
131 | 6422 |
} |
6423 |
/* ERROR_CHECK_END */ |
|
75 | 6424 |
; |
6425 |
||
74
85af9521bf63
fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents:
73
diff
changeset
|
6426 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6427 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6428 |
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
|
6429 |
constant |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6430 |
| 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
|
6431 |
| program_output_reference |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6432 |
| 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
|
6433 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6434 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6435 |
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
|
6436 |
// 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
|
6437 |
PROGRAM program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
68 | 6438 |
{$$ = 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
|
6439 |
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
|
6440 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6441 |
| PROGRAM RETAIN program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
68 | 6442 |
{$$ = 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
|
6443 |
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
|
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 |
| PROGRAM NON_RETAIN program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
68 | 6446 |
{$$ = 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
|
6447 |
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
|
6448 |
} |
131 | 6449 |
/* ERROR_CHECK_BEGIN */ |
6450 |
| PROGRAM program_name optional_task_name ':' identifier optional_prog_conf_elements |
|
136 | 6451 |
{$$ = NULL; print_err_msg(locf(@5), locl(@5), "invalid program type name after ':' in program configuration."); yynerrs++;} |
131 | 6452 |
| PROGRAM RETAIN program_name optional_task_name ':' identifier optional_prog_conf_elements |
136 | 6453 |
{$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid program type name after ':' in program configuration."); yynerrs++;} |
131 | 6454 |
| PROGRAM NON_RETAIN program_name optional_task_name ':' identifier optional_prog_conf_elements |
136 | 6455 |
{$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid program type name after ':' in program configuration."); yynerrs++;} |
131 | 6456 |
| PROGRAM error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6457 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'PROGRAM' in program configuration."); yyerrok;} |
131 | 6458 |
| PROGRAM RETAIN error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6459 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive program configuration."); yyerrok;} |
131 | 6460 |
| PROGRAM NON_RETAIN error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6461 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive program configuration."); yyerrok;} |
131 | 6462 |
| PROGRAM optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6463 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no program name defined in program configuration."); yynerrs++;} |
131 | 6464 |
| PROGRAM RETAIN optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6465 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no program name defined in retentive program configuration."); yynerrs++;} |
131 | 6466 |
| PROGRAM NON_RETAIN optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6467 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no program name defined in non-retentive program configuration."); yynerrs++;} |
131 | 6468 |
| PROGRAM error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6469 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid program name defined in program configuration."); yyerrok;} |
131 | 6470 |
| PROGRAM RETAIN error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6471 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid program name defined in retentive program configuration."); yyerrok;} |
131 | 6472 |
| PROGRAM NON_RETAIN error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements |
136 | 6473 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid program name defined in non-retentive program configuration."); yyerrok;} |
131 | 6474 |
| PROGRAM program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements |
136 | 6475 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "':' missing after program name or optional task name in program configuration."); yynerrs++;} |
131 | 6476 |
| PROGRAM RETAIN program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements |
136 | 6477 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "':' missing after program name or optional task name in retentive program configuration."); yynerrs++;} |
131 | 6478 |
| PROGRAM NON_RETAIN program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements |
136 | 6479 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "':' missing after program name or optional task name in non-retentive program configuration."); yynerrs++;} |
131 | 6480 |
| PROGRAM program_name optional_task_name ':' optional_prog_conf_elements |
136 | 6481 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no program type defined in program configuration."); yynerrs++;} |
131 | 6482 |
| PROGRAM RETAIN program_name optional_task_name ':' optional_prog_conf_elements |
136 | 6483 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "no program type defined in retentive program configuration."); yynerrs++;} |
131 | 6484 |
| PROGRAM NON_RETAIN program_name optional_task_name ':' optional_prog_conf_elements |
136 | 6485 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "no program type defined in non-retentive program configuration."); yynerrs++;} |
131 | 6486 |
/* 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
|
6487 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6488 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6489 |
// 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
|
6490 |
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
|
6491 |
// empty // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6492 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6493 |
| 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
|
6494 |
{$$ = $2;} |
131 | 6495 |
/* ERROR_CHECK_BEGIN */ |
6496 |
| WITH error |
|
6497 |
{$$ = NULL; |
|
136 | 6498 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no task name defined in optional task name of program configuration.");} |
6499 |
else {print_err_msg(locf(@2), locl(@2), "invalid task name in optional task name of program configuration."); yyclearin;} |
|
131 | 6500 |
yyerrok; |
6501 |
} |
|
6502 |
/* 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
|
6503 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6504 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6505 |
// 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
|
6506 |
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
|
6507 |
// empty // |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6508 |
{$$ = NULL;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6509 |
| '(' 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
|
6510 |
{$$ = $2;} |
131 | 6511 |
/* ERROR_CHECK_BEGIN */ |
6512 |
| '(' error ')' |
|
136 | 6513 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid program configuration elements in program configuration."); yyerrok;} |
131 | 6514 |
| '(' prog_conf_elements error |
136 | 6515 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of program configuration elements in program configuration."); yyerrok;} |
131 | 6516 |
/* 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
|
6517 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6518 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6519 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6520 |
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
|
6521 |
prog_conf_element |
68 | 6522 |
{$$ = 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
|
6523 |
| 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
|
6524 |
{$$ = $1; $$->add_element($3);} |
131 | 6525 |
/* ERROR_CHECK_BEGIN */ |
6526 |
| prog_conf_elements prog_conf_element |
|
136 | 6527 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in program configuration elements list."); yynerrs++;} |
131 | 6528 |
| prog_conf_elements ',' error |
136 | 6529 |
{$$ = $1; |
6530 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for program configuration element in program configuration list.");} |
|
6531 |
else {print_err_msg(locf(@3), locl(@3), "invalid value for program configuration element in program configuration list."); yyclearin;} |
|
131 | 6532 |
yyerrok; |
6533 |
} |
|
6534 |
/* 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
|
6535 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6536 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6537 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6538 |
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
|
6539 |
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
|
6540 |
| 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
|
6541 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6542 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6543 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6544 |
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
|
6545 |
// 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
|
6546 |
/* 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
|
6547 |
* 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
|
6548 |
* 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
|
6549 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6550 |
any_identifier WITH task_name |
68 | 6551 |
{$$ = new fb_task_c($1, $3, locloc(@$));} |
131 | 6552 |
/* ERROR_CHECK_BEGIN */ |
6553 |
| any_identifier WITH error |
|
6554 |
{$$ = NULL; |
|
136 | 6555 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no task name defined in function block configuration.");} |
6556 |
else {print_err_msg(locf(@3), locl(@3), "invalid task name in function block configuration."); yyclearin;} |
|
131 | 6557 |
yyerrok; |
6558 |
} |
|
6559 |
/* 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
|
6560 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6561 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6562 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6563 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6564 |
* 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
|
6565 |
* 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
|
6566 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6567 |
* 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
|
6568 |
* (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
|
6569 |
* 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
|
6570 |
* 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
|
6571 |
* 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
|
6572 |
* 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
|
6573 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6574 |
* 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
|
6575 |
* 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
|
6576 |
* 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
|
6577 |
* '(' 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
|
6578 |
* 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
|
6579 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6580 |
* 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
|
6581 |
* 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
|
6582 |
* 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
|
6583 |
* 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
|
6584 |
* 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
|
6585 |
* 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
|
6586 |
* 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
|
6587 |
* 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
|
6588 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6589 |
* 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
|
6590 |
* 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
|
6591 |
* 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
|
6592 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6593 |
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
|
6594 |
any_symbolic_variable ASSIGN prog_data_source |
68 | 6595 |
{$$ = 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
|
6596 |
| any_symbolic_variable SENDTO data_sink |
68 | 6597 |
{$$ = new prog_cnxn_sendto_c($1, $3, locloc(@$));} |
131 | 6598 |
/* ERROR_CHECK_BEGIN */ |
6599 |
| any_symbolic_variable constant |
|
136 | 6600 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing between parameter and value in program configuration element."); yynerrs++;} |
131 | 6601 |
| any_symbolic_variable enumerated_value |
136 | 6602 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing between parameter and value in program configuration element."); yynerrs++;} |
131 | 6603 |
| any_symbolic_variable data_sink |
136 | 6604 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' or '=>' missing between parameter and variable in program configuration element."); yynerrs++;} |
131 | 6605 |
| any_symbolic_variable ASSIGN error |
6606 |
{$$ = NULL; |
|
136 | 6607 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value or variable defined in program configuration assignment element.");} |
6608 |
else {print_err_msg(locf(@3), locl(@3), "invalid value or variable in program configuration assignment element."); yyclearin;} |
|
131 | 6609 |
yyerrok; |
6610 |
} |
|
6611 |
| any_symbolic_variable SENDTO error |
|
6612 |
{$$ = NULL; |
|
136 | 6613 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no variable defined in program configuration sendto element.");} |
6614 |
else {print_err_msg(locf(@3), locl(@3), "invalid variable in program configuration sendto element."); yyclearin;} |
|
131 | 6615 |
yyerrok; |
6616 |
} |
|
6617 |
/* 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
|
6618 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6619 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6620 |
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
|
6621 |
constant |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6622 |
| 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
|
6623 |
| global_var_reference |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6624 |
| 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
|
6625 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6626 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6627 |
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
|
6628 |
global_var_reference |
175
dadda1b5401e
Adding support for checking direct variable declared before using
lbessard
parents:
151
diff
changeset
|
6629 |
| 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
|
6630 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6631 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6632 |
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
|
6633 |
VAR_CONFIG instance_specific_init_list END_VAR |
68 | 6634 |
{$$ = new instance_specific_initializations_c($2, locloc(@$));} |
131 | 6635 |
/* ERROR_CHECK_BEGIN */ |
6636 |
| VAR_CONFIG END_VAR |
|
136 | 6637 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in configuration variable(s) initialization."); yynerrs++;} |
131 | 6638 |
| VAR_CONFIG error instance_specific_init_list END_VAR |
136 | 6639 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_CONFIG' in configuration variable(s) initialization."); yyerrok;} |
6640 |
| VAR_CONFIG instance_specific_init_list error END_OF_INPUT |
|
6641 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed configuration variable(s) initialization."); yyerrok;} |
|
131 | 6642 |
| VAR_CONFIG error END_VAR |
136 | 6643 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in configuration variable(s) initialization."); yyerrok;} |
131 | 6644 |
/* 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
|
6645 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6646 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6647 |
// 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
|
6648 |
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
|
6649 |
instance_specific_init ';' |
68 | 6650 |
{$$ = 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
|
6651 |
| 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
|
6652 |
{$$ = $1; $$->add_element($2);} |
131 | 6653 |
/* ERROR_CHECK_BEGIN */ |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
6654 |
| error ';' |
136 | 6655 |
{$$ = new instance_specific_init_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid configuration variable initialization."); yyerrok;} |
131 | 6656 |
| instance_specific_init error |
136 | 6657 |
{$$ = new instance_specific_init_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at the end of configuration variable initialization."); yyerrok;} |
131 | 6658 |
| instance_specific_init_list instance_specific_init error |
136 | 6659 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at the end of configuration variable initialization."); yyerrok;} |
133 | 6660 |
| instance_specific_init_list error ';' |
136 | 6661 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid configuration variable initialization."); yyerrok;} |
131 | 6662 |
| instance_specific_init_list ';' |
136 | 6663 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after configuration variable initialization."); yynerrs++;} |
131 | 6664 |
/* 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
|
6665 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6666 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6667 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6668 |
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
|
6669 |
// |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6670 |
// 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
|
6671 |
// ((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
|
6672 |
// |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6673 |
// 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
|
6674 |
/* 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
|
6675 |
* 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
|
6676 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6677 |
/* 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
|
6678 |
* 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
|
6679 |
* 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
|
6680 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6681 |
prev_declared_resource_name '.' program_name '.' any_fb_name_list any_identifier ':' located_var_spec_init |
68 | 6682 |
{$$ = 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
|
6683 |
| prev_declared_resource_name '.' program_name '.' any_fb_name_list any_identifier location ':' located_var_spec_init |
68 | 6684 |
{$$ = 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
|
6685 |
| prev_declared_resource_name '.' program_name '.' any_fb_name_list any_identifier ':' fb_initialization |
68 | 6686 |
{$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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6690 |
/* 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
|
6691 |
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
|
6692 |
function_block_type_name ASSIGN structure_initialization |
68 | 6693 |
{$$ = new fb_initialization_c($1, $3, locloc(@$));} |
131 | 6694 |
/* ERROR_CHECK_BEGIN */ |
6695 |
| function_block_type_name structure_initialization |
|
136 | 6696 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing between function block name and initialization in function block initialization."); yynerrs++;} |
6697 |
| function_block_type_name ASSIGN error |
|
131 | 6698 |
{$$ = NULL; |
136 | 6699 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in function block initialization.");} |
6700 |
else {print_err_msg(locf(@3), locl(@3), "invalid initial value in function block initialization."); yyclearin;} |
|
131 | 6701 |
yyerrok; |
6702 |
} |
|
6703 |
/* 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
|
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 |
/***********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6707 |
/* 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
|
6708 |
/***********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6709 |
/* 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
|
6710 |
/* 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
|
6711 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6712 |
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
|
6713 |
EOL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6714 |
| 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
|
6715 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6716 |
|
94 | 6717 |
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6719 |
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
|
6720 |
il_instruction |
68 | 6721 |
{$$ = 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
|
6722 |
| any_pragma eol_list |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
6723 |
{$$ = 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
|
6724 |
| 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
|
6725 |
{$$ = $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
|
6726 |
| 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
|
6727 |
{$$ = $1; $$->add_element($2);} |
68 | 6728 |
; |
6729 |
||
6730 |
||
6731 |
||
6732 |
il_instruction: |
|
6733 |
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
|
6734 |
{$$ = new il_instruction_c(NULL, $1, locloc(@1));} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */ |
68 | 6735 |
| 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
|
6736 |
{$$ = 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
|
6737 |
| label ':' eol_list |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
6738 |
{$$ = 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 | 6739 |
/* ERROR_CHECK_BEGIN */ |
6740 |
| error eol_list |
|
136 | 6741 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid IL instruction."); yyerrok;} |
131 | 6742 |
| il_incomplete_instruction error |
136 | 6743 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of IL instruction."); yyerrok;} |
131 | 6744 |
| error ':' il_incomplete_instruction eol_list |
136 | 6745 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid label in IL instruction."); yyerrok;} |
131 | 6746 |
| label il_incomplete_instruction eol_list |
136 | 6747 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after label in IL instruction."); yynerrs++;} |
68 | 6748 |
| label ':' error eol_list |
136 | 6749 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid IL instruction."); yyerrok;} |
131 | 6750 |
| label ':' il_incomplete_instruction error |
136 | 6751 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "EOL missing at the end of IL instruction."); yyerrok;} |
68 | 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 |
/* 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
|
6757 |
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
|
6758 |
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
|
6759 |
| 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
|
6760 |
| 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
|
6761 |
| 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
|
6762 |
| 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
|
6763 |
| 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6766 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6767 |
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
|
6768 |
|
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 |
|
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_simple_operation: |
94 | 6772 |
// (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
|
6773 |
il_simple_operator |
68 | 6774 |
{$$ = new il_simple_operation_c($1, NULL, locloc(@$));} |
93 | 6775 |
/* |
6776 |
* Note: Bison is getting confused with the following rule, |
|
94 | 6777 |
* i.e. it is finding conflicts where there seemingly are really none. |
93 | 6778 |
* The rule was therefore replaced by the equivalent following |
6779 |
* two rules. |
|
6780 |
*/ |
|
6781 |
/* |
|
6782 |
| il_simple_operator il_operand |
|
6783 |
{$$ = new il_simple_operation_c($1, $2, locloc(@$));} |
|
6784 |
*/ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6785 |
| il_simple_operator_noclash il_operand |
68 | 6786 |
{$$ = new il_simple_operation_c($1, $2, locloc(@$));} |
91 | 6787 |
| il_simple_operator_clash il_operand |
6788 |
{$$ = 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
|
6789 |
/* 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
|
6790 |
* | 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
|
6791 |
* 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
|
6792 |
* 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
|
6793 |
* 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
|
6794 |
* without any operands, could be reduced to either an operator or a |
89 | 6795 |
* function call. |
6796 |
* |
|
6797 |
* I (Mario) have chosen to reduce it to an operator. |
|
68 | 6798 |
* In order to do this, we must remove from the syntax that defines |
6799 |
* function calls all the functions whose names clash with the IL operators. |
|
6800 |
* |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6801 |
* 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
|
6802 |
* | 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
|
6803 |
* 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
|
6804 |
* | 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
|
6805 |
* 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
|
6806 |
* 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
|
6807 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6808 |
| function_name_no_clashes |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
6809 |
{$$ = new il_function_call_c($1, NULL, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_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
|
6810 |
/* 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
|
6811 |
* | il_simple_operator il_operand |
68 | 6812 |
* already contains the 'NOT', 'MOD', etc. operators, followed by a single il_operand. |
6813 |
* However, this same code (MOD x) may also be reduced to a function call to the MOD |
|
6814 |
* function. This means that (MOD, AND,...) could be interpret as a function name |
|
6815 |
* or as an IL operator! This would lead us to a reduce/reduce conflict! |
|
6816 |
* |
|
89 | 6817 |
* I (Mario) have chosen to reduce it to an operand, rather than a function call. |
68 | 6818 |
* In order to do this, we must remove from the syntax that defines |
6819 |
* 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
|
6820 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6821 |
* 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
|
6822 |
* | 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
|
6823 |
* 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
|
6824 |
* | 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
|
6825 |
* 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
|
6826 |
* 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
|
6827 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6828 |
* 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
|
6829 |
* this alternative syntax does not cover the possibility of |
68 | 6830 |
* the function 'NOT', 'MOD', etc... being called with more than one il_operand, |
6831 |
* 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
|
6832 |
* 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
|
6833 |
* 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
|
6834 |
* 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
|
6835 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6836 |
| function_name_no_clashes il_operand_list |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
6837 |
{$$ = new il_function_call_c($1, $2, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_c |
91 | 6838 |
| il_simple_operator_clash il_operand_list2 |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
6839 |
{$$ = new il_function_call_c(il_operator_c_2_poutype_identifier_c($1), $2, locloc(@$));} |
93 | 6840 |
; |
6841 |
||
91 | 6842 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6843 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6844 |
il_expression: |
94 | 6845 |
// 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
|
6846 |
/* 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
|
6847 |
* 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
|
6848 |
* 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
|
6849 |
* 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
|
6850 |
* 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
|
6851 |
* 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
|
6852 |
* 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
|
6853 |
* ) |
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
|
6854 |
* |
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
|
6855 |
* 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
|
6856 |
* 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
|
6857 |
* 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
|
6858 |
* 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
|
6859 |
* 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
|
6860 |
* ) |
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
|
6861 |
* |
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
|
6862 |
* 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
|
6863 |
* 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
|
6864 |
* 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
|
6865 |
*/ |
94 | 6866 |
/* |
6867 |
* Note: Bison is getting confused with the use of il_expr_operator, |
|
6868 |
* i.e. it is finding conflicts where there seemingly are really none. |
|
6869 |
* il_expr_operator was therefore replaced by the equivalent |
|
6870 |
* il_expr_operator_noclash | il_expr_operator_clash. |
|
6871 |
*/ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6872 |
il_expr_operator_noclash '(' eol_list ')' |
68 | 6873 |
{$$ = 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
|
6874 |
| 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
|
6875 |
{ 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
|
6876 |
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
|
6877 |
$$ = 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
|
6878 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6879 |
| il_expr_operator_noclash '(' eol_list simple_instr_list ')' |
68 | 6880 |
{$$ = 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
|
6881 |
| 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
|
6882 |
{ 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
|
6883 |
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
|
6884 |
$$ = 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
|
6885 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6886 |
| il_expr_operator_clash '(' eol_list ')' |
68 | 6887 |
{$$ = 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
|
6888 |
| 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
|
6889 |
{ 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
|
6890 |
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
|
6891 |
$$ = 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
|
6892 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6893 |
| 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
|
6894 |
{ 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
|
6895 |
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
|
6896 |
$$ = 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
|
6897 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6898 |
| il_expr_operator_clash_eol_list simple_instr_list ')' |
68 | 6899 |
{$$ = new il_expression_c($1, NULL, $2, locloc(@$));} |
131 | 6900 |
/* ERROR_CHECK_BEGIN */ |
6901 |
| il_expr_operator_noclash '(' eol_list error |
|
136 | 6902 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6903 |
| il_expr_operator_noclash '(' il_operand eol_list error |
136 | 6904 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6905 |
| il_expr_operator_noclash '(' eol_list simple_instr_list error |
136 | 6906 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6907 |
| il_expr_operator_noclash '(' il_operand eol_list simple_instr_list error |
136 | 6908 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6909 |
| il_expr_operator_clash '(' il_operand eol_list error |
136 | 6910 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6911 |
| il_expr_operator_clash '(' il_operand eol_list simple_instr_list error |
136 | 6912 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6913 |
| il_expr_operator_clash_eol_list simple_instr_list error |
136 | 6914 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of IL expression."); yyerrok;} |
131 | 6915 |
/* 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
|
6916 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6917 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6918 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6919 |
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
|
6920 |
il_jump_operator label |
68 | 6921 |
{$$ = new il_jump_operation_c($1, $2, locloc(@$));} |
131 | 6922 |
/* ERROR_CHECK_BEGIN */ |
6923 |
| il_jump_operator error |
|
136 | 6924 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid label defined in IL jump operation."); yyerrok;} |
131 | 6925 |
/* 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
|
6926 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6927 |
|
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 |
il_fb_call: |
94 | 6930 |
// 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
|
6931 |
il_call_operator prev_declared_fb_name |
68 | 6932 |
{$$ = 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
|
6933 |
| il_call_operator prev_declared_fb_name '(' ')' |
68 | 6934 |
{$$ = 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
|
6935 |
| il_call_operator prev_declared_fb_name '(' eol_list ')' |
68 | 6936 |
{$$ = 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
|
6937 |
| il_call_operator prev_declared_fb_name '(' il_operand_list ')' |
68 | 6938 |
{$$ = 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
|
6939 |
| il_call_operator prev_declared_fb_name '(' eol_list il_param_list ')' |
68 | 6940 |
{$$ = new il_fb_call_c($1, $2, NULL, $5, locloc(@$));} |
131 | 6941 |
/* ERROR_CHECK_BEGIN */ |
6942 |
| il_call_operator error |
|
6943 |
{$$ = NULL; |
|
136 | 6944 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call.");} |
6945 |
else {print_err_msg(locf(@2), locl(@2), "invalid function block name in IL function block call."); yyclearin;} |
|
131 | 6946 |
yyerrok; |
6947 |
} |
|
6948 |
| il_call_operator '(' ')' |
|
136 | 6949 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;} |
131 | 6950 |
| il_call_operator '(' eol_list ')' |
136 | 6951 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;} |
131 | 6952 |
| il_call_operator '(' il_operand_list ')' |
136 | 6953 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;} |
131 | 6954 |
| il_call_operator '(' eol_list il_param_list ')' |
136 | 6955 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;} |
131 | 6956 |
| il_call_operator error '(' ')' |
136 | 6957 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;} |
131 | 6958 |
| il_call_operator error '(' eol_list ')' |
136 | 6959 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;} |
131 | 6960 |
| il_call_operator error '(' il_operand_list ')' |
136 | 6961 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;} |
131 | 6962 |
| il_call_operator error '(' eol_list il_param_list ')' |
136 | 6963 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;} |
131 | 6964 |
| il_call_operator prev_declared_fb_name ')' |
136 | 6965 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'(' missing after function block name defined in IL function block call."); yynerrs++;} |
131 | 6966 |
| il_call_operator prev_declared_fb_name il_operand_list ')' |
136 | 6967 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'(' missing after function block name defined in IL function block call."); yynerrs++;} |
131 | 6968 |
| il_call_operator prev_declared_fb_name '(' error |
136 | 6969 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of IL function block call."); yyerrok;} |
131 | 6970 |
| il_call_operator prev_declared_fb_name '(' eol_list error |
136 | 6971 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL function block call."); yyerrok;} |
131 | 6972 |
| il_call_operator prev_declared_fb_name '(' il_operand_list error |
136 | 6973 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL function block call."); yyerrok;} |
131 | 6974 |
/* 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
|
6975 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6976 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6977 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6978 |
/* 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
|
6979 |
il_formal_funct_call: |
94 | 6980 |
// 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
|
6981 |
/* 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
|
6982 |
/* 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
|
6983 |
* - 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
|
6984 |
* - 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
|
6985 |
* 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
|
6986 |
* 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
|
6987 |
* 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
|
6988 |
* 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
|
6989 |
* 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
|
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 |
* 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
|
6992 |
* 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
|
6993 |
* 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
|
6994 |
* as operators, rather than as function calls! |
68 | 6995 |
* (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
|
6996 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
6997 |
function_name_no_clashes '(' eol_list ')' |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
6998 |
{$$ = new il_formal_funct_call_c($1, NULL, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_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
|
6999 |
| function_name_simpleop_clashes '(' eol_list ')' |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
7000 |
{$$ = new il_formal_funct_call_c($1, NULL, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_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
|
7001 |
/* | function_name '(' eol_list il_param_list ')' */ |
68 | 7002 |
/* For the above syntax, we no longer have two ways of interpreting the |
7003 |
* same syntax. The above is always a function call! |
|
7004 |
* However, some of the functions that we may be calling |
|
7005 |
* may have the same name as an IL operator. This means that |
|
7006 |
* flex will be parsing them and handing them over to bison as |
|
7007 |
* IL operator tokens, and not as function name tokens. |
|
7008 |
* (when parsing ST, flex no longer recognizes IL operators, |
|
7009 |
* so will always return the correct function name, unless that |
|
7010 |
* name also coincides with an operator used in ST -> XOR, OR, MOD, AND, NOT) |
|
7011 |
* |
|
7012 |
* We must therefore interpret the IL operators as function names! |
|
7013 |
*/ |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7014 |
| function_name_no_clashes '(' eol_list il_param_list ')' |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
7015 |
{$$ = new il_formal_funct_call_c($1, $4, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_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
|
7016 |
| function_name_simpleop_clashes '(' eol_list il_param_list ')' |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
7017 |
{$$ = new il_formal_funct_call_c($1, $4, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_c |
68 | 7018 |
/* The following line should read: |
7019 |
* |
|
7020 |
* | function_name_expression_clashes '(' eol_list il_param_list ')' |
|
7021 |
* |
|
7022 |
* 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
|
7023 |
* 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
|
7024 |
* 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
|
7025 |
* 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
|
7026 |
* 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
|
7027 |
* 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
|
7028 |
* 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
|
7029 |
* 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
|
7030 |
* 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
|
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 |
* 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
|
7033 |
* 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
|
7034 |
* 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
|
7035 |
* 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
|
7036 |
* This is a lot of work, so I put it in a function |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
7037 |
* at the end of this file... il_operator_c_2_poutype_identifier_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
|
7038 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7039 |
| il_expr_operator_clash_eol_list il_param_list ')' |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
7040 |
{$$ = new il_formal_funct_call_c(il_operator_c_2_poutype_identifier_c($1), $2, locloc(@$));} |
131 | 7041 |
/* ERROR_CHECK_BEGIN */ |
7042 |
| function_name_no_clashes '(' eol_list error ')' |
|
136 | 7043 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid parameter list defined in IL formal function call."); yyerrok;} |
131 | 7044 |
| function_name_simpleop_clashes '(' eol_list error ')' |
136 | 7045 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid parameter list defined in IL formal function call."); yyerrok;} |
131 | 7046 |
| il_expr_operator_clash_eol_list error ')' |
136 | 7047 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter list defined in IL formal function call."); yyerrok;} |
131 | 7048 |
/* 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
|
7049 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7050 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7051 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7052 |
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
|
7053 |
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
|
7054 |
{$$ = $1;} |
131 | 7055 |
/* ERROR_CHECK_BEGIN */ |
7056 |
| il_expr_operator_clash '(' error |
|
136 | 7057 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "EOL missing after '(' in IL instruction."); yyerrok;} |
131 | 7058 |
/* 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
|
7059 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7060 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7061 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7062 |
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
|
7063 |
variable |
85 | 7064 |
| 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
|
7065 |
| constant |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7066 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7067 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7068 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7069 |
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
|
7070 |
il_operand |
68 | 7071 |
{$$ = new il_operand_list_c(locloc(@$)); $$->add_element($1);} |
91 | 7072 |
| il_operand_list2 |
7073 |
; |
|
7074 |
||
7075 |
||
7076 |
/* List with 2 or more il_operands */ |
|
7077 |
il_operand_list2: |
|
7078 |
il_operand ',' il_operand |
|
7079 |
{$$ = new il_operand_list_c(locloc(@$)); $$->add_element($1); $$->add_element($3);} |
|
7080 |
| 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
|
7081 |
{$$ = $1; $$->add_element($3);} |
131 | 7082 |
/* ERROR_CHECK_BEGIN */ |
7083 |
| il_operand_list2 il_operand |
|
136 | 7084 |
{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in IL operand list."); yynerrs++;} |
7085 |
| il_operand ',' error |
|
7086 |
{$$ = new il_operand_list_c(locloc(@$)); |
|
7087 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no operand defined in IL operand list.");} |
|
7088 |
else {print_err_msg(locf(@3), locl(@3), "invalid operand name in IL operand list."); yyclearin;} |
|
131 | 7089 |
yyerrok; |
7090 |
} |
|
7091 |
/* 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
|
7092 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7093 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7094 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7095 |
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
|
7096 |
il_simple_instruction |
68 | 7097 |
{$$ = 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
|
7098 |
| 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
|
7099 |
{$$ = $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
|
7100 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7101 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7102 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7103 |
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
|
7104 |
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
|
7105 |
{$$ = 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
|
7106 |
| il_expression eol_list |
520
fb381d2cd25b
Ignore trailing EOLs when determining symbol location.
Mario de Sousa <msousa@fe.up.pt>
parents:
516
diff
changeset
|
7107 |
{$$ = 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
|
7108 |
| 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
|
7109 |
{$$ = new il_simple_instruction_c($1, locloc(@1));} /* locloc(@1) is not a bug! We ignore trailing EOLs when determining symbol location! */ |
131 | 7110 |
/* ERROR_CHECK_BEGIN */ |
7111 |
| il_expression error |
|
136 | 7112 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing after expression IL instruction."); yyerrok;} |
131 | 7113 |
| il_formal_funct_call error |
136 | 7114 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing after formal function call IL instruction."); yyerrok;} |
131 | 7115 |
/* 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
|
7116 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7117 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7118 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7119 |
/* 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
|
7120 |
* 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
|
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 |
* 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
|
7123 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7124 |
* 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
|
7125 |
* 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
|
7126 |
* 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
|
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 |
* 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
|
7129 |
* 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
|
7130 |
* 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
|
7131 |
* 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
|
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 |
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
|
7134 |
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
|
7135 |
{$$ = $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
|
7136 |
| il_param_last_instruction |
68 | 7137 |
{$$ = new il_param_list_c(locloc(@$)); $$->add_element($1);} |
131 | 7138 |
/* ERROR_CHECK_BEGIN */ |
7139 |
| il_param_instruction_list error |
|
136 | 7140 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid parameter assignment in parameter assignment list."); yyerrok;} |
131 | 7141 |
| il_param_last_instruction il_param_last_instruction |
136 | 7142 |
{$$ = 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 | 7143 |
| il_param_instruction_list il_param_last_instruction il_param_last_instruction |
136 | 7144 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "',' missing at the end of parameter assignment in parameter assignment list."); yynerrs++;} |
131 | 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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7148 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7149 |
/* 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
|
7150 |
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
|
7151 |
il_param_instruction |
68 | 7152 |
{$$ = 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
|
7153 |
| 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
|
7154 |
{$$ = $1; $$->add_element($2);} |
131 | 7155 |
/* ERROR_CHECK_BEGIN */ |
7156 |
| il_param_last_instruction il_param_instruction |
|
136 | 7157 |
{$$ = 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 | 7158 |
| il_param_instruction_list il_param_last_instruction il_param_instruction |
136 | 7159 |
{$$ = $1; print_err_msg(locl(@2), locf(@3), "',' missing at the end of parameter assignment in parameter assignment list."); yynerrs++;} |
131 | 7160 |
/* 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
|
7161 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7162 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7163 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7164 |
il_param_instruction: |
257 | 7165 |
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
|
7166 |
| il_param_out_assignment ',' eol_list |
131 | 7167 |
/* ERROR_CHECK_BEGIN */ |
7168 |
| il_param_assignment ',' error |
|
136 | 7169 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "EOL missing at the end of parameter assignment in parameter assignment list."); yyerrok;} |
131 | 7170 |
| il_param_out_assignment ',' error |
136 | 7171 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "EOL missing at the end of parameter out assignment in parameter assignment list."); yyerrok;} |
131 | 7172 |
/* 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
|
7173 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7174 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7175 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7176 |
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
|
7177 |
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
|
7178 |
| il_param_out_assignment eol_list |
131 | 7179 |
/* ERROR_CHECK_BEGIN */ |
7180 |
| il_param_assignment error |
|
136 | 7181 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of last parameter assignment in parameter assignment list."); yyerrok;} |
131 | 7182 |
| il_param_out_assignment error |
136 | 7183 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of last parameter out assignment in parameter assignment list."); yyerrok;} |
131 | 7184 |
/* ERROR_CHECK_END */ |
7185 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7186 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7187 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7188 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7189 |
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
|
7190 |
il_assign_operator il_operand |
68 | 7191 |
{$$ = 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
|
7192 |
| il_assign_operator '(' eol_list simple_instr_list ')' |
68 | 7193 |
{$$ = new il_param_assignment_c($1, NULL, $4, locloc(@$));} |
131 | 7194 |
/* ERROR_CHECK_BEGIN */ |
7195 |
| error il_operand |
|
136 | 7196 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid operator in parameter assignment."); yyerrok;} |
131 | 7197 |
| error '(' eol_list simple_instr_list ')' |
136 | 7198 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid operator in parameter assignment."); yyerrok;} |
131 | 7199 |
| il_assign_operator error |
7200 |
{$$ = NULL; |
|
136 | 7201 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no operand defined in parameter assignment.");} |
7202 |
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
|
7203 |
yyerrok; |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
7204 |
} |
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
7205 |
| il_assign_operator '(' eol_list ')' |
136 | 7206 |
{$$ = 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
|
7207 |
| il_assign_operator '(' eol_list error ')' |
136 | 7208 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid instruction list defined in parameter assignment."); yyerrok;} |
131 | 7209 |
| il_assign_operator '(' eol_list simple_instr_list error |
136 | 7210 |
{$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of instruction list defined in parameter assignment."); yyerrok;} |
131 | 7211 |
/* 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
|
7212 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7213 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7214 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7215 |
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
|
7216 |
il_assign_out_operator variable |
68 | 7217 |
{$$ = new il_param_out_assignment_c($1, $2, locloc(@$));} |
131 | 7218 |
/* ERROR_CHECK_BEGIN */ |
7219 |
| il_assign_out_operator error |
|
7220 |
{$$ = NULL; |
|
136 | 7221 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no variable defined in IL operand list.");} |
7222 |
else {print_err_msg(locf(@2), locl(@2), "invalid variable in IL operand list."); yyclearin;} |
|
131 | 7223 |
yyerrok; |
7224 |
} |
|
7225 |
/* 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
|
7226 |
; |
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7230 |
/*******************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7231 |
/* 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
|
7232 |
/*******************/ |
68 | 7233 |
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
|
7234 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7235 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7236 |
/* NOTE: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7237 |
* 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
|
7238 |
* 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
|
7239 |
* 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
|
7240 |
* 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
|
7241 |
* (Mario) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7242 |
*/ |
68 | 7243 |
LD_operator: LD {$$ = new LD_operator_c(locloc(@$));}; |
7244 |
LDN_operator: LDN {$$ = new LDN_operator_c(locloc(@$));}; |
|
7245 |
ST_operator: ST {$$ = new ST_operator_c(locloc(@$));}; |
|
7246 |
STN_operator: STN {$$ = new STN_operator_c(locloc(@$));}; |
|
7247 |
NOT_operator: NOT {$$ = new NOT_operator_c(locloc(@$));}; |
|
7248 |
S_operator: S {$$ = new S_operator_c(locloc(@$));}; |
|
7249 |
R_operator: R {$$ = new R_operator_c(locloc(@$));}; |
|
7250 |
S1_operator: S1 {$$ = new S1_operator_c(locloc(@$));}; |
|
7251 |
R1_operator: R1 {$$ = new R1_operator_c(locloc(@$));}; |
|
7252 |
CLK_operator: CLK {$$ = new CLK_operator_c(locloc(@$));}; |
|
7253 |
CU_operator: CU {$$ = new CU_operator_c(locloc(@$));}; |
|
7254 |
CD_operator: CD {$$ = new CD_operator_c(locloc(@$));}; |
|
7255 |
PV_operator: PV {$$ = new PV_operator_c(locloc(@$));}; |
|
7256 |
IN_operator: IN {$$ = new IN_operator_c(locloc(@$));}; |
|
7257 |
PT_operator: PT {$$ = new PT_operator_c(locloc(@$));}; |
|
7258 |
AND_operator: AND {$$ = new AND_operator_c(locloc(@$));}; |
|
7259 |
AND2_operator: AND2 {$$ = new AND_operator_c(locloc(@$));}; /* '&' in the source code! */ |
|
7260 |
OR_operator: OR {$$ = new OR_operator_c(locloc(@$));}; |
|
7261 |
XOR_operator: XOR {$$ = new XOR_operator_c(locloc(@$));}; |
|
7262 |
ANDN_operator: ANDN {$$ = new ANDN_operator_c(locloc(@$));}; |
|
7263 |
ANDN2_operator: ANDN2 {$$ = new ANDN_operator_c(locloc(@$));}; /* '&N' in the source code! */ |
|
7264 |
ORN_operator: ORN {$$ = new ORN_operator_c(locloc(@$));}; |
|
7265 |
XORN_operator: XORN {$$ = new XORN_operator_c(locloc(@$));}; |
|
7266 |
ADD_operator: ADD {$$ = new ADD_operator_c(locloc(@$));}; |
|
7267 |
SUB_operator: SUB {$$ = new SUB_operator_c(locloc(@$));}; |
|
7268 |
MUL_operator: MUL {$$ = new MUL_operator_c(locloc(@$));}; |
|
7269 |
DIV_operator: DIV {$$ = new DIV_operator_c(locloc(@$));}; |
|
7270 |
MOD_operator: MOD {$$ = new MOD_operator_c(locloc(@$));}; |
|
7271 |
GT_operator: GT {$$ = new GT_operator_c(locloc(@$));}; |
|
7272 |
GE_operator: GE {$$ = new GE_operator_c(locloc(@$));}; |
|
7273 |
EQ_operator: EQ {$$ = new EQ_operator_c(locloc(@$));}; |
|
7274 |
LT_operator: LT {$$ = new LT_operator_c(locloc(@$));}; |
|
7275 |
LE_operator: LE {$$ = new LE_operator_c(locloc(@$));}; |
|
7276 |
NE_operator: NE {$$ = new NE_operator_c(locloc(@$));}; |
|
7277 |
CAL_operator: CAL {$$ = new CAL_operator_c(locloc(@$));}; |
|
7278 |
CALC_operator: CALC {$$ = new CALC_operator_c(locloc(@$));}; |
|
7279 |
CALCN_operator: CALCN {$$ = new CALCN_operator_c(locloc(@$));}; |
|
7280 |
RET_operator: RET {$$ = new RET_operator_c(locloc(@$));}; |
|
7281 |
RETC_operator: RETC {$$ = new RETC_operator_c(locloc(@$));}; |
|
7282 |
RETCN_operator: RETCN {$$ = new RETCN_operator_c(locloc(@$));}; |
|
7283 |
JMP_operator: JMP {$$ = new JMP_operator_c(locloc(@$));}; |
|
7284 |
JMPC_operator: JMPC {$$ = new JMPC_operator_c(locloc(@$));}; |
|
7285 |
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
|
7286 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7287 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7288 |
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
|
7289 |
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
|
7290 |
| 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7294 |
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
|
7295 |
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
|
7296 |
| 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
|
7297 |
| 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
|
7298 |
| 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
|
7299 |
; |
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
|
7300 |
|
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
|
7301 |
|
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
|
7302 |
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
|
7303 |
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
|
7304 |
| 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
|
7305 |
| 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
|
7306 |
; |
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
|
7307 |
|
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
|
7308 |
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
|
7309 |
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
|
7310 |
; |
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
|
7311 |
|
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
|
7312 |
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
|
7313 |
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
|
7314 |
; |
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
|
7315 |
|
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
|
7316 |
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
|
7317 |
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
|
7318 |
| 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
|
7319 |
| 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
|
7320 |
| 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
|
7321 |
| 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
|
7322 |
| 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
|
7323 |
| 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
|
7324 |
| 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
|
7325 |
| 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
|
7326 |
| 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
|
7327 |
| 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
|
7328 |
; |
0
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 |
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
|
7332 |
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
|
7333 |
| 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
|
7334 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7335 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7336 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7337 |
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
|
7338 |
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
|
7339 |
| 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
|
7340 |
| 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
|
7341 |
| 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
|
7342 |
| 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
|
7343 |
| 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
|
7344 |
| 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
|
7345 |
| 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
|
7346 |
| 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
|
7347 |
| 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
|
7348 |
| 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
|
7349 |
| 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
|
7350 |
| 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
|
7351 |
| 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
|
7352 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7353 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7354 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7355 |
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
|
7356 |
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
|
7357 |
| 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
|
7358 |
| 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
|
7359 |
| 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
|
7360 |
| 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
|
7361 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7362 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7363 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7364 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7365 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7366 |
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
|
7367 |
/* 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
|
7368 |
any_identifier ASSIGN |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7369 |
{$$ = 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
|
7370 |
| en_identifier ASSIGN |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7371 |
{$$ = new il_assign_operator_c($1, locloc(@$));} |
239
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7372 |
| S1_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7373 |
{$$ = 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
|
7374 |
| R1_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7375 |
{$$ = 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
|
7376 |
| CLK_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7377 |
{$$ = 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
|
7378 |
| CU_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7379 |
{$$ = 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
|
7380 |
| CD_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7381 |
{$$ = 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
|
7382 |
| PV_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7383 |
{$$ = 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
|
7384 |
| IN_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7385 |
{$$ = 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
|
7386 |
| PT_operator ASSIGN |
b3063ca418c1
Bug when parsing standard function block call in IL
laurent
parents:
207
diff
changeset
|
7387 |
{$$ = new il_assign_operator_c(il_operator_c_2_identifier_c($1), locloc(@$));} |
131 | 7388 |
/* ERROR_CHECK_BEGIN */ |
7389 |
| error ASSIGN |
|
136 | 7390 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter assignment."); yyerrok;} |
131 | 7391 |
/* 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
|
7392 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7393 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7394 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7395 |
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
|
7396 |
/* 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
|
7397 |
/* 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
|
7398 |
sendto_identifier SENDTO |
68 | 7399 |
{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));} |
257 | 7400 |
/* The following is not required, as the sendto_identifier_token returned by flex will |
7401 |
* also include the 'ENO' identifier. |
|
7402 |
* The resulting abstract syntax tree is identical with or without this following rule, |
|
7403 |
* as both the eno_identifier and the sendto_identifier are stored as |
|
7404 |
* 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
|
7405 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7406 |
* 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
|
7407 |
* please read the comment above the definition of 'variable' in section B1.4 for details. |
257 | 7408 |
*/ |
7409 |
/* |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7410 |
| eno_identifier SENDTO |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7411 |
{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));} |
257 | 7412 |
*/ |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7413 |
/*| 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
|
7414 |
| NOT sendto_identifier SENDTO |
68 | 7415 |
{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));} |
257 | 7416 |
/* The following is not required, as the sendto_identifier_token returned by flex will |
7417 |
* also include the 'ENO' identifier. |
|
7418 |
* The resulting abstract syntax tree is identical with or without this following rule, |
|
7419 |
* as both the eno_identifier and the sendto_identifier are stored as |
|
7420 |
* an identifier_c !! |
|
7421 |
* |
|
315
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
7422 |
* 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
|
7423 |
* 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
|
7424 |
* |
257 | 7425 |
* NOTE: Removing the following rule also removes a shift/reduce conflict from the parser. |
7426 |
* This conflict is not really an error/ambiguity in the syntax, but rather |
|
7427 |
* due to the fact that more than a single look-ahead token would be required |
|
7428 |
* to correctly parse the syntax, something that bison does not support. |
|
7429 |
* |
|
7430 |
* The shift/reduce conflict arises because bison does not know whether |
|
7431 |
* to parse the 'NOT ENO' in the following code |
|
7432 |
* LD 1 |
|
7433 |
* funct_name ( |
|
7434 |
* NOT ENO => bool_var, |
|
7435 |
* EN := TRUE |
|
7436 |
* ) |
|
7437 |
* as either a il_param_assignment (wrong!) or an il_param_out_assignment.(correct). |
|
7438 |
* The '=>' delimiter (known as SEND_TO in this iec.y file) is a dead giveaway that |
|
7439 |
* it should be parsed as an il_param_out_assignment, but still, bison gets confused! |
|
7440 |
* Bison considers the possibility of reducing the 'NOT ENO' as an NOT_operator with |
|
7441 |
* the 'ENO' operand |
|
7442 |
* (NOT_operator -> il_simple_operator -> il_simple_operation -> il_simple_instruction -> |
|
7443 |
* -> simple_instr_list -> il_param_assignment) |
|
7444 |
* instead of reducing it to an il_param_out_operator. |
|
7445 |
* ( il_param_out_operator -> il_param_out_assignment) |
|
7446 |
* |
|
7447 |
* Note that the shift/reduce conflict only manifests itself in the il_formal_funct_call, |
|
7448 |
* where both the il_param_out_assignment and il_param_assignment are used! |
|
7449 |
* |
|
7450 |
* il_param_out_assignment --+--> il_param_instruction -> il_param_instruction_list --+ |
|
7451 |
* | | |
|
7452 |
* il_param_assignment --+ | |
|
7453 |
* | |
|
7454 |
* il_formal_funct_call <- il_param_list <-+ |
|
7455 |
* |
|
7456 |
*/ |
|
7457 |
/* |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7458 |
| NOT eno_identifier SENDTO |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
7459 |
{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));} |
257 | 7460 |
*/ |
131 | 7461 |
/* ERROR_CHECK_BEGIN */ |
7462 |
| error SENDTO |
|
136 | 7463 |
{$$ = 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
|
7464 |
| NOT SENDTO |
136 | 7465 |
{$$ = 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
|
7466 |
| NOT error SENDTO |
136 | 7467 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter defined in parameter out assignment."); yyerrok;} |
131 | 7468 |
/* 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
|
7469 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7470 |
|
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 |
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
|
7473 |
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
|
7474 |
| 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
|
7475 |
| 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
|
7476 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7477 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7478 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7479 |
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
|
7480 |
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
|
7481 |
| 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
|
7482 |
| 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
|
7483 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7484 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7485 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7486 |
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
|
7487 |
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
|
7488 |
| 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
|
7489 |
| 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
|
7490 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7491 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7492 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7493 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7494 |
/* 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
|
7495 |
/***********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7496 |
expression: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7497 |
xor_expression |
933
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
7498 |
| ref_expression /* an extension to the IEC 61131-3 v2 standard, based on the IEC 61131-3 v3 standard */ |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
7499 |
| deref_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
|
7500 |
| expression OR xor_expression |
68 | 7501 |
{$$ = new or_expression_c($1, $3, locloc(@$));} |
131 | 7502 |
/* ERROR_CHECK_BEGIN */ |
7503 |
| expression OR error |
|
7504 |
{$$ = NULL; |
|
136 | 7505 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'OR' in ST expression.");} |
7506 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'OR' in ST expression."); yyclearin;} |
|
131 | 7507 |
yyerrok; |
7508 |
} |
|
7509 |
/* 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
|
7510 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7511 |
|
873
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7512 |
/* REF(var_name) */ |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7513 |
/* 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
|
7514 |
/* 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
|
7515 |
ref_expression: |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7516 |
REF '(' symbolic_variable ')' |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7517 |
{$$ = 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
|
7518 |
; |
dea39ef02847
Add limited support for the REF() operator (defined in v3 of IEC 61131-3)
mjsousa
parents:
862
diff
changeset
|
7519 |
|
933
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
7520 |
/* DREF(var_name) */ |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
7521 |
/* This is an extension to the IEC 61131-3 standard. It is actually defined in the IEC 61131-3 v3 standard */ |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
7522 |
/* The DREF() operator accesses the variable stored in the specified address. Basically, it dereferences a pointer to the variable */ |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
7523 |
deref_expression: |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
7524 |
DREF '(' symbolic_variable ')' |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
7525 |
{$$ = new deref_expression_c($3, locloc(@$));} |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
7526 |
; |
76324f461aed
Add support for de-referencing of REF_TO datatypes (Note: dereferencing of arrays and structs not yet supported!)
mjsousa
parents:
932
diff
changeset
|
7527 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7528 |
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
|
7529 |
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
|
7530 |
| xor_expression XOR and_expression |
68 | 7531 |
{$$ = new xor_expression_c($1, $3, locloc(@$));} |
131 | 7532 |
/* ERROR_CHECK_BEGIN */ |
7533 |
| xor_expression XOR error |
|
7534 |
{$$ = NULL; |
|
136 | 7535 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'XOR' in ST expression.");} |
7536 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'XOR' in ST expression."); yyclearin;} |
|
131 | 7537 |
yyerrok; |
7538 |
} |
|
7539 |
/* 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
|
7540 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7541 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7542 |
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
|
7543 |
comparison |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7544 |
| and_expression '&' comparison |
68 | 7545 |
{$$ = 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
|
7546 |
| and_expression AND comparison |
68 | 7547 |
{$$ = 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
|
7548 |
/* 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
|
7549 |
* 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
|
7550 |
* AND2! |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7551 |
* 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
|
7552 |
* but we leave it in nevertheless just in case we later decide |
136 | 7553 |
* 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
|
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 |
| and_expression AND2 comparison |
68 | 7556 |
{$$ = new and_expression_c($1, $3, locloc(@$));} |
131 | 7557 |
/* ERROR_CHECK_BEGIN */ |
7558 |
| and_expression '&' error |
|
7559 |
{$$ = NULL; |
|
136 | 7560 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '&' in ST expression.");} |
7561 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '&' in ST expression."); yyclearin;} |
|
131 | 7562 |
yyerrok; |
7563 |
} |
|
7564 |
| and_expression AND error |
|
7565 |
{$$ = NULL; |
|
136 | 7566 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'AND' in ST expression.");} |
7567 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'AND' in ST expression."); yyclearin;} |
|
131 | 7568 |
yyerrok; |
7569 |
} |
|
7570 |
| and_expression AND2 error |
|
7571 |
{$$ = NULL; |
|
136 | 7572 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '&' in ST expression.");} |
7573 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '&' in ST expression."); yyclearin;} |
|
131 | 7574 |
yyerrok; |
7575 |
} |
|
7576 |
/* 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
|
7577 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7578 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7579 |
comparison: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7580 |
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
|
7581 |
| comparison '=' equ_expression |
68 | 7582 |
{$$ = 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
|
7583 |
| comparison OPER_NE equ_expression |
68 | 7584 |
{$$ = new notequ_expression_c($1, $3, locloc(@$));} |
131 | 7585 |
/* ERROR_CHECK_BEGIN */ |
7586 |
| comparison '=' error |
|
7587 |
{$$ = NULL; |
|
136 | 7588 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '=' in ST expression.");} |
7589 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '=' in ST expression."); yyclearin;} |
|
131 | 7590 |
yyerrok; |
7591 |
} |
|
7592 |
| comparison OPER_NE error |
|
7593 |
{$$ = NULL; |
|
136 | 7594 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '<>' in ST expression.");} |
7595 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '<>' in ST expression."); yyclearin;} |
|
131 | 7596 |
yyerrok; |
7597 |
} |
|
7598 |
/* 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
|
7599 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7600 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7601 |
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
|
7602 |
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
|
7603 |
| equ_expression '<' add_expression |
68 | 7604 |
{$$ = 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
|
7605 |
| equ_expression '>' add_expression |
68 | 7606 |
{$$ = 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
|
7607 |
| equ_expression OPER_LE add_expression |
68 | 7608 |
{$$ = 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
|
7609 |
| equ_expression OPER_GE add_expression |
68 | 7610 |
{$$ = new ge_expression_c($1, $3, locloc(@$));} |
131 | 7611 |
/* ERROR_CHECK_BEGIN */ |
7612 |
| equ_expression '<' error |
|
7613 |
{$$ = NULL; |
|
136 | 7614 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '<' in ST expression.");} |
7615 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '<' in ST expression."); yyclearin;} |
|
131 | 7616 |
yyerrok; |
7617 |
} |
|
7618 |
| equ_expression '>' error |
|
7619 |
{$$ = NULL; |
|
136 | 7620 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '>' in ST expression.");} |
7621 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '>' in ST expression."); yyclearin;} |
|
131 | 7622 |
yyerrok; |
7623 |
} |
|
7624 |
| equ_expression OPER_LE error |
|
7625 |
{$$ = NULL; |
|
136 | 7626 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '<=' in ST expression.");} |
7627 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '<=' in ST expression."); yyclearin;} |
|
131 | 7628 |
yyerrok; |
7629 |
} |
|
7630 |
| equ_expression OPER_GE error |
|
7631 |
{$$ = NULL; |
|
136 | 7632 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '>=' in ST expression.");} |
7633 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '>=' in ST expression."); yyclearin;} |
|
131 | 7634 |
yyerrok; |
7635 |
} |
|
7636 |
/* 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
|
7637 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7638 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7639 |
/* 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
|
7640 |
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
|
7641 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7642 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7643 |
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
|
7644 |
term |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7645 |
| add_expression '+' term |
68 | 7646 |
{$$ = 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
|
7647 |
| add_expression '-' term |
68 | 7648 |
{$$ = new sub_expression_c($1, $3, locloc(@$));} |
131 | 7649 |
/* ERROR_CHECK_BEGIN */ |
7650 |
| add_expression '+' error |
|
7651 |
{$$ = NULL; |
|
136 | 7652 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '+' in ST expression.");} |
7653 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '+' in ST expression."); yyclearin;} |
|
131 | 7654 |
yyerrok; |
7655 |
} |
|
7656 |
| add_expression '-' error |
|
7657 |
{$$ = NULL; |
|
136 | 7658 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '-' in ST expression.");} |
7659 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '-' in ST expression."); yyclearin;} |
|
131 | 7660 |
yyerrok; |
7661 |
} |
|
7662 |
/* 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
|
7663 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7664 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7665 |
/* 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
|
7666 |
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
|
7667 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7668 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7669 |
term: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7670 |
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
|
7671 |
| term '*' power_expression |
68 | 7672 |
{$$ = 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
|
7673 |
| term '/' power_expression |
68 | 7674 |
{$$ = 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
|
7675 |
| term MOD power_expression |
68 | 7676 |
{$$ = new mod_expression_c($1, $3, locloc(@$));} |
131 | 7677 |
/* ERROR_CHECK_BEGIN */ |
7678 |
| term '*' error |
|
7679 |
{$$ = NULL; |
|
136 | 7680 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '*' in ST expression.");} |
7681 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '*' in ST expression."); yyclearin;} |
|
131 | 7682 |
yyerrok; |
7683 |
} |
|
7684 |
| term '/' error |
|
7685 |
{$$ = NULL; |
|
136 | 7686 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '/' in ST expression.");} |
7687 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '/' in ST expression."); yyclearin;} |
|
131 | 7688 |
yyerrok; |
7689 |
} |
|
7690 |
| term MOD error |
|
7691 |
{$$ = NULL; |
|
136 | 7692 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'MOD' in ST expression.");} |
7693 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'MOD' in ST expression."); yyclearin;} |
|
131 | 7694 |
yyerrok; |
7695 |
} |
|
7696 |
/* 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
|
7697 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7698 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7699 |
/* 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
|
7700 |
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
|
7701 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7702 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7703 |
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
|
7704 |
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
|
7705 |
| power_expression OPER_EXP unary_expression |
68 | 7706 |
{$$ = new power_expression_c($1, $3, locloc(@$));} |
131 | 7707 |
/* ERROR_CHECK_BEGIN */ |
7708 |
| power_expression OPER_EXP error |
|
7709 |
{$$ = NULL; |
|
136 | 7710 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '**' in ST expression.");} |
7711 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after '**' in ST expression."); yyclearin;} |
|
131 | 7712 |
yyerrok; |
7713 |
} |
|
7714 |
/* 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
|
7715 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7716 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7717 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7718 |
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
|
7719 |
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
|
7720 |
| '-' non_int_or_real_primary_expression |
68 | 7721 |
{$$ = 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
|
7722 |
| NOT primary_expression |
68 | 7723 |
{$$ = new not_expression_c($2, locloc(@$));} |
131 | 7724 |
/* ERROR_CHECK_BEGIN */ |
7725 |
| '-' error |
|
7726 |
{$$ = NULL; |
|
136 | 7727 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no expression defined after '-' in ST expression.");} |
7728 |
else {print_err_msg(locf(@2), locl(@2), "invalid expression after '-' in ST expression."); yyclearin;} |
|
131 | 7729 |
yyerrok; |
7730 |
} |
|
7731 |
| NOT error |
|
7732 |
{$$ = NULL; |
|
136 | 7733 |
if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no expression defined after 'NOT' in ST expression.");} |
7734 |
else {print_err_msg(locf(@2), locl(@2), "invalid expression after 'NOT' in ST expression."); yyclearin;} |
|
131 | 7735 |
yyerrok; |
7736 |
} |
|
7737 |
/* 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
|
7738 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7739 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7740 |
/* 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
|
7741 |
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
|
7742 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7743 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7744 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7745 |
/* 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
|
7746 |
* 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
|
7747 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7748 |
* 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
|
7749 |
* 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
|
7750 |
* (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
|
7751 |
* OR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7752 |
* 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
|
7753 |
* (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
|
7754 |
* |
257 | 7755 |
* 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
|
7756 |
* 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
|
7757 |
* (i.e. a '-' or '+' character) to be used in primary_expression |
257 | 7758 |
* (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
|
7759 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7760 |
* 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
|
7761 |
* 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
|
7762 |
* 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
|
7763 |
*/ |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7764 |
/* 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
|
7765 |
* 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
|
7766 |
* 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
|
7767 |
* 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
|
7768 |
* 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
|
7769 |
* 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
|
7770 |
* 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
|
7771 |
* 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
|
7772 |
* 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
|
7773 |
* 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
|
7774 |
* 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
|
7775 |
* 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
|
7776 |
* 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
|
7777 |
* 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
|
7778 |
* 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
|
7779 |
* 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
|
7780 |
* 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
|
7781 |
* |
1cc0e1ca2aad
Fix constant folding: now handles INT_MIN and neg_integer_c correctly.
Mario de Sousa <msousa@fe.up.pt>
parents:
616
diff
changeset
|
7782 |
* 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
|
7783 |
* 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
|
7784 |
*/ |
13 | 7785 |
/* NOTE: We use enumerated_value_without_identifier instead of enumerated_value |
7786 |
* in order to remove a reduce/reduce conflict between reducing an |
|
7787 |
* identifier to a variable or an enumerated_value. |
|
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
7788 |
* |
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
7789 |
* This change follows the IEC specification. The specification seems to |
85 | 7790 |
* imply (by introducing syntax that allows to unambiguosly reference an |
7791 |
* 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
|
7792 |
* for a variable and an enumerated value, then the variable shall be |
85 | 7793 |
* considered. |
13 | 7794 |
*/ |
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
|
7795 |
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
|
7796 |
non_int_or_real_constant |
85 | 7797 |
//| enumerated_value_without_identifier |
7798 |
| 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
|
7799 |
| variable |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7800 |
| '(' expression ')' |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7801 |
{$$ = $2;} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7802 |
| function_invocation |
131 | 7803 |
/* ERROR_CHECK_BEGIN */ |
7804 |
| '(' expression error |
|
136 | 7805 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of expression in ST expression."); yyerrok;} |
131 | 7806 |
/* 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
|
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 |
|
257 | 7810 |
primary_expression: |
7811 |
constant |
|
7812 |
//| 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
|
7813 |
| enumerated_value |
257 | 7814 |
| variable |
7815 |
| '(' expression ')' |
|
7816 |
{$$ = $2;} |
|
7817 |
| function_invocation |
|
7818 |
/* ERROR_CHECK_BEGIN */ |
|
7819 |
| '(' expression error |
|
7820 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of expression in ST expression."); yyerrok;} |
|
7821 |
/* ERROR_CHECK_END */ |
|
7822 |
; |
|
7823 |
||
7824 |
||
7825 |
||
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7826 |
/* 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
|
7827 |
/* 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
|
7828 |
* 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
|
7829 |
* 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
|
7830 |
* 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
|
7831 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7832 |
* 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
|
7833 |
* 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
|
7834 |
* 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
|
7835 |
* with |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7836 |
* 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
|
7837 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7838 |
* 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
|
7839 |
* 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
|
7840 |
* 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
|
7841 |
* 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
|
7842 |
* 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
|
7843 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7844 |
* 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
|
7845 |
* 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
|
7846 |
* 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
|
7847 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7848 |
* 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
|
7849 |
* 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
|
7850 |
* 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
|
7851 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7852 |
function_invocation: |
85 | 7853 |
/* function_name '(' [param_assignment_list] ')' */ |
7854 |
function_name_no_NOT_clashes '(' param_assignment_formal_list ')' |
|
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
7855 |
{$$ = new function_invocation_c($1, $3, NULL, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_c |
85 | 7856 |
| function_name_no_NOT_clashes '(' param_assignment_nonformal_list ')' |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
7857 |
{$$ = new function_invocation_c($1, NULL, $3, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_c |
1012
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
7858 |
| function_name_no_NOT_clashes '(' ')' |
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
7859 |
{if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR; // $1 should be a poutype_identifier_c |
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
7860 |
if (runtime_options.allow_missing_var_in) |
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
7861 |
{$$ = new function_invocation_c($1, NULL, NULL, locloc(@$));} |
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
7862 |
else |
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
7863 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no parameter defined in function invocation of ST expression."); yynerrs++;} |
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
7864 |
} |
131 | 7865 |
/* ERROR_CHECK_BEGIN */ |
7866 |
| function_name_no_NOT_clashes param_assignment_formal_list ')' |
|
136 | 7867 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function name in ST expression."); yynerrs++;} |
131 | 7868 |
| function_name_no_NOT_clashes '(' error ')' |
136 | 7869 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid parameter(s) defined in function invocation of ST expression."); yyerrok;} |
131 | 7870 |
| function_name_no_NOT_clashes '(' param_assignment_formal_list error |
136 | 7871 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of function invocation in ST expression."); yyerrok;} |
131 | 7872 |
| function_name_no_NOT_clashes '(' param_assignment_nonformal_list error |
136 | 7873 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of function invocation in ST expression."); yyerrok;} |
131 | 7874 |
/* 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
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7878 |
/********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7879 |
/* 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
|
7880 |
/********************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7881 |
statement_list: |
13 | 7882 |
statement ';' |
68 | 7883 |
{$$ = 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
|
7884 |
| any_pragma |
68 | 7885 |
{$$ = 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
|
7886 |
| 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
|
7887 |
{$$ = $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
|
7888 |
| 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
|
7889 |
{$$ = $1; $$->add_element($2);} |
68 | 7890 |
/* ERROR_CHECK_BEGIN */ |
133 | 7891 |
| statement error |
136 | 7892 |
{$$ = new statement_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at the end of statement in ST statement."); yyerrok;} |
133 | 7893 |
| statement_list statement error |
136 | 7894 |
{$$ = $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
|
7895 |
| statement_list error ';' |
136 | 7896 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid statement in ST statement."); yyerrok;} |
133 | 7897 |
| statement_list ';' |
136 | 7898 |
{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after statement in ST statement."); yynerrs++;} |
68 | 7899 |
/* 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
|
7900 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7901 |
|
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 |
statement: |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7904 |
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
|
7905 |
| 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
|
7906 |
| 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
|
7907 |
| iteration_statement |
1019
1e3cefbbdee2
Only allow function invocation outside ST expressions when command line option is activated.
mjsousa
parents:
1016
diff
changeset
|
7908 |
| function_invocation |
1e3cefbbdee2
Only allow function invocation outside ST expressions when command line option is activated.
mjsousa
parents:
1016
diff
changeset
|
7909 |
{ /* This is a non-standard extension (calling a function outside an ST expression!) */ |
1e3cefbbdee2
Only allow function invocation outside ST expressions when command line option is activated.
mjsousa
parents:
1016
diff
changeset
|
7910 |
/* Only allow this if command line option has been selected... */ |
1e3cefbbdee2
Only allow function invocation outside ST expressions when command line option is activated.
mjsousa
parents:
1016
diff
changeset
|
7911 |
$$ = $1; |
1e3cefbbdee2
Only allow function invocation outside ST expressions when command line option is activated.
mjsousa
parents:
1016
diff
changeset
|
7912 |
if (!runtime_options.allow_void_datatype) { |
1e3cefbbdee2
Only allow function invocation outside ST expressions when command line option is activated.
mjsousa
parents:
1016
diff
changeset
|
7913 |
print_err_msg(locf(@1), locl(@1), "Function invocation in ST code is not allowed outside an expression. To allow this non-standard syntax, activate the apropriate command line option."); |
1e3cefbbdee2
Only allow function invocation outside ST expressions when command line option is activated.
mjsousa
parents:
1016
diff
changeset
|
7914 |
yynerrs++; |
1e3cefbbdee2
Only allow function invocation outside ST expressions when command line option is activated.
mjsousa
parents:
1016
diff
changeset
|
7915 |
} |
1e3cefbbdee2
Only allow function invocation outside ST expressions when command line option is activated.
mjsousa
parents:
1016
diff
changeset
|
7916 |
} |
0
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7919 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7920 |
/*********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7921 |
/* 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
|
7922 |
/*********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7923 |
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
|
7924 |
variable ASSIGN expression |
68 | 7925 |
{$$ = new assignment_statement_c($1, $3, locloc(@$));} |
131 | 7926 |
/* ERROR_CHECK_BEGIN */ |
136 | 7927 |
| error ASSIGN expression |
7928 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid variable before ':=' in ST assignment statement."); yyerrok;} |
|
131 | 7929 |
| variable ASSIGN error |
133 | 7930 |
{$$ = NULL; |
136 | 7931 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after ':=' in ST assignment statement.");} |
7932 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression after ':=' in ST assignment statement."); yyclearin;} |
|
131 | 7933 |
yyerrok; |
7934 |
} |
|
7935 |
/* 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
|
7936 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7937 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7938 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7939 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7940 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7941 |
/*****************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7942 |
/* 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
|
7943 |
/*****************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7944 |
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
|
7945 |
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
|
7946 |
| 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
|
7947 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7948 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7949 |
return_statement: |
68 | 7950 |
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
|
7951 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7952 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7953 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7954 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7955 |
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
|
7956 |
prev_declared_fb_name '(' ')' |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
7957 |
{$$ = new fb_invocation_c($1, NULL, NULL, locloc(@$)); } |
85 | 7958 |
| 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
|
7959 |
{$$ = new fb_invocation_c($1, $3, NULL, locloc(@$));} |
85 | 7960 |
| 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
|
7961 |
{$$ = new fb_invocation_c($1, NULL, $3, locloc(@$));} |
131 | 7962 |
/* ERROR_CHECK_BEGIN */ |
7963 |
| prev_declared_fb_name ')' |
|
136 | 7964 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function block name in ST statement."); yynerrs++;} |
131 | 7965 |
| prev_declared_fb_name param_assignment_formal_list ')' |
136 | 7966 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function block name in ST statement."); yynerrs++;} |
131 | 7967 |
| prev_declared_fb_name '(' error ')' |
136 | 7968 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid parameter list in function block invocation in ST statement."); yyerrok;} |
131 | 7969 |
| prev_declared_fb_name '(' error |
136 | 7970 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing after parameter list of function block invocation in ST statement."); yyerrok;} |
131 | 7971 |
| prev_declared_fb_name '(' param_assignment_formal_list error |
136 | 7972 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after parameter list of function block invocation in ST statement."); yyerrok;} |
131 | 7973 |
| prev_declared_fb_name '(' param_assignment_nonformal_list error |
136 | 7974 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after parameter list of function block invocation in ST statement."); yyerrok;} |
131 | 7975 |
/* 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
|
7976 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7977 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7978 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7979 |
/* 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
|
7980 |
* - 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
|
7981 |
* - 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
|
7982 |
*/ |
85 | 7983 |
param_assignment_formal_list: |
7984 |
param_assignment_formal |
|
68 | 7985 |
{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);} |
85 | 7986 |
| 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
|
7987 |
{$$ = $1; $$->add_element($3);} |
131 | 7988 |
/* ERROR_CHECK_BEGIN */ |
7989 |
| param_assignment_formal_list ',' error |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
7990 |
{$$ = $1; |
136 | 7991 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no parameter assignment defined in ST parameter assignment list.");} |
7992 |
else {print_err_msg(locf(@3), locl(@3), "invalid parameter assignment in ST parameter assignment list."); yyclearin;} |
|
131 | 7993 |
yyerrok; |
7994 |
} |
|
7995 |
/* 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
|
7996 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
7997 |
|
85 | 7998 |
/* helper symbol for |
7999 |
* - fb_invocation |
|
8000 |
* - function_invocation |
|
8001 |
*/ |
|
8002 |
param_assignment_nonformal_list: |
|
8003 |
param_assignment_nonformal |
|
8004 |
{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);} |
|
8005 |
| param_assignment_nonformal_list ',' param_assignment_nonformal |
|
8006 |
{$$ = $1; $$->add_element($3);} |
|
131 | 8007 |
/* ERROR_CHECK_BEGIN */ |
8008 |
| param_assignment_nonformal_list ',' error |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
8009 |
{$$ = $1; |
136 | 8010 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no parameter assignment defined in ST parameter assignment list.");} |
8011 |
else {print_err_msg(locf(@3), locl(@3), "invalid parameter assignment in ST parameter assignment list."); yyclearin;} |
|
131 | 8012 |
yyerrok; |
8013 |
} |
|
8014 |
/* ERROR_CHECK_END */ |
|
85 | 8015 |
; |
8016 |
||
8017 |
||
8018 |
/* NOTE: According to the IEC 61131-3 standard, there are two possible |
|
8019 |
* syntaxes for calling function blocks within ST. |
|
8020 |
* The formal method has the form: |
|
8021 |
* fb ( invar := x, inoutvar := var1, outvar => var2); |
|
8022 |
* The non-formal method has the form: |
|
8023 |
* fb (x, var1, var2); |
|
8024 |
* In the text of IEC 61131-3 (where the semantics are defined), |
|
8025 |
* it is obvious that mixing the two syntaxes is considered incorrect. |
|
8026 |
* The following should therefore be incorrect: |
|
8027 |
* fb ( invar := x, var1, var2); |
|
8028 |
* However, according to the syntax definition, as defined in IEC 61131-3, |
|
8029 |
* mixing the formal and non-formal methods of invocation is allowed. |
|
8030 |
* We have two alternatives: |
|
8031 |
* (a) implement the syntax here in iec.y according to the standard, |
|
8032 |
* and leave it to the semantic analyser stage to find this error |
|
8033 |
* (b) or implement the syntax in iec.y correctly, not allowing |
|
8034 |
* the mixing of formal and non-formal invocation syntaxes. |
|
8035 |
* Considering that this is a syntax issue, and not semantic issue, |
|
8036 |
* I (Mario) have decided to go with alternative (a). |
|
8037 |
* In other words, in iec.y we do not follow the syntax as defined in |
|
8038 |
* Annex B of the IEC 61131-3 standard, but rather implement |
|
8039 |
* the syntax also taking into account the textual part of the standard too. |
|
8040 |
*/ |
|
8041 |
/* |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8042 |
param_assignment: |
85 | 8043 |
variable_name ASSIGN expression |
8044 |
*/ |
|
8045 |
param_assignment_nonformal: |
|
8046 |
expression |
|
8047 |
; |
|
8048 |
||
8049 |
||
8050 |
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
|
8051 |
any_identifier ASSIGN expression |
68 | 8052 |
{$$ = 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
|
8053 |
| en_identifier ASSIGN expression |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8054 |
{$$ = 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
|
8055 |
/*| 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
|
8056 |
/*| 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
|
8057 |
| sendto_identifier SENDTO variable |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8058 |
{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));} |
257 | 8059 |
/* The following is not required, as the sendto_identifier_token returned by flex will |
8060 |
* also include the 'ENO' identifier. |
|
8061 |
* The resulting abstract syntax tree is identical with or without this following rule, |
|
8062 |
* as both the eno_identifier and the sendto_identifier are stored as |
|
8063 |
* 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
|
8064 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
8065 |
* 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
|
8066 |
* please read the comment above the definition of 'variable' in section B1.4 for details. |
257 | 8067 |
*/ |
8068 |
/* |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8069 |
| eno_identifier SENDTO variable |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8070 |
{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));} |
257 | 8071 |
*/ |
85 | 8072 |
/*| 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
|
8073 |
/*| 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
|
8074 |
| NOT sendto_identifier SENDTO variable |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8075 |
{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));} |
257 | 8076 |
/* The following is not required, as the sendto_identifier_token returned by flex will |
8077 |
* also include the 'ENO' identifier. |
|
8078 |
* The resulting abstract syntax tree is identical with or without this following rule, |
|
8079 |
* as both the eno_identifier and the sendto_identifier are stored as |
|
8080 |
* 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
|
8081 |
* |
c62a4078f269
Allow use of ENO keyword in structured variable field selector.
Mario de Sousa <msousa@fe.up.pt>
parents:
311
diff
changeset
|
8082 |
* 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
|
8083 |
* please read the comment above the definition of 'variable' in section B1.4 for details. |
257 | 8084 |
*/ |
8085 |
/* |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8086 |
| NOT eno_identifier SENDTO variable |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8087 |
{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));} |
257 | 8088 |
*/ |
131 | 8089 |
/* ERROR_CHECK_BEGIN */ |
8090 |
| any_identifier ASSIGN error |
|
8091 |
{$$ = NULL; |
|
136 | 8092 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");} |
8093 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;} |
|
8094 |
yyerrok; |
|
8095 |
} |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8096 |
| en_identifier ASSIGN error |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8097 |
{$$ = NULL; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8098 |
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
|
8099 |
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
|
8100 |
yyerrok; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8101 |
} |
131 | 8102 |
| sendto_identifier SENDTO error |
8103 |
{$$ = NULL; |
|
136 | 8104 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");} |
8105 |
else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;} |
|
131 | 8106 |
yyerrok; |
8107 |
} |
|
257 | 8108 |
/* |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8109 |
| eno_identifier SENDTO error |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8110 |
{$$ = NULL; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8111 |
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
|
8112 |
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
|
8113 |
yyerrok; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8114 |
} |
257 | 8115 |
*/ |
131 | 8116 |
| NOT SENDTO variable |
136 | 8117 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter name defined in ST formal parameter out negated assignment."); yynerrs++;} |
131 | 8118 |
| NOT error SENDTO variable |
136 | 8119 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter name defined in ST formal parameter out negated assignment."); yyerrok;} |
131 | 8120 |
| NOT sendto_identifier SENDTO error |
8121 |
{$$ = NULL; |
|
136 | 8122 |
if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");} |
8123 |
else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;} |
|
131 | 8124 |
yyerrok; |
8125 |
} |
|
257 | 8126 |
/* |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8127 |
| NOT eno_identifier SENDTO error |
143
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8128 |
{$$ = NULL; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8129 |
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
|
8130 |
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
|
8131 |
yyerrok; |
73372bdeeffb
Adding support for EN/ENO parameters in bison rules
lbessard
parents:
142
diff
changeset
|
8132 |
} |
257 | 8133 |
*/ |
131 | 8134 |
/* 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
|
8135 |
; |
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8138 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8139 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8140 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8141 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8142 |
/* 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
|
8143 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8144 |
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
|
8145 |
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
|
8146 |
| 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
|
8147 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8148 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8149 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8150 |
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
|
8151 |
IF expression THEN statement_list elseif_statement_list END_IF |
68 | 8152 |
{$$ = 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
|
8153 |
| IF expression THEN statement_list elseif_statement_list ELSE statement_list END_IF |
68 | 8154 |
{$$ = new if_statement_c($2, $4, $5, $7, locloc(@$));} |
131 | 8155 |
/* ERROR_CHECK_BEGIN */ |
8156 |
| IF THEN statement_list elseif_statement_list END_IF |
|
136 | 8157 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'IF' statement."); yynerrs++;} |
131 | 8158 |
| IF THEN statement_list elseif_statement_list ELSE statement_list END_IF |
136 | 8159 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'IF' statement."); yynerrs++;} |
131 | 8160 |
| IF error THEN statement_list elseif_statement_list END_IF |
136 | 8161 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'IF' statement."); yyerrok;} |
131 | 8162 |
| IF error THEN statement_list elseif_statement_list ELSE statement_list END_IF |
136 | 8163 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'IF' statement."); yyerrok;} |
131 | 8164 |
| IF expression error statement_list elseif_statement_list END_IF |
136 | 8165 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'THEN' after test expression in ST 'IF' statement."); yyerrok;} |
131 | 8166 |
| IF expression error statement_list elseif_statement_list ELSE statement_list END_IF |
136 | 8167 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'THEN' after test expression in ST 'IF' statement."); yyerrok;} |
131 | 8168 |
| IF expression THEN elseif_statement_list END_IF |
136 | 8169 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no statement defined after 'THEN' in ST 'IF' statement."); yynerrs++;} |
131 | 8170 |
| IF expression THEN elseif_statement_list ELSE statement_list END_IF |
136 | 8171 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no statement defined after 'THEN' in ST 'IF' statement."); yynerrs++;} |
131 | 8172 |
| IF expression THEN statement_list elseif_statement_list ELSE END_IF |
136 | 8173 |
{$$ = NULL; print_err_msg(locl(@6), locf(@7), "no statement defined after 'ELSE' in ST 'IF' statement."); yynerrs++;} |
131 | 8174 |
| IF expression THEN statement_list elseif_statement_list ELSE error END_IF |
136 | 8175 |
{$$ = NULL; print_err_msg(locf(@7), locl(@7), "invalid statement defined after 'ELSE' in ST 'IF' statement."); yynerrs++; yyerrok;} |
8176 |
| IF expression error END_OF_INPUT |
|
8177 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed 'IF' statement in ST."); yyerrok;} |
|
8178 |
| IF expression THEN statement_list elseif_statement_list END_OF_INPUT |
|
8179 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'IF' statement in ST."); yynerrs++;} |
|
8180 |
| IF expression THEN statement_list elseif_statement_list ELSE statement_list END_OF_INPUT |
|
8181 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'IF' statement in ST."); yynerrs++;} |
|
131 | 8182 |
| IF error END_IF |
136 | 8183 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'IF' statement."); yyerrok;} |
131 | 8184 |
/* 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
|
8185 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8186 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8187 |
/* 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
|
8188 |
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
|
8189 |
/* empty */ |
68 | 8190 |
{$$ = 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
|
8191 |
| 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
|
8192 |
{$$ = $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
|
8193 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8194 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8195 |
/* 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
|
8196 |
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
|
8197 |
ELSIF expression THEN statement_list |
68 | 8198 |
{$$ = new elseif_statement_c($2, $4, locloc(@$));} |
131 | 8199 |
/* ERROR_CHECK_BEGIN */ |
8200 |
| ELSIF THEN statement_list |
|
136 | 8201 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined for 'ELSEIF' statement in ST 'IF' statement."); yynerrs++;} |
131 | 8202 |
| ELSIF error THEN statement_list |
136 | 8203 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for 'ELSEIF' statement in ST 'IF' statement."); yyerrok;} |
131 | 8204 |
| ELSIF expression error statement_list |
136 | 8205 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'THEN' after test expression in 'ELSEIF' statement of ST 'IF' statement."); yyerrok;} |
131 | 8206 |
| ELSIF expression THEN error |
136 | 8207 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid statement list in 'ELSEIF' statement of ST 'IF' statement."); yyerrok;} |
131 | 8208 |
/* 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
|
8209 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8210 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8211 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8212 |
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
|
8213 |
CASE expression OF case_element_list END_CASE |
68 | 8214 |
{$$ = 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
|
8215 |
| CASE expression OF case_element_list ELSE statement_list END_CASE |
68 | 8216 |
{$$ = new case_statement_c($2, $4, $6, locloc(@$));} |
131 | 8217 |
/* ERROR_CHECK_BEGIN */ |
8218 |
| CASE OF case_element_list END_CASE |
|
136 | 8219 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'CASE' statement."); yynerrs++;} |
131 | 8220 |
| CASE OF case_element_list ELSE statement_list END_CASE |
136 | 8221 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'CASE' statement."); yynerrs++;} |
131 | 8222 |
| CASE error OF case_element_list END_CASE |
136 | 8223 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'CASE' statement."); yyerrok;} |
131 | 8224 |
| CASE error OF case_element_list ELSE statement_list END_CASE |
136 | 8225 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'CASE' statement."); yyerrok;} |
131 | 8226 |
| CASE expression error case_element_list END_CASE |
136 | 8227 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'OF' after test expression in ST 'CASE' statement."); yyerrok;} |
131 | 8228 |
| CASE expression error case_element_list ELSE statement_list END_CASE |
136 | 8229 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'OF' after test expression in ST 'CASE' statement."); yyerrok;} |
131 | 8230 |
| CASE expression OF END_CASE |
136 | 8231 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no case element(s) defined after 'OF' in ST 'CASE' statement."); yynerrs++;} |
131 | 8232 |
| CASE expression OF ELSE statement_list END_CASE |
136 | 8233 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no case element(s) defined after 'OF' in ST 'CASE' statement."); yynerrs++;} |
131 | 8234 |
| CASE expression OF error END_CASE |
136 | 8235 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid case element(s) defined after 'OF' in ST 'CASE' statement."); yyerrok;} |
131 | 8236 |
| CASE expression OF error ELSE statement_list END_CASE |
136 | 8237 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid case element(s) defined after 'OF' in ST 'CASE' statement."); yyerrok;} |
131 | 8238 |
| CASE expression OF case_element_list ELSE END_CASE |
136 | 8239 |
{$$ = NULL; print_err_msg(locl(@5), locf(@6), "no statement defined after 'ELSE' in ST 'CASE' statement."); yynerrs++;} |
131 | 8240 |
| CASE expression OF case_element_list ELSE error END_CASE |
136 | 8241 |
{$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid statement defined after 'ELSE' in ST 'CASE' statement."); yyerrok;} |
8242 |
| CASE expression error END_OF_INPUT |
|
8243 |
{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed 'CASE' statement in ST."); yyerrok;} |
|
8244 |
| CASE expression OF case_element_list END_OF_INPUT |
|
8245 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'CASE' statement in ST."); yynerrs++;} |
|
8246 |
| CASE expression OF case_element_list ELSE statement_list END_OF_INPUT |
|
8247 |
{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'CASE' statement in ST."); yynerrs++;} |
|
131 | 8248 |
| CASE error END_CASE |
136 | 8249 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'CASE' statement."); yyerrok;} |
131 | 8250 |
/* 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
|
8251 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8252 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8253 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8254 |
/* 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
|
8255 |
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
|
8256 |
case_element |
68 | 8257 |
{$$ = 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
|
8258 |
| 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
|
8259 |
{$$ = $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
|
8260 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8261 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8262 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8263 |
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
|
8264 |
case_list ':' statement_list |
68 | 8265 |
{$$ = new case_element_c($1, $3, locloc(@$));} |
131 | 8266 |
/* ERROR_CHECK_BEGIN */ |
8267 |
| case_list statement_list |
|
136 | 8268 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after case list in ST 'CASE' statement."); yynerrs++;} |
131 | 8269 |
| case_list ':' error |
136 | 8270 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid statement in case element of ST 'CASE' statement."); yyerrok;} |
131 | 8271 |
/* 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
|
8272 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8273 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8274 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8275 |
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
|
8276 |
case_list_element |
68 | 8277 |
{$$ = 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
|
8278 |
| 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
|
8279 |
{$$ = $1; $$->add_element($3);} |
131 | 8280 |
/* ERROR_CHECK_BEGIN */ |
8281 |
| case_list ',' error |
|
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
8282 |
{$$ = $1; |
136 | 8283 |
if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no case defined in case list of ST parameter assignment list.");} |
8284 |
else {print_err_msg(locf(@3), locl(@3), "invalid case in case list of ST parameter assignment list."); yyclearin;} |
|
131 | 8285 |
yyerrok; |
8286 |
} |
|
8287 |
/* 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
|
8288 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8289 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8290 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8291 |
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
|
8292 |
signed_integer |
78
aead91ec37cd
removing 'identifier' from definition of symbolic_variable
mario
parents:
77
diff
changeset
|
8293 |
| 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
|
8294 |
| 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
|
8295 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8296 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8297 |
|
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8300 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8301 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8302 |
/* 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
|
8303 |
/********************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8304 |
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
|
8305 |
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
|
8306 |
| 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
|
8307 |
| 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
|
8308 |
| 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
|
8309 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8310 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8311 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8312 |
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
|
8313 |
FOR control_variable ASSIGN expression TO expression BY expression DO statement_list END_FOR |
68 | 8314 |
{$$ = 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
|
8315 |
| FOR control_variable ASSIGN expression TO expression DO statement_list END_FOR |
68 | 8316 |
{$$ = new for_statement_c($2, $4, $6, NULL, $8, locloc(@$));} |
131 | 8317 |
/* ERROR_CHECK_BEGIN */ |
8318 |
| FOR ASSIGN expression TO expression BY expression DO statement_list END_FOR |
|
136 | 8319 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no control variable defined in ST 'FOR' statement."); yynerrs++;} |
131 | 8320 |
| FOR ASSIGN expression TO expression DO statement_list END_FOR |
136 | 8321 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no control variable defined in ST 'FOR' statement."); yynerrs++;} |
131 | 8322 |
| FOR error ASSIGN expression TO expression BY expression DO statement_list END_FOR |
136 | 8323 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid control variable defined for ST 'FOR' statement."); yyerrok;} |
131 | 8324 |
| FOR error ASSIGN expression TO expression DO statement_list END_FOR |
136 | 8325 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid control variable defined for ST 'FOR' statement."); yyerrok;} |
131 | 8326 |
| FOR control_variable expression TO expression BY expression DO statement_list END_FOR |
136 | 8327 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':=' missing between control variable and start expression in ST 'FOR' statement."); yynerrs++;} |
131 | 8328 |
| FOR control_variable expression TO expression DO statement_list END_FOR |
136 | 8329 |
{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':=' missing between control variable and start expression in ST 'FOR' statement."); yynerrs++;} |
131 | 8330 |
| FOR control_variable error expression TO expression BY expression DO statement_list END_FOR |
136 | 8331 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting ':=' between control variable and start expression in ST 'FOR' statement."); yyerrok;} |
131 | 8332 |
| FOR control_variable error expression TO expression DO statement_list END_FOR |
136 | 8333 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting ':=' between control variable and start expression in ST 'FOR' statement."); yyerrok;} |
131 | 8334 |
| FOR control_variable ASSIGN TO expression BY expression DO statement_list END_FOR |
136 | 8335 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no start expression defined in ST 'FOR' statement."); yynerrs++;} |
131 | 8336 |
| FOR control_variable ASSIGN TO expression DO statement_list END_FOR |
136 | 8337 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no start expression defined in ST 'FOR' statement."); yynerrs++;} |
131 | 8338 |
| FOR control_variable ASSIGN error TO expression BY expression DO statement_list END_FOR |
136 | 8339 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid start expression defined in ST 'FOR' statement."); yyerrok;} |
131 | 8340 |
| FOR control_variable ASSIGN error TO expression DO statement_list END_FOR |
136 | 8341 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid start expression in ST 'FOR' statement."); yyerrok;} |
131 | 8342 |
| FOR control_variable ASSIGN expression error expression BY expression DO statement_list END_FOR |
136 | 8343 |
{$$ = NULL; print_err_msg(locf(@5), locl(@5), "expecting 'TO' between start expression and end expression in ST 'FOR' statement."); yyerrok;} |
131 | 8344 |
| FOR control_variable ASSIGN expression error expression DO statement_list END_FOR |
136 | 8345 |
{$$ = NULL; print_err_msg(locf(@5), locl(@5), "expecting 'TO' between start expression and end expression in ST 'FOR' statement."); yyerrok;} |
131 | 8346 |
| FOR control_variable ASSIGN expression TO expression error expression DO statement_list END_FOR |
136 | 8347 |
{$$ = NULL; print_err_msg(locf(@7), locl(@7), "expecting 'BY' between end expression and step expression in ST 'FOR' statement."); yyerrok;} |
131 | 8348 |
| FOR control_variable ASSIGN expression TO expression BY expression error statement_list END_FOR |
136 | 8349 |
{$$ = NULL; print_err_msg(locf(@9), locl(@9), "expecting 'DO' after step expression in ST 'FOR' statement."); yyerrok;} |
131 | 8350 |
| FOR control_variable ASSIGN expression TO expression error statement_list END_FOR |
136 | 8351 |
{$$ = NULL; print_err_msg(locf(@7), locl(@7), "expecting 'DO' after end expression in ST 'FOR' statement."); yyerrok;} |
131 | 8352 |
| FOR control_variable ASSIGN expression TO expression BY expression DO END_FOR |
136 | 8353 |
{$$ = NULL; print_err_msg(locl(@9), locf(@10), "no statement(s) defined after 'DO' in ST 'FOR' statement."); yynerrs++;} |
131 | 8354 |
| FOR control_variable ASSIGN expression TO expression DO END_FOR |
136 | 8355 |
{$$ = NULL; print_err_msg(locl(@7), locf(@8), "no statement(s) defined after 'DO' in ST 'FOR' statement."); yynerrs++;} |
131 | 8356 |
| FOR control_variable ASSIGN expression TO expression BY expression DO error END_FOR |
136 | 8357 |
{$$ = NULL; print_err_msg(locf(@10), locl(@10), "invalid statement(s) defined after 'DO' in ST 'FOR' statement."); yyerrok;} |
131 | 8358 |
| FOR control_variable ASSIGN expression TO expression DO error END_FOR |
136 | 8359 |
{$$ = NULL; print_err_msg(locf(@8), locl(@8), "invalid statement(s) defined after 'DO' in ST 'FOR' statement."); yyerrok;} |
8360 |
| FOR control_variable error END_OF_INPUT |
|
8361 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yyerrok;} |
|
8362 |
| FOR control_variable ASSIGN expression error END_OF_INPUT |
|
8363 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yyerrok;} |
|
8364 |
| FOR control_variable ASSIGN expression TO expression DO statement_list END_OF_INPUT |
|
8365 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yynerrs++;} |
|
8366 |
| FOR control_variable ASSIGN expression TO expression BY expression error END_OF_INPUT |
|
8367 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yyerrok;} |
|
8368 |
| FOR control_variable ASSIGN expression TO expression BY expression DO statement_list END_OF_INPUT |
|
8369 |
{$$ = 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
|
8370 |
| FOR error END_FOR |
136 | 8371 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'FOR' statement."); yyerrok;} |
131 | 8372 |
/* 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
|
8373 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8374 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8375 |
/* 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
|
8376 |
* 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
|
8377 |
* 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
|
8378 |
* (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
|
8379 |
* (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
|
8380 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8381 |
* 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
|
8382 |
* must have been declared in some VAR .. END_VAR |
79 | 8383 |
* 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
|
8384 |
* control_variable: prev_declared_variable_name; |
13 | 8385 |
* |
79 | 8386 |
* If we don't, then the correct use of any previosuly declared |
8387 |
* 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
|
8388 |
*/ |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8389 |
control_variable: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8390 |
prev_declared_variable_name |
1053
e94368340160
Set the symbol->token member in symbolic_variables_c objects.
Mario de Sousa <msousa@fe.up.pt>
parents:
1044
diff
changeset
|
8391 |
{$$ = new symbolic_variable_c($1,locloc(@$)); $$->token = $1->token;}; |
79 | 8392 |
// 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
|
8393 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8394 |
/* 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
|
8395 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8396 |
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
|
8397 |
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
|
8398 |
; |
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 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8401 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8402 |
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
|
8403 |
WHILE expression DO statement_list END_WHILE |
68 | 8404 |
{$$ = new while_statement_c($2, $4, locloc(@$));} |
131 | 8405 |
/* ERROR_CHECK_BEGIN */ |
8406 |
| WHILE DO statement_list END_WHILE |
|
136 | 8407 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'WHILE' statement."); yynerrs++;} |
131 | 8408 |
| WHILE error DO statement_list END_WHILE |
136 | 8409 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'WHILE' statement."); yyerrok;} |
131 | 8410 |
| WHILE expression error statement_list END_WHILE |
136 | 8411 |
{$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'DO' after test expression in ST 'WHILE' statement."); yyerrok;} |
131 | 8412 |
| WHILE expression DO END_WHILE |
136 | 8413 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no statement(s) defined after 'DO' in ST 'WHILE' statement."); yynerrs++;} |
131 | 8414 |
| WHILE expression DO error END_WHILE |
136 | 8415 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid statement(s) defined after 'DO' in ST 'WHILE' statement."); yyerrok;} |
8416 |
| WHILE expression error END_OF_INPUT |
|
8417 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'WHILE' statement in ST."); yyerrok;} |
|
8418 |
| WHILE expression DO statement_list END_OF_INPUT |
|
8419 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'WHILE' statement in ST."); yynerrs++;} |
|
131 | 8420 |
| WHILE error END_WHILE |
136 | 8421 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'WHILE' statement."); yyerrok;} |
131 | 8422 |
/* 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
|
8423 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8424 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8425 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8426 |
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
|
8427 |
REPEAT statement_list UNTIL expression END_REPEAT |
68 | 8428 |
{$$ = new repeat_statement_c($2, $4, locloc(@$));} |
131 | 8429 |
/* ERROR_CHECK_BEGIN */ |
8430 |
| REPEAT UNTIL expression END_REPEAT |
|
136 | 8431 |
{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no statement(s) defined after 'REPEAT' in ST 'REPEAT' statement."); yynerrs++;} |
131 | 8432 |
| REPEAT error UNTIL expression END_REPEAT |
136 | 8433 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid statement(s) defined after 'REPEAT' for ST 'REPEAT' statement."); yyerrok;} |
131 | 8434 |
| REPEAT statement_list UNTIL END_REPEAT |
136 | 8435 |
{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no test expression defined after 'UNTIL' in ST 'REPEAT' statement.");} |
131 | 8436 |
| REPEAT statement_list UNTIL error END_REPEAT |
136 | 8437 |
{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid test expression defined after 'UNTIL' in ST 'REPEAT' statement."); yyerrok;} |
8438 |
| REPEAT statement_list END_OF_INPUT |
|
8439 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'REPEAT' statement in ST."); yynerrs++;} |
|
8440 |
| REPEAT statement_list UNTIL expression error END_OF_INPUT |
|
8441 |
{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'REPEAT' statement in ST."); yyerrok;} |
|
131 | 8442 |
| REPEAT error END_REPEAT |
136 | 8443 |
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'REPEAT' statement."); yyerrok;} |
131 | 8444 |
/* 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
|
8445 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8446 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8447 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8448 |
exit_statement: |
68 | 8449 |
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
|
8450 |
; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8451 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8452 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8453 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8454 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8455 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8456 |
%% |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8457 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8458 |
#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
|
8459 |
#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
|
8460 |
#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
|
8461 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8462 |
|
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8463 |
|
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8464 |
|
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8465 |
/*************************************************************************************************/ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8466 |
/* 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
|
8467 |
/* 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
|
8468 |
/* 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
|
8469 |
/* option is to use global variables! yuck! */ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8470 |
/*************************************************************************************************/ |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8471 |
|
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8472 |
/* 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
|
8473 |
* 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
|
8474 |
* but disallows them in user code... |
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8475 |
* |
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8476 |
* 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
|
8477 |
* 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
|
8478 |
*/ |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8479 |
bool allow_function_overloading = false; |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8480 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8481 |
/* | [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
|
8482 |
/* 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
|
8483 |
/* 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
|
8484 |
* (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
|
8485 |
* 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
|
8486 |
* 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
|
8487 |
* 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
|
8488 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8489 |
* 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
|
8490 |
* 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
|
8491 |
* 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
|
8492 |
* user defined functions. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8493 |
* 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
|
8494 |
* 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
|
8495 |
* 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
|
8496 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8497 |
* 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
|
8498 |
* 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
|
8499 |
* '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
|
8500 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8501 |
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
|
8502 |
|
934
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
8503 |
/* A global flag used to tell the parser whether to allow use of DREF and '^' operators (defined in IEC 61131-3 v3) */ |
2a42a68f4b59
Turn support of derefencing operator '^' an option (default is not supported).
mjsousa
parents:
933
diff
changeset
|
8504 |
bool allow_ref_dereferencing; |
924 | 8505 |
/* A global flag used to tell the parser whether to allow use of REF_TO ANY datatypes (non-standard extension) */ |
8506 |
bool allow_ref_to_any = false; |
|
932
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
8507 |
/* A global flag used to tell the parser whether to allow use of REF_TO as a struct or array element (non-standard extension) */ |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
8508 |
bool allow_ref_to_in_derived_datatypes = false; |
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
8509 |
|
061824c45a5b
Add support for REF_TO inside arrays and structs (a non-standard feature!)
mjsousa
parents:
924
diff
changeset
|
8510 |
/* A pointer to the root of the parsing tree that will be generated by bison. */ |
15
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8511 |
symbol_c *tree_root; |
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8512 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8513 |
|
0b472e25eb16
Adding changes to make the compiler compatible with bison ver 2.3
mario
parents:
13
diff
changeset
|
8514 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8515 |
/* 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
|
8516 |
* 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
|
8517 |
* 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
|
8518 |
* 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
|
8519 |
* 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
|
8520 |
* 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
|
8521 |
* (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
|
8522 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8523 |
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
|
8524 |
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
|
8525 |
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
|
8526 |
/* fprintf(stderr, "error %d: %s\n", yynerrs // global variable //, error_msg); */ |
68 | 8527 |
/* 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
|
8528 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8529 |
|
136 | 8530 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8531 |
/* ERROR_CHECK_BEGIN */ |
136 | 8532 |
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
|
8533 |
switch (yychar) { |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8534 |
case ';': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8535 |
case ',': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8536 |
case ')': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8537 |
case ']': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8538 |
case '+': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8539 |
case '*': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8540 |
case '-': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8541 |
case '/': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8542 |
case '<': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8543 |
case '>': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8544 |
case '=': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8545 |
case '&': |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8546 |
case OR: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8547 |
case XOR: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8548 |
case AND: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8549 |
case AND2: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8550 |
case OPER_NE: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8551 |
case OPER_LE: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8552 |
case OPER_GE: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8553 |
case MOD: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8554 |
case OPER_EXP: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8555 |
case NOT: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8556 |
return true; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8557 |
default: |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8558 |
return false; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8559 |
} |
136 | 8560 |
} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8561 |
/* ERROR_CHECK_END */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8562 |
|
136 | 8563 |
|
8564 |
void print_err_msg(int first_line, |
|
95 | 8565 |
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
|
8566 |
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
|
8567 |
long int first_order, |
95 | 8568 |
int last_line, |
8569 |
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
|
8570 |
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
|
8571 |
long int last_order, |
95 | 8572 |
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
|
8573 |
|
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8574 |
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
|
8575 |
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
|
8576 |
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
|
8577 |
|
1012
1f2af384fb1f
Add support for non standard feature: allow POUs with no in, out and inout parameters
mjsousa
parents:
1011
diff
changeset
|
8578 |
if (runtime_options.full_token_loc) { |
286
a4f4990d5c66
Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
8579 |
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
|
8580 |
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
|
8581 |
else |
516
8591746fa134
Produce similar error messages in stage2 and stage3.
Mario de Sousa <msousa@fe.up.pt>
parents:
469
diff
changeset
|
8582 |
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
|
8583 |
} else { |
516
8591746fa134
Produce similar error messages in stage2 and stage3.
Mario de Sousa <msousa@fe.up.pt>
parents:
469
diff
changeset
|
8584 |
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
|
8585 |
} |
131 | 8586 |
//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
|
8587 |
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
|
8588 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8589 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8590 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8591 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8592 |
/* 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
|
8593 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8594 |
* 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
|
8595 |
* 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
|
8596 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8597 |
/* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8598 |
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
|
8599 |
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
|
8600 |
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
|
8601 |
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
|
8602 |
ERROR; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8603 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8604 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8605 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8606 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
8607 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8608 |
/* 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
|
8609 |
/* 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
|
8610 |
* 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
|
8611 |
* 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
|
8612 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8613 |
#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
|
8614 |
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
|
8615 |
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
|
8616 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8617 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8618 |
/* 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
|
8619 |
* 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
|
8620 |
*/ |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8621 |
poutype_identifier_c *il_operator_c_2_poutype_identifier_c(symbol_c *il_operator) { |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8622 |
identifier_c * id = il_operator_c_2_identifier_c(il_operator); |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8623 |
poutype_identifier_c *pou_id = new poutype_identifier_c(strdup(id->value)); |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8624 |
|
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8625 |
*(symbol_c *)pou_id = *(symbol_c *)id; |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8626 |
delete id; |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8627 |
return pou_id; |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8628 |
} |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8629 |
|
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8630 |
|
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8631 |
identifier_c *il_operator_c_2_identifier_c(symbol_c *il_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
|
8632 |
const char *name = NULL; |
68 | 8633 |
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
|
8634 |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8635 |
op_2_str(NOT, "NOT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8636 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8637 |
op_2_str(AND, "AND"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8638 |
op_2_str(OR, "OR"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8639 |
op_2_str(XOR, "XOR"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8640 |
op_2_str(ADD, "ADD"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8641 |
op_2_str(SUB, "SUB"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8642 |
op_2_str(MUL, "MUL"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8643 |
op_2_str(DIV, "DIV"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8644 |
op_2_str(MOD, "MOD"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8645 |
op_2_str(GT, "GT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8646 |
op_2_str(GE, "GE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8647 |
op_2_str(EQ, "EQ"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8648 |
op_2_str(LT, "LT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8649 |
op_2_str(LE, "LE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8650 |
op_2_str(NE, "NE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8651 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8652 |
op_2_str(LD, "LD"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8653 |
op_2_str(LDN, "LDN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8654 |
op_2_str(ST, "ST"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8655 |
op_2_str(STN, "STN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8656 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8657 |
op_2_str(S, "S"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8658 |
op_2_str(R, "R"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8659 |
op_2_str(S1, "S1"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8660 |
op_2_str(R1, "R1"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8661 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8662 |
op_2_str(CLK, "CLK"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8663 |
op_2_str(CU, "CU"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8664 |
op_2_str(CD, "CD"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8665 |
op_2_str(PV, "PV"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8666 |
op_2_str(IN, "IN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8667 |
op_2_str(PT, "PT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8668 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8669 |
op_2_str(ANDN, "ANDN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8670 |
op_2_str(ORN, "ORN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8671 |
op_2_str(XORN, "XORN"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8672 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8673 |
op_2_str(ADD, "ADD"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8674 |
op_2_str(SUB, "SUB"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8675 |
op_2_str(MUL, "MUL"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8676 |
op_2_str(DIV, "DIV"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8677 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8678 |
op_2_str(GT, "GT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8679 |
op_2_str(GE, "GE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8680 |
op_2_str(EQ, "EQ"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8681 |
op_2_str(LT, "LT"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8682 |
op_2_str(LE, "LE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8683 |
op_2_str(NE, "NE"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8684 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8685 |
op_2_str(CAL, "CAL"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8686 |
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
|
8687 |
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
|
8688 |
op_2_str(RET, "RET"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8689 |
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
|
8690 |
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
|
8691 |
op_2_str(JMP, "JMP"); |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
193
diff
changeset
|
8692 |
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
|
8693 |
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
|
8694 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8695 |
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
|
8696 |
ERROR; |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8697 |
/* |
68 | 8698 |
res = new identifier_c(strdup(name), |
8699 |
il_operator->first_line, |
|
8700 |
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
|
8701 |
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
|
8702 |
il_operator->first_order, |
68 | 8703 |
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
|
8704 |
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
|
8705 |
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
|
8706 |
il_operator->last_order |
68 | 8707 |
); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8708 |
free(il_operator); |
958
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8709 |
*/ |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8710 |
res = new identifier_c(strdup(name)); |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8711 |
*(symbol_c *)res = *(symbol_c *)il_operator; |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8712 |
delete il_operator; |
7474d2cd1d6e
Add a new pou_typename_c object to the AST to store references to previously declared Functions, FB, and Programs.
mjsousa
parents:
956
diff
changeset
|
8713 |
|
68 | 8714 |
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
|
8715 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8716 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8717 |
|
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
|
8718 |
#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
|
8719 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8720 |
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
|
8721 |
// 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
|
8722 |
// Table 34 - Standard bistable function blocks |
73 | 8723 |
"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
|
8724 |
// 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
|
8725 |
// 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
|
8726 |
"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
|
8727 |
// 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
|
8728 |
// Table 36 - Standard counter function blocks |
68 | 8729 |
"CTU","CTU_DINT","CTU_LINT","CTU_UDINT","CTU_ULINT", |
8730 |
"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
|
8731 |
"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
|
8732 |
// 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
|
8733 |
// 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
|
8734 |
"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
|
8735 |
/* 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
|
8736 |
NULL |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8737 |
}; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8738 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8739 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8740 |
#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
|
8741 |
#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
|
8742 |
|
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
|
8743 |
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
|
8744 |
|
177
697562a5da7c
Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
175
diff
changeset
|
8745 |
|
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8746 |
static int parse_files(const char *libfilename, const char *filename) { |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8747 |
/* first parse the standard library file... */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8748 |
/* Do not debug the standard library, even if debug flag is set! |
257 | 8749 |
#if YYDEBUG |
8750 |
yydebug = 1; |
|
8751 |
#endif |
|
8752 |
*/ |
|
761
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8753 |
FILE *libfile = NULL; |
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8754 |
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
|
8755 |
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
|
8756 |
perror(errmsg); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8757 |
free(errmsg); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8758 |
/* we give up... */ |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8759 |
return -1; |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8760 |
} |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8761 |
|
924 | 8762 |
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
|
8763 |
allow_extensible_function_parameters = true; |
946
c012a64dc2fa
Make the relaxed datatype model a runtime option (off by default)
mjsousa
parents:
945
diff
changeset
|
8764 |
allow_ref_dereferencing = runtime_options.ref_standard_extensions; |
c012a64dc2fa
Make the relaxed datatype model a runtime option (off by default)
mjsousa
parents:
945
diff
changeset
|
8765 |
allow_ref_to_any = runtime_options.ref_nonstand_extensions; |
c012a64dc2fa
Make the relaxed datatype model a runtime option (off by default)
mjsousa
parents:
945
diff
changeset
|
8766 |
allow_ref_to_in_derived_datatypes = runtime_options.ref_nonstand_extensions; |
955
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
8767 |
if (yyparse() != 0) { |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
8768 |
fprintf (stderr, "\nParsing failed because of too many consecutive syntax errors in standard library. Bailing out!\n"); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
8769 |
exit(EXIT_FAILURE); |
5e2e7707f770
Fix AST generated by parsing with preparsing switched OFF (typo in array datatypes, and fix parsing of POUs).
mjsousa
parents:
954
diff
changeset
|
8770 |
} |
761
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8771 |
fclose(libfile); |
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8772 |
|
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8773 |
if (yynerrs > 0) { /* NOTE: yynerrs is a global variable */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8774 |
/* Hopefully the libraries do not contain any errors, so this should not occur! */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8775 |
fprintf (stderr, "\n%d error(s) found in %s. Bailing out!\n", yynerrs, libfilename); |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8776 |
return -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
|
8777 |
} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8778 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8779 |
/* if by any chance the library is not complete, we now add the missing reserved keywords to the 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
|
8780 |
for(int i = 0; standard_function_block_names[i] != NULL; i++) |
971
8aee27d46208
Change symbtable_c -> use design pattern used by C++ standard library (STL)
mjsousa
parents:
963
diff
changeset
|
8781 |
if (library_element_symtable.find(standard_function_block_names[i]) == |
8aee27d46208
Change symbtable_c -> use design pattern used by C++ standard library (STL)
mjsousa
parents:
963
diff
changeset
|
8782 |
library_element_symtable.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
|
8783 |
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
|
8784 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8785 |
/* now parse the input file... */ |
257 | 8786 |
#if YYDEBUG |
8787 |
yydebug = 1; |
|
8788 |
#endif |
|
761
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8789 |
FILE *mainfile = NULL; |
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8790 |
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
|
8791 |
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
|
8792 |
perror(errmsg); |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8793 |
free(errmsg); |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8794 |
return -3; |
757
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8795 |
} |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8796 |
|
924 | 8797 |
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
|
8798 |
allow_extensible_function_parameters = false; |
946
c012a64dc2fa
Make the relaxed datatype model a runtime option (off by default)
mjsousa
parents:
945
diff
changeset
|
8799 |
allow_ref_dereferencing = runtime_options.ref_standard_extensions; |
c012a64dc2fa
Make the relaxed datatype model a runtime option (off by default)
mjsousa
parents:
945
diff
changeset
|
8800 |
allow_ref_to_any = runtime_options.ref_nonstand_extensions; |
c012a64dc2fa
Make the relaxed datatype model a runtime option (off by default)
mjsousa
parents:
945
diff
changeset
|
8801 |
allow_ref_to_in_derived_datatypes = runtime_options.ref_nonstand_extensions; |
924 | 8802 |
//allow_ref_to_any = false; /* we only allow REF_TO ANY in library functions/FBs, no matter what the user asks for in the command line */ |
757
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8803 |
|
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8804 |
if (yyparse() != 0) { |
f1fc4aa6f0e3
Code cleanup: move tracking functions to flex.
Mario de Sousa <msousa@fe.up.pt>
parents:
756
diff
changeset
|
8805 |
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
|
8806 |
exit(EXIT_FAILURE); |
85 | 8807 |
} |
761
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8808 |
fclose(mainfile); |
7b52623a2f37
Allow bison to ask for an END_OF_INPUT token multiple times!
mjsousa
parents:
759
diff
changeset
|
8809 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8810 |
if (yynerrs > 0) { |
516
8591746fa134
Produce similar error messages in stage2 and stage3.
Mario de Sousa <msousa@fe.up.pt>
parents:
469
diff
changeset
|
8811 |
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
|
8812 |
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
|
8813 |
} |
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8814 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8815 |
return 0; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8816 |
} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8817 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8818 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8819 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8820 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8821 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8822 |
/* We parse the input source code twice!! |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8823 |
* 1st pass --> Pre-parsing |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8824 |
* ------------------------- |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8825 |
* The intention of the first pass is to fill up the library_element_symtable with the names of all |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8826 |
* the POUs (Functions, FBs, Programs and Configurations), as well as all the Derived Datatypes. |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8827 |
* |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8828 |
* During this pass POUs are only parsed until their name is obtained, and the remaining source |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8829 |
* code (variable declarations and body) is completely thrown away by flex. Datatype declarations |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8830 |
* however are parsed normally! |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8831 |
* |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8832 |
* At the end of the pre-parsing, the AST will contain only the derived datatype declarations, |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8833 |
* and this tree will be trown away (by simply resetting tree_root = NULL). |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8834 |
* More importantly, the library_element_symtable will contain the names of all the POUs and |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8835 |
* derived datatypes. |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8836 |
* |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8837 |
* 2st pass --> Normal parsing |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8838 |
* ---------------------------- |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8839 |
* In this second parse the whole source code is parsed correctly, and the AST is generated |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8840 |
* completely. |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8841 |
* |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8842 |
* However, if the pre-parsing has been done before this normal parsing, the POUs may appear |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8843 |
* in the source code in any order, as calling a POU (e.g. calling a function) that has not yet |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8844 |
* been declared will no longer generate a parsing error because the name of the function being |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8845 |
* called is already in the library_element_symtable. |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8846 |
* |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8847 |
* Declaring variables of datatypes that have not yet been declared will also be possible, as the |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8848 |
* datatypes will also already be in the library_element_symtable! |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8849 |
*/ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8850 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8851 |
int stage2__(const char *filename, |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8852 |
symbol_c **tree_root_ref |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8853 |
) { |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8854 |
char *libfilename = NULL; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8855 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8856 |
/* Determine the full path name of the standard library file... */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8857 |
if (runtime_options.includedir != NULL) |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8858 |
INCLUDE_DIRECTORIES[0] = runtime_options.includedir; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8859 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8860 |
if ((libfilename = strdup3(INCLUDE_DIRECTORIES[0], "/", LIBFILE)) == NULL) { |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8861 |
fprintf (stderr, "Out of memory. Bailing out!\n"); |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8862 |
exit(EXIT_FAILURE); |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8863 |
} |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8864 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8865 |
/*******************************/ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8866 |
/* Do the PRE parsing run...! */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8867 |
/*******************************/ |
956 | 8868 |
if (runtime_options.pre_parsing) { |
8869 |
// fprintf (stderr, "----> Starting pre-parsing!\n"); |
|
8870 |
tree_root = NULL; |
|
8871 |
set_preparse_state(); |
|
8872 |
if (parse_files(libfilename, filename) < 0) |
|
8873 |
exit(EXIT_FAILURE); |
|
8874 |
// TODO: delete the current AST. For the moment, we leave all the objects in memory (not much of an issue in a program that always runs to completion). |
|
8875 |
} |
|
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8876 |
/*******************************/ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8877 |
/* Do the main parsing run...! */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8878 |
/*******************************/ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8879 |
// fprintf (stderr, "----> Starting normal parsing!\n"); |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8880 |
tree_root = NULL; |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8881 |
rst_preparse_state(); |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8882 |
if (parse_files(libfilename, filename) < 0) |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8883 |
exit(EXIT_FAILURE); |
134
0e43c556cd2d
Fixed some uncatched errors and error bounds in error messages
lbessard
parents:
133
diff
changeset
|
8884 |
|
952
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8885 |
|
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8886 |
/* Final clean-up... */ |
e984cfdf3b10
Add a pre-parsing phase to stage1_2 (allows source code that references POUs and datatypes before they are declared)
mjsousa
parents:
946
diff
changeset
|
8887 |
free(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
|
8888 |
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
|
8889 |
*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
|
8890 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8891 |
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
|
8892 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
8893 |
|
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
|
8894 |
|
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
|
8895 |
|
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
|
8896 |
|
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
|
8897 |
|
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
|
8898 |
|
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
|
8899 |
|
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
|
8900 |
|
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
|
8901 |
|
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
|
8902 |
|
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
|
8903 |
|
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
|
8904 |
|
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
|
8905 |
|
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
|
8906 |