stage1_2/iec.y
author Mario de Sousa <msousa@fe.up.pt>
Thu, 14 Apr 2011 18:12:59 +0100
changeset 287 9df7fcb9bde5
parent 286 a4f4990d5c66
child 295 e7ce7c6bbb5d
permissions -rwxr-xr-x
Added tracking of order by which tokens are processed by lexical analyser.
This helps in correctly formating error messages when constructs begin in one file, and end in another.
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
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
    38
 *  languages IL and ST, as well as the textual version of SFC.
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
    39
 *  The syntax parser, comprising the 2nd stage of the overall 
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
    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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    61
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    62
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    63
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    64
%{
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    65
#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
    66
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    67
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    68
/* 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
    69
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
    70
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    71
/* 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
    72
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
    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
/* 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
    75
#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
    76
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    77
/* 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
    78
 * 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
    79
 * 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
    80
 */
41
8998c8b24b60 First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents: 40
diff changeset
    81
#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
    82
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    83
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    84
/* 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
    85
#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
    86
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    87
/* file with declaration of token constants. Generated by bison! */
183
fb240c8d1f66 Bug with bison versions earlier than 2.3 fixed
lbessard
parents: 177
diff changeset
    88
#include "iec.y.hh"
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
    89
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
    90
/* 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
    91
#include "stage1_2_priv.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
    92
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
/* 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
    95
 * 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
    96
 *  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
    97
 *  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
    98
 *  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
    99
 *  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
   100
 *  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
   101
 *  afterall!
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   102
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   103
/* 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
   104
 * 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
   105
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   106
#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
   107
  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
   108
  for(int i = 0; i < list->n; i++) {			\
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   109
    elem = list->elements[i];				\
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   110
    code;						\
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   111
  }							\
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   112
}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   113
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   114
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   115
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   116
/* Macros used to pass the line and column locations when
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   117
 * creating a new object for the abstract syntax tree.
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   118
 */
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
   119
#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
   120
#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
   121
#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
   122
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   123
/* 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
   124
# 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
   125
         do                                                                  \
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   126
           if (N)                                                            \
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   127
             {                                                               \
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   128
               (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
   129
               (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
   130
               (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
   131
               (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
   132
               (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
   133
               (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
   134
               (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
   135
               (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
   136
             }                                                               \
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   137
           else                                                              \
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   138
             {                                                               \
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   139
               (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
   140
                 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
   141
               (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
   142
                 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
   143
               (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
   144
                 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
   145
               (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
   146
                 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
   147
             }                                                               \
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   148
         while (0)
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   149
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   150
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   151
/* A macro for printing out internal parser errors... */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   152
#define ERROR error_exit(__FILE__,__LINE__)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   153
/* function defined in main.cc */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   154
extern void error_exit(const char *file_name, int line_no);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   155
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   156
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   157
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   158
/*************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   159
/* 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
   160
/*************************/
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   161
/* NOTE: For some strange reason bison ver 2.3 is including these declarations
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   162
 *       in the iec.y.hh file, which is in turn included by flex.
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   163
 *       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
   164
 *       their existance (otherwise we get errors when linking the code, since we
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   165
 *       would get a new variable defined each time iec.y.hh is included!).
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   166
 *       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
   167
 *       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
   168
 */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   169
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
   170
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
   171
/* 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
   172
 *       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
   173
 *       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
   174
 *       option is to use global variables! yuck!
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
   175
 */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
   176
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   177
/* 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
   178
 * 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
   179
 * 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
   180
 */
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   181
extern bool allow_function_overloading;
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   182
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
   183
/* A global flag used to tell the parser whether to include the full variable location
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
   184
 * when printing out error messages...
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
extern bool full_token_loc;
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
   187
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   188
/* A pointer to the root of the parsing tree that will be generated 
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   189
 * by bison.
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   190
 */
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   191
extern symbol_c *tree_root;
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   192
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   193
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   194
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   195
/************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   196
/* 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
   197
/************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   198
/* 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
   199
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   200
/* Convert an il_operator_c into an identifier_c */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   201
symbol_c *il_operator_c_2_identifier_c(symbol_c *il_operator);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   202
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
   203
/* 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
   204
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
   205
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
   206
/* ERROR_CHECK_END */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
   207
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   208
/* print an error message */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
   209
void print_err_msg(int first_line,
95
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
   210
                   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
   211
                   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
   212
                   long int first_order,
95
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
   213
                   int last_line,
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
   214
                   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
   215
                   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
   216
                   long int last_order,
95
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
   217
                   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
   218
%}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   219
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   220
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   221
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   222
20
81a06a308b7e *** empty log message ***
mario
parents: 17
diff changeset
   223
// %glr-parser
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
   224
// %expect-rr 1
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
   225
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
   226
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   227
/* 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
   228
 * 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
   229
 * YYLTYPE would be delcared as something in the iec.cc file, and another thing
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   230
 * (actually the default value of YYLTYPE) in the iec.y.hh heder file.
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   231
 */
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   232
%code requires {
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   233
/* 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
   234
 * 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
   235
 */
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   236
/* NOTE: since this code will be placed in the iec.y.hh header file,
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   237
 * as well as the iec.cc file that also includes the iec.y.hh header file,
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   238
 * 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
   239
 * 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
   240
 * declared twice.
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   241
 * 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
   242
 * 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
   243
 *
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   244
 * At first glance it seems that what we really should do is delcare the
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   245
 * YYLTYPE directly as an anonymous struct, thus:
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   246
 * #define YYLTYPE struct{ ...}
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   247
 * however, this also results in compilation errors.
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   248
 *
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   249
 * I (Mario) think this is kind of a hack. If you know how to
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   250
 * do this re-declaration of YYLTYPE properly, please let me know!
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   251
 */
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   252
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   253
  typedef struct {
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
   254
    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
   255
    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
   256
    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
   257
    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
   258
    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
   259
    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
   260
    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
   261
    long int    last_order;
286
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   262
  } yyltype__local;
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   263
  #define YYLTYPE yyltype__local
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   264
#endif
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   265
}
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   266
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
   267
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
   268
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   269
%union {
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   270
    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
   271
    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
   272
    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
   273
}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   274
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   275
/*
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   276
 TODO: DO we need to define a destructor do free
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   277
       memory when recovering from errors, or do the
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   278
       class destructors already handle this?
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   279
       Following is example on how to define
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   280
       detructors, using the syntax:
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   281
       %destructor { CODE } SYMBOLS
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   282
%union
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   283
      {
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   284
        char *string;
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   285
      }
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   286
      %token <string> STRING
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   287
      %type  <string> string
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   288
      %destructor { free ($$); } STRING string
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   289
*/
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   292
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   293
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   294
/*************************************/
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   295
/* Prelimenary helpful constructs... */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   296
/*************************************/
73
0e623bbdee95 fixing infinite error loops at library level, and ...
mario
parents: 68
diff changeset
   297
/* A token used to identify the very end of the input file
0e623bbdee95 fixing infinite error loops at library level, and ...
mario
parents: 68
diff changeset
   298
 * after all includes have already been processed.
0e623bbdee95 fixing infinite error loops at library level, and ...
mario
parents: 68
diff changeset
   299
 *
0e623bbdee95 fixing infinite error loops at library level, and ...
mario
parents: 68
diff changeset
   300
 * Flex automatically returns the token with value 0
74
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
   301
 * at the end of the file. We therefore specify here
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
   302
 * 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
   303
 * to detect the very end of the input files.
73
0e623bbdee95 fixing infinite error loops at library level, and ...
mario
parents: 68
diff changeset
   304
 */
0e623bbdee95 fixing infinite error loops at library level, and ...
mario
parents: 68
diff changeset
   305
%token END_OF_INPUT 0
0e623bbdee95 fixing infinite error loops at library level, and ...
mario
parents: 68
diff changeset
   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
/* 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
   308
/* 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
   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
 * 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
   311
 * 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
   312
 * 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
   313
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   314
 * 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
   315
 * =====
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   316
 * 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
   317
 * 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
   318
 * 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
   319
 * 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
   320
 * 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
   321
 * 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
   322
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   323
%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
   324
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   325
%type <leaf>	start
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   326
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   327
%type <leaf>	any_identifier
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   328
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   329
%token <ID>	prev_declared_variable_name_token
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
   330
%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
   331
%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
   332
%type <leaf>	prev_declared_variable_name
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
   333
%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
   334
%type <leaf>	prev_declared_fb_name
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   335
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   336
%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
   337
%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
   338
%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
   339
%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
   340
%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
   341
%token  <ID>	prev_declared_string_type_name_token
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   342
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   343
%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
   344
%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
   345
%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
   346
%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
   347
%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
   348
%type  <leaf>	prev_declared_string_type_name
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   349
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   350
%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
   351
%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
   352
%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
   353
%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
   354
%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
   355
%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
   356
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   357
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   358
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   359
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   360
/**********************************************************************************/
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   361
/* 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
   362
/**********************************************************************************/
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   363
267
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
   364
/* 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
   365
 * 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
   366
 */
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
   367
%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
   368
%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
   369
%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
   370
%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
   371
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
   372
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
   373
/* 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
   374
/* 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
   375
 * 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
   376
 * 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
   377
 */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   378
%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
   379
%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
   380
267
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
   381
/* 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
   382
%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
   383
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   384
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   385
/* 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
   386
/* 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
   387
 * 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
   388
 * 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
   389
 * correct place in order to ease understanding of the parser...
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   390
 */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   391
%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
   392
%token	ENO
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   393
%type <leaf>	en_identifier
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   394
%type <leaf>	eno_identifier
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   395
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   396
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   397
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   398
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   399
/***************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   400
/* 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
   401
/***************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   402
%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
   403
%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
   404
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   405
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   406
/*******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   407
/* 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
   408
/*******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   409
/* 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
   410
  letter
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   411
  digit
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   412
  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
   413
  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
   414
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   415
%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
   416
%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
   417
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   418
/*********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   419
/* 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
   420
/*********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   421
%type <leaf>	constant
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   422
%type <leaf>	non_negative_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
   423
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   424
/******************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   425
/* 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
   426
/******************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   427
/* 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
   428
  bit
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   429
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   430
%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
   431
%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
   432
%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
   433
%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
   434
%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
   435
%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
   436
%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
   437
%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
   438
%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
   439
%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
   440
%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
   441
%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
   442
%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
   443
%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
   444
%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
   445
// %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
   446
%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
   447
%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
   448
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   449
%token safeboolean_true_literal_token
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   450
%token safeboolean_false_literal_token
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   451
%token boolean_true_literal_token
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   452
%token boolean_false_literal_token
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   453
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   454
%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
   455
%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
   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.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
   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
%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
   462
%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
   463
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   464
%type  <leaf> 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
   465
%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
   466
%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
   467
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   468
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
/* 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
   471
/***************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   472
%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
   473
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   474
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   475
/************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   476
/* 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
   477
/************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   478
%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
   479
%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
   480
%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
   481
%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
   482
%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
   483
%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
   484
%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
   485
%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
   486
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   487
%type  <leaf>	integer_d
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   488
%type  <leaf>	integer_h
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   489
%type  <leaf>	integer_m
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   490
%type  <leaf>	integer_s
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   491
%type  <leaf>	integer_ms
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   492
%type  <leaf>	fixed_point_d
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   493
%type  <leaf>	fixed_point_h
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   494
%type  <leaf>	fixed_point_m
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   495
%type  <leaf>	fixed_point_s
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   496
%type  <leaf>	fixed_point_ms
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   497
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   498
%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
   499
%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
   500
%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
   501
%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
   502
%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
   503
%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
   504
%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
   505
%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
   506
%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
   507
%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
   508
%token <ID>	integer_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
   509
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   510
// %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
   511
%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
   512
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   513
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   514
/************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   515
/* 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
   516
/************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   517
%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
   518
%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
   519
%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
   520
%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
   521
%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
   522
%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
   523
%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
   524
%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
   525
%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
   526
%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
   527
%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
   528
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   529
// %token TIME_OF_DAY
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   530
// %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
   531
%token D_SHARP
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   532
// %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
   533
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   534
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   535
/**********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   536
/* 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
   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
/* 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
   539
// %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
   540
%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
   541
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
/* 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
   545
/***********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   546
/* NOTES:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   547
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   548
 *    - 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
   549
 *      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
   550
 *      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
   551
 *      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
   552
 *      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
   553
 *      (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
   554
 *      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
   555
 *      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
   556
 *      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
   557
 *      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
   558
 *      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
   559
 *      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
   560
 *      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
   561
 *      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
   562
 *      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
   563
 *      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
   564
 *      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
   565
 *      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
   566
 *      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
   567
 *      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
   568
 *      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
   569
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   570
 *    - 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
   571
 *      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
   572
 *      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
   573
 *      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
   574
 *      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
   575
 *      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
   576
 *      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
   577
 */
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>	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
   579
%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
   580
%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
   581
%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
   582
%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
   583
%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
   584
%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
   585
%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
   586
/* 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
   587
 * 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
   588
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   589
%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
   590
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   591
%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
   592
%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
   593
%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
   594
%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
   595
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   596
%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
   597
%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
   598
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   599
%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
   600
%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
   601
%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
   602
%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
   603
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   604
%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
   605
%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
   606
%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
   607
%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
   608
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   609
%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
   610
%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
   611
%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
   612
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   613
%token TIME
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   614
%token DATE
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   615
%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
   616
%token DT
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   617
%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
   618
%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
   619
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   620
/******************************************************/
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   621
/* Symbols defined in                                 */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   622
/* "Safety Software Technical Specification,          */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   623
/*  Part 1: Concepts and Function Blocks,             */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   624
/*  Version 1.0 – Official Release"                   */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   625
/* by PLCopen - Technical Committee 5 - 2006-01-31    */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   626
/******************************************************/
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   627
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   628
%token SAFEBYTE
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   629
%token SAFEWORD
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   630
%token SAFEDWORD
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   631
%token SAFELWORD
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   632
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   633
%token SAFELREAL
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   634
%token SAFEREAL
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   635
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   636
%token SAFESINT
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   637
%token SAFEINT
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   638
%token SAFEDINT
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   639
%token SAFELINT
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   640
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   641
%token SAFEUSINT
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   642
%token SAFEUINT
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   643
%token SAFEUDINT
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   644
%token SAFEULINT
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   645
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   646
%token SAFEWSTRING
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   647
%token SAFESTRING
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   648
%token SAFEBOOL
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   649
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   650
%token SAFETIME
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   651
%token SAFEDATE
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   652
%token SAFEDATE_AND_TIME
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   653
%token SAFEDT
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   654
%token SAFETIME_OF_DAY
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   655
%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
   656
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
/* 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
   659
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   660
/* 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
   661
// %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
   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
/* 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
   664
 * 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
   665
 */
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 ANY
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   667
%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
   668
%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
   669
%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
   670
%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
   671
%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
   672
%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
   673
%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
   674
%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
   675
%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
   676
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   677
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   678
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   679
/* 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
   680
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   681
%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
   682
%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
   683
// %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
   684
// %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
   685
// %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
   686
// %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
   687
// %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
   688
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   689
%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
   690
/* 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
   691
%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
   692
%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
   693
%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
   694
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   695
%type  <leaf>	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
   696
%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
   697
%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
   698
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   699
%type  <leaf>	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
   700
%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
   701
%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
   702
%type  <leaf>	subrange
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   703
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   704
%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
   705
%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
   706
%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
   707
/* 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
   708
%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
   709
%type  <leaf>	enumerated_value
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
   710
//%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
   711
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   712
%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
   713
%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
   714
%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
   715
/* 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
   716
%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
   717
%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
   718
/* 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
   719
%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
   720
%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
   721
%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
   722
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>	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
   724
%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
   725
%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
   726
%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
   727
/* 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
   728
%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
   729
%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
   730
%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
   731
%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
   732
/* 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
   733
%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
   734
%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
   735
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   736
//%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
   737
%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
   738
/* 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
   739
%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
   740
/* 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
   741
%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
   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
%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
   744
%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
   745
%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
   746
%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
   747
%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
   748
%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
   749
%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
   750
%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
   751
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   752
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   753
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   754
/*********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   755
/* 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
   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>	variable
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>	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
   759
/* 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
   760
%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
   761
%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
   762
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   763
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   764
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   765
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   766
/********************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   767
/* 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
   768
/********************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   769
/* 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
   770
 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
   771
 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
   772
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   773
%token <ID>	direct_variable_token
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
   774
//%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
   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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   777
/*************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   778
/* 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
   779
/*************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   780
%type  <leaf>	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
   781
/* 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
   782
%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
   783
%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
   784
/* 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
   785
%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
   786
%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
   787
/* 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
   788
%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
   789
%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
   790
%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
   791
%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
   792
/* 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
   793
%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
   794
%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
   795
/* 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
   796
%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
   797
%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
   798
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   799
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   800
/******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   801
/* 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
   802
/******************************************/
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>	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
   804
/* 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
   805
%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
   806
%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
   807
%type  <leaf>	edge_declaration
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
   808
/* 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
   809
%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
   810
%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
   811
%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
   812
%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
   813
%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
   814
%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
   815
%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
   816
/* 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
   817
%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
   818
/* 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
   819
%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
   820
// %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
   821
// %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
   822
%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
   823
%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
   824
%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
   825
/* eno_param_declaration is not in the standard, but should be! */
147
f34f9084a20e fixed typo eno_param_declaration
lbessard
parents: 146
diff changeset
   826
%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
   827
%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
   828
/* 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
   829
%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
   830
%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
   831
%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
   832
%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
   833
%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
   834
%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
   835
%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
   836
%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
   837
%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
   838
/* 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
   839
%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
   840
%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
   841
%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
   842
/* 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
   843
%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
   844
%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
   845
%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
   846
%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
   847
/* 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
   848
%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
   849
%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
   850
%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
   851
%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
   852
%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
   853
%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
   854
%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
   855
%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
   856
%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
   857
%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
   858
%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
   859
%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
   860
/* 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
   861
%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
   862
%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
   863
%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
   864
%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
   865
/* 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
   866
%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
   867
/* 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
   868
 *  - 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
   869
 *  - 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
   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
%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
   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
%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
   874
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   875
%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
   876
%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
   877
%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
   878
%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
   879
%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
   880
%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
   881
%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
   882
%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
   883
%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
   884
%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
   885
%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
   886
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   887
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   888
/***********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   889
/* 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
   890
/***********************/
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
   891
// %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
   892
/* 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
   893
%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
   894
%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
   895
//%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
   896
/* 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
   897
//%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
   898
%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
   899
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>	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
   901
/* 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
   902
%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
   903
%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
   904
%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
   905
/* 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
   906
%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
   907
%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
   908
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  <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
   910
%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
   911
/* 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
   912
%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
   913
%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
   914
%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
   915
%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
   916
%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
   917
/* 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
   918
%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
   919
/* 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
   920
%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
   921
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   922
%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
   923
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   924
%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
   925
%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
   926
%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
   927
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   928
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   929
/*****************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   930
/* 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
   931
/*****************************/
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>	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
   933
%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
   934
%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
   935
%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
   936
%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
   937
%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
   938
%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
   939
%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
   940
/* 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
   941
%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
   942
/* 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
   943
%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
   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 <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
   946
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   947
%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
   948
%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
   949
%token VAR_TEMP
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   950
// %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
   951
%token VAR
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   952
// %token NON_RETAIN
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   953
// %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
   954
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   955
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
/* 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
   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
%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
   960
%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
   961
/* 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
   962
%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
   963
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   964
%token PROGRAM
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   965
%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
   966
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   967
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   968
/********************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   969
/* 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
   970
/********************************************/
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   971
0
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  <list>	sequential_function_chart
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   973
%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
   974
%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
   975
%type  <leaf>	step
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   976
%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
   977
%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
   978
%type  <leaf>	action_association
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   979
/* 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
   980
%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
   981
%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
   982
%type  <leaf>	action_qualifier
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   983
%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
   984
%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
   985
%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
   986
%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
   987
%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
   988
%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
   989
%type  <list>	step_name_list
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
   990
%type  <leaf>	transition_priority
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
   991
%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
   992
%type  <leaf>	action
151
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
   993
%type  <leaf>	action_body
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   994
%type  <leaf>	transition_name
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   995
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   996
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
   997
// %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
   998
%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
   999
%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
  1000
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1001
%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
  1002
%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
  1003
%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
  1004
%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
  1005
%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
  1006
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1007
%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
  1008
%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
  1009
%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
  1010
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1011
%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
  1012
%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
  1013
%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
  1014
%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
  1015
%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
  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 N
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 P
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1019
/* 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
  1020
 * 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
  1021
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1022
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1023
%token R
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1024
%token S
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
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
/* 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
  1030
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1031
%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
  1032
%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
  1033
%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
  1034
// 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
  1035
//  - 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
  1036
//  - 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
  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
%type  <leaf>	optional_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
  1039
// 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
  1040
%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
  1041
// 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
  1042
%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
  1043
// 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
  1044
%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
  1045
%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
  1046
%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
  1047
// 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
  1048
%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
  1049
// 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
  1050
%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
  1051
%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
  1052
// %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
  1053
// 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
  1054
// %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
  1055
// %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
  1056
// %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
  1057
// 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
  1058
%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
  1059
%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
  1060
// %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
  1061
%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
  1062
%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
  1063
// %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
  1064
%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
  1065
%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
  1066
%type  <leaf>	task_initialization
74
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  1067
// 3 helper symbols for task_initialization
75
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  1068
%type  <leaf>	task_initialization_single
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  1069
%type  <leaf>	task_initialization_interval
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  1070
%type  <leaf>	task_initialization_priority
74
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  1071
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1072
%type  <leaf>	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
  1073
%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
  1074
// 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
  1075
%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
  1076
// 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
  1077
%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
  1078
%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
  1079
%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
  1080
%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
  1081
%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
  1082
%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
  1083
%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
  1084
%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
  1085
// 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
  1086
%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
  1087
%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
  1088
// 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
  1089
%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
  1090
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1091
%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
  1092
%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
  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
%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
  1095
%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
  1096
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1097
%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
  1098
%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
  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
%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
  1101
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1102
// %type  <leaf>	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
  1103
// %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
  1104
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1105
%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
  1106
%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
  1107
%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
  1108
%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
  1109
%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
  1110
%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
  1111
%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
  1112
%token VAR_ACCESS
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1113
// %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
  1114
%token WITH
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1115
// %token PROGRAM
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1116
// %token RETAIN
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1117
// %token NON_RETAIN
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1118
// %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
  1119
%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
  1120
%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
  1121
%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
  1122
%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
  1123
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1124
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1125
/***********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1126
/* 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
  1127
/***********************************/
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  <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
  1129
%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
  1130
%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
  1131
%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
  1132
%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
  1133
// helper symbol for il_simple_operation
91
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  1134
//%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
  1135
%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
  1136
%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
  1137
%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
  1138
%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
  1139
// 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
  1140
%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
  1141
%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
  1142
%type  <list>	il_operand_list
91
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  1143
// helper symbol for il_simple_operation
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  1144
%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
  1145
%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
  1146
%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
  1147
%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
  1148
%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
  1149
%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
  1150
%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
  1151
%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
  1152
%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
  1153
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1154
%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
  1155
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1156
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1157
/*******************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1158
/* 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
  1159
/*******************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1160
%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
  1161
%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
  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>	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
  1164
%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
  1165
%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
  1166
%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
  1167
%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
  1168
%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
  1169
%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
  1170
%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
  1171
%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
  1172
%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
  1173
%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
  1174
%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
  1175
%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
  1176
%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
  1177
%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
  1178
%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
  1179
%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
  1180
%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
  1181
%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
  1182
%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
  1183
%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
  1184
%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
  1185
%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
  1186
%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
  1187
%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
  1188
%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
  1189
%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
  1190
%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
  1191
%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
  1192
%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
  1193
%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
  1194
%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
  1195
%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
  1196
%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
  1197
%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
  1198
%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
  1199
%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
  1200
%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
  1201
%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
  1202
%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
  1203
%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
  1204
%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
  1205
%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
  1206
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1207
%type  <leaf>	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
  1208
%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
  1209
%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
  1210
%type  <leaf>	il_simple_operator_clash2
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_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
  1212
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
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_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
  1215
%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
  1216
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1217
%type  <leaf>	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
  1218
%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
  1219
%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
  1220
%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
  1221
%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
  1222
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1223
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1224
%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
  1225
%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
  1226
%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
  1227
%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
  1228
%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
  1229
%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
  1230
%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
  1231
%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
  1232
%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
  1233
%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
  1234
%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
  1235
%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
  1236
%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
  1237
%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
  1238
%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
  1239
%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
  1240
%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
  1241
%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
  1242
%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
  1243
%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
  1244
%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
  1245
%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
  1246
%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
  1247
%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
  1248
%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
  1249
%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
  1250
%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
  1251
%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
  1252
%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
  1253
%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
  1254
%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
  1255
%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
  1256
%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
  1257
%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
  1258
%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
  1259
%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
  1260
%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
  1261
%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
  1262
%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
  1263
%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
  1264
%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
  1265
%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
  1266
%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
  1267
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1268
%token SENDTO   /* "=>" */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1269
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1270
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1271
/***********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1272
/* 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
  1273
/***********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1274
/* NOTE:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1275
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1276
 *    - 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
  1277
 *      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
  1278
 *      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
  1279
 *      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
  1280
 */
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>	expression
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>	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
  1283
%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
  1284
%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
  1285
%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
  1286
// %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
  1287
%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
  1288
// %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
  1289
%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
  1290
// %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
  1291
%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
  1292
%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
  1293
// %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
  1294
%type  <leaf>	primary_expression
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1295
%type  <leaf>	non_negative_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
  1296
/* 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
  1297
%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
  1298
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1299
// %token AND
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1300
// %token XOR
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1301
// %token OR
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1302
// %token MOD
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1303
// %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
  1304
%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
  1305
%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
  1306
%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
  1307
%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
  1308
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1309
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1310
/********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1311
/* 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
  1312
/********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1313
%type <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
  1314
%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
  1315
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1316
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1317
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1318
/*********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1319
/* 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
  1320
/*********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1321
%type <leaf> assignment_statement
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1322
// %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
  1323
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1324
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1325
/*****************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1326
/* 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
  1327
/*****************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1328
%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
  1329
%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
  1330
%type <leaf>	fb_invocation
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  1331
// %type <leaf>	param_assignment
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  1332
%type <leaf>	param_assignment_formal
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  1333
%type <leaf>	param_assignment_nonformal
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  1334
/* helper symbols for fb_invocation */
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  1335
%type <list> param_assignment_formal_list
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  1336
%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
  1337
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1338
// %token ASSIGN
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1339
// %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
  1340
%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
  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
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
/* 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
  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
%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
  1347
%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
  1348
%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
  1349
%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
  1350
%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
  1351
%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
  1352
/* 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
  1353
%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
  1354
/* 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
  1355
%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
  1356
/* 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
  1357
%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
  1358
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1359
%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
  1360
%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
  1361
%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
  1362
%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
  1363
%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
  1364
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1365
%token CASE
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1366
// %token OF
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1367
// %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
  1368
%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
  1369
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1370
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1371
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1372
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1373
/* 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
  1374
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1375
%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
  1376
%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
  1377
%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
  1378
%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
  1379
%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
  1380
%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
  1381
/* 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
  1382
// %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
  1383
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1384
%token FOR
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1385
// %token ASSIGN
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1386
// %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
  1387
%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
  1388
%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
  1389
%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
  1390
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1391
%token WHILE
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  1392
// %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
  1393
%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
  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
%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
  1396
%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
  1397
%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
  1398
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1399
%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
  1400
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  1401
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1402
%%
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1405
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1406
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1407
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1408
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1409
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1410
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1411
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1412
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1413
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1414
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1415
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1416
/********************************************************/
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
/********************************************************/
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
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1423
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1424
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1425
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1426
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1427
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1428
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1429
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1430
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1431
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1432
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1433
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1434
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1435
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1436
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1437
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1438
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1439
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1440
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1441
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1442
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1443
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1444
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1445
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1446
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1447
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1448
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1449
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1450
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1451
/********************************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1452
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1453
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1454
start:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1455
  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
  1456
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1457
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1458
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1459
/**********************************************************************************/
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1460
/* 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
  1461
/**********************************************************************************/
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1462
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1463
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1464
/* 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
  1465
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
  1466
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
  1467
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
  1468
  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
  1469
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
  1470
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
  1471
  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
  1472
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1473
pragma:
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1474
  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
  1475
267
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
  1476
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
  1477
  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
  1478
| 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
  1479
| pragma
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
  1480
;
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 264
diff changeset
  1481
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1482
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  1483
/* EN/ENO */
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1484
/* 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
  1485
 * similarly to these...
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1486
 */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1487
en_identifier:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1488
  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
  1489
;
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1490
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1491
eno_identifier:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1492
  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
  1493
;
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1494
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1495
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1496
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1497
/*************************************/
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1498
/* Prelimenary helpful constructs... */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  1499
/*************************************/
0
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
/* NOTE:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1502
 *       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
  1503
 *       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
  1504
 *       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
  1505
 *       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
  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
 *       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
  1508
 *       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
  1509
 *       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
  1510
 *       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
  1511
 *       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
  1512
 *       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
  1513
 *       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
  1514
 *       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
  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
 *       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
  1517
 *       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
  1518
 *       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
  1519
 *       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
  1520
 *       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
  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
 *       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
  1523
 *       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
  1524
 *       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
  1525
 *       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
  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
/* NOTE:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1528
 *  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
  1529
 *  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
  1530
 *  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
  1531
 *  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
  1532
 *  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
  1533
 *  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
  1534
 *  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
  1535
 *  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
  1536
 *  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
  1537
 *  (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
  1538
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1539
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
  1540
  identifier
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1541
| 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
  1542
| 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
  1543
/**/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1544
| prev_declared_enumerated_type_name
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1545
| 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
  1546
| prev_declared_subrange_type_name
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1547
| 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
  1548
| 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
  1549
| prev_declared_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
  1550
| prev_declared_derived_function_name
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1551
| 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
  1552
| prev_declared_program_type_name
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1553
/**/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1554
| 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
  1555
| 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
  1556
| 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
  1557
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1558
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1559
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1560
prev_declared_variable_name: prev_declared_variable_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1561
prev_declared_fb_name: prev_declared_fb_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1562
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1563
prev_declared_simple_type_name: prev_declared_simple_type_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1564
prev_declared_subrange_type_name: prev_declared_subrange_type_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1565
prev_declared_enumerated_type_name: prev_declared_enumerated_type_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1566
prev_declared_array_type_name: prev_declared_array_type_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1567
prev_declared_structure_type_name: prev_declared_structure_type_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1568
prev_declared_string_type_name: prev_declared_string_type_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1569
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1570
prev_declared_derived_function_name: prev_declared_derived_function_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1571
prev_declared_derived_function_block_name: prev_declared_derived_function_block_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1572
prev_declared_program_type_name: prev_declared_program_type_name_token {$$ = new identifier_c($1, locloc(@$));};
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1573
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1574
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1575
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
/* 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
  1578
/***************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1579
library:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1580
  /* empty */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1581
	{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
  1582
	  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
  1583
	 $$ = (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
  1584
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1585
| 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
  1586
	{$$ = $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
  1587
| 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
  1588
	{$$ = $1; $$->add_element($2);}
77
fe4ecf7efa79 adding some comments.
mario
parents: 75
diff changeset
  1589
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1590
| library error library_element_declaration
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1591
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unknown syntax error."); yyerrok;}
73
0e623bbdee95 fixing infinite error loops at library level, and ...
mario
parents: 68
diff changeset
  1592
| library error END_OF_INPUT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1593
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unknown syntax error."); yyerrok;}
77
fe4ecf7efa79 adding some comments.
mario
parents: 75
diff changeset
  1594
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1595
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1596
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
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
  1599
  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
  1600
| 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
  1601
| 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
  1602
| 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
  1603
| 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
  1604
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1605
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1606
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1607
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1608
/*******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1609
/* 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
  1610
/*******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1611
/* 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
  1612
 *         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
  1613
 *       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
  1614
 *       or '_'.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1615
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1616
 *       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
  1617
 *       "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
  1618
 *         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
  1619
 *       (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
  1620
 *       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
  1621
 *       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
  1622
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1623
 *       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
  1624
 *       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
  1625
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1626
 *       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
  1627
 *          - 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
  1628
 *          - 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
  1629
 *          - 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
  1630
 *       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
  1631
 *       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
  1632
 *       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
  1633
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1634
 *       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
  1635
 *       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
  1636
 *         (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
  1637
 *             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
  1638
 *             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
  1639
 *         (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
  1640
 *             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
  1641
 *             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
  1642
 *             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
  1643
 *             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
  1644
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1645
 *       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
  1646
 *       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
  1647
 *       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
  1648
 *       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
  1649
 *       identifiers as keywords / tokens if we are currently parsing IL code.
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  1650
 *       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
  1651
 *       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
  1652
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1653
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1654
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1655
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1656
 * 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
  1657
 *         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
  1658
 *         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
  1659
 *         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
  1660
 *         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
  1661
 *         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
  1662
 *         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
  1663
 *         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
  1664
 *         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
  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
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1668
 * 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
  1669
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1670
 *          - 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
  1671
 *          - 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
  1672
 *          - 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
  1673
 *          - 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
  1674
 *          - 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
  1675
 *          - AT
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1676
 *          - 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
  1677
 *          - 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
  1678
 *          - CONSTANT
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1679
 *          - 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
  1680
 *          - EXIT
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1681
 *          - FALSE
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1682
 *          - 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
  1683
 *          - 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
  1684
 *          - 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
  1685
 *          - 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
  1686
 *          - 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
  1687
 *          - 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
  1688
 *          - 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
  1689
 *          - 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
  1690
 *          - 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
  1691
 *          - 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
  1692
 *          - 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
  1693
 *          - 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
  1694
 *          - 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
  1695
 *          - 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
  1696
 *          - RETURN
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1697
 *          - 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
  1698
 *          - 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
  1699
 *          - TASK
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1700
 *          - 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
  1701
 *          - TRUE
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1702
 *          - 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
  1703
 *          - 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
  1704
 *          - 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
  1705
 *          - 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
  1706
 *          - 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
  1707
 *          - 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
  1708
 *          - 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
  1709
 *          - 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
  1710
 *          - 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
  1711
 *          - 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
  1712
 *          - 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
  1713
 *          - WITH
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1714
 */
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
identifier:
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1717
  identifier_token	{$$ = new identifier_c($1, locloc(@$));}
78
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  1718
;
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  1719
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  1720
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1721
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1722
/*********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1723
/* 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
  1724
/*********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1725
constant:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1726
  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
  1727
| 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
  1728
| 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
  1729
| 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
  1730
| 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
  1731
/* NOTE: in order to remove reduce/reduce conflicts,
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1732
 * [between -9.5 being parsed as 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1733
 *     (i)   a signed real, 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1734
 *     (ii)  or as a real preceded by the '-' operator
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1735
 *  ]
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1736
 *  we need to define a variant of the constant construct
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1737
 *  where any constant is never preceded by the '-' character.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1738
 * In order to do this, we have borugh the signed_real 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1739
 * directly into the definition of the constant construct
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1740
 * (so we can define another non_negative_constant
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1741
 * construct that does not include it!)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1742
 */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1743
| signed_real
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1744
/* NOTE: in order to remove reduce/reduce conflicts,
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1745
 * unsigned_integer, signed_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
  1746
 * and hex_integer have been integrated directly into
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1747
 * the constants construct, instead of belonging to
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1748
 * both the bit_string_literal or integer_literal
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1749
 * construct.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1750
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1751
/* 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
  1752
 * 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
  1753
 * 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
  1754
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1755
/*| integer {} */  /* i.e. an unsigned_integer */ /* NOTE: already included as a 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
  1756
| 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
  1757
| 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
  1758
| 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
  1759
| 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
  1760
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1761
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1762
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1763
/* NOTE: in order to remove reduce/reduce conflicts,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1764
 * [between -9.5 being parsed as 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1765
 *     (i)   a signed real, 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1766
 *     (ii)  or as a real preceded by the '-' operator
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1767
 *  ]
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1768
 *  we need to define a variant of the constant construct
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1769
 *  where any constant is never preceded by the '-' character.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1770
 * In order to do this, we have borugh the signed_real 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1771
 * directly into the definition of the constant construct
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1772
 * (so we can define another non_negative_constant
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1773
 * construct that does not include it!)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1774
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1775
non_negative_constant:
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1776
  numeric_literal
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1777
| 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
  1778
| 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
  1779
| 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
  1780
| boolean_literal
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1781
/* NOTE: in order to remove reduce/reduce conflicts,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1782
 * [between -9.5 being parsed as 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1783
 *     (i)   a signed real, 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1784
 *     (ii)  or as a real preceded by the '-' operator
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1785
 *  ]
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1786
 *  we need to define a variant of the constant construct
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1787
 *  where any constant is never preceded by the '-' character.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1788
 * In order to do this, we have borugh the signed_real 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1789
 * directly into the definition of the constant construct
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1790
 * (so we can define another non_negative_constant
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1791
 * construct that does not include it!)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1792
 */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1793
/* | signed_real */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1794
| real /* an unsigned real */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1795
/* NOTE: in order to remove reduce/reduce conflicts,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1796
 * unsigned_integer, signed_integer, binary_integer, octal_integer
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1797
 * and hex_integer have been integrated directly into
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1798
 * the constants construct, instead of belonging to
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1799
 * both the bit_string_literal or integer_literal
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1800
 * construct.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1801
 */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1802
/* NOTE: unsigned_integer, although used in some
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1803
 * rules, is not defined in the spec!
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1804
 * We therefore replaced unsigned_integer as integer
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1805
 */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1806
| integer  /* i.e. an unsigned_integer */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1807
/* | signed_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
  1808
| 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
  1809
| 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
  1810
| 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
  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
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
/* 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
  1816
/******************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1817
/* NOTES:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1818
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1819
 *    - integer 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
  1820
 *      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
  1821
 *      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
  1822
 *      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
  1823
 *      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
  1824
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1825
 *    - 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
  1826
 *      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
  1827
 *      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
  1828
 *      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
  1829
 *      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
  1830
 *      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
  1831
 *      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
  1832
 *      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
  1833
 *      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
  1834
 *      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
  1835
 *      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
  1836
 *      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
  1837
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1838
 *      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
  1839
 *      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
  1840
 *      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
  1841
 *      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
  1842
 *      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
  1843
 *      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
  1844
 *
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1845
 *    - 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
  1846
 *      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
  1847
 *      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
  1848
 *      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
  1849
 *      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
  1850
 *      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
  1851
 *      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
  1852
 *      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
  1853
 *      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
  1854
 *      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
  1855
 *      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
  1856
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1857
 *    - 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
  1858
 *        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
  1859
 *      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
  1860
 *      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
  1861
 *        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
  1862
 *      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
  1863
 *      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
  1864
 *      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
  1865
 *        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
  1866
 *      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
  1867
 *      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
  1868
 *      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
  1869
 *       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
  1870
 *      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
  1871
 *      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
  1872
 *      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
  1873
 *        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
  1874
 *      (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
  1875
 *      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
  1876
 *      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
  1877
 *      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
  1878
 *      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
  1879
 *      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
  1880
 *        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
  1881
 *      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
  1882
 *        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
  1883
 *      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
  1884
 *        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
  1885
 *        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
  1886
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1887
real:
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1888
  real_token		{$$ = new real_c($1, locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1889
| fixed_point_token	{$$ = new real_c($1, locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1890
;
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1891
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1892
integer:	integer_token		{$$ = new integer_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1893
binary_integer:	binary_integer_token	{$$ = new binary_integer_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1894
octal_integer:	octal_integer_token	{$$ = new octal_integer_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1895
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
  1896
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1897
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
  1898
  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
  1899
| 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
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1901
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1902
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1903
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
  1904
  integer_type_name '#' signed_integer
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1905
	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@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
  1906
| integer_type_name '#' binary_integer
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1907
	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@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
  1908
| integer_type_name '#' octal_integer
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1909
	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@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
  1910
| integer_type_name '#' hex_integer
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1911
	{$$ = new integer_literal_c($1, $3, locf(@1), locl(@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
  1912
/* 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
  1913
 * why signed_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
  1914
 * 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
  1915
 */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1916
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1917
| integer_type_name signed_integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1918
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1919
| integer_type_name binary_integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1920
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1921
| integer_type_name octal_integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1922
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1923
| integer_type_name hex_integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1924
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between integer type name and value in integer literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1925
| integer_type_name '#' error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1926
	{$$ = NULL; 
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1927
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for integer literal.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1928
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for integer literal."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1929
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1930
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1931
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1932
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1933
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1934
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
  1935
  integer
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1936
| '+' integer   {$$ = $2;}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1937
| '-' 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
  1938
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1939
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1940
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1941
real_literal:
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1942
/* NOTE: see note in the definition of constant for reason
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1943
 * why signed_real is missing here!
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1944
 */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1945
/*  signed_real */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1946
  real_type_name '#' signed_real
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1947
	{$$ = new real_literal_c($1, $3, locf(@1), locl(@3));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1948
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1949
| real_type_name signed_real
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1950
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between real type name and value in real literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1951
| real_type_name '#' error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1952
  {$$ = NULL;
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1953
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for real literal.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1954
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for real literal."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1955
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1956
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1957
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1958
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1959
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
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
  1962
  real
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1963
| '+' real	{$$ = $2;}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1964
| '-' real	{$$ = new neg_real_c($2, locloc(@2));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1965
;
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1966
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1967
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1968
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1969
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
  1970
  bit_string_type_name '#' integer  /* i.e. unsigned_integer */
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1971
	{$$ = new bit_string_literal_c($1, $3, locf(@1), locl(@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
  1972
| bit_string_type_name '#' binary_integer
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1973
	{$$ = new bit_string_literal_c($1, $3, locf(@1), locl(@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
  1974
| bit_string_type_name '#' octal_integer
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1975
	{$$ = new bit_string_literal_c($1, $3, locf(@1), locl(@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
  1976
| bit_string_type_name '#' hex_integer
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  1977
	{$$ = new bit_string_literal_c($1, $3, locf(@1), locl(@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
  1978
/* 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
  1979
 * 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
  1980
 * 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
  1981
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1982
/* 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
  1983
 * 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
  1984
 * 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
  1985
 * 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
  1986
 */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1987
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1988
| bit_string_type_name integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1989
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1990
| bit_string_type_name binary_integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1991
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1992
| bit_string_type_name octal_integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1993
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1994
| bit_string_type_name hex_integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1995
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  1996
| bit_string_type_name '#' error
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  1997
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1998
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for bit string literal.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  1999
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for bit string literal."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2000
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2001
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2002
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2003
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2004
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2005
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2006
boolean_literal:
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2007
  boolean_true_literal_token
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2008
	{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)),
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2009
				    new boolean_true_c(locloc(@$)),
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2010
				    locloc(@$));
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2011
	}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2012
| boolean_false_literal_token
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2013
	{$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)),
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2014
				    new boolean_false_c(locloc(@$)),
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2015
				    locloc(@$));
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2016
	}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2017
| safeboolean_true_literal_token
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2018
	{$$ = new boolean_literal_c(new safebool_type_name_c(locloc(@$)),
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2019
				    new boolean_true_c(locloc(@$)),
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2020
				    locloc(@$));
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2021
	}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2022
| safeboolean_false_literal_token
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2023
	{$$ = new boolean_literal_c(new safebool_type_name_c(locloc(@$)),
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2024
				    new boolean_false_c(locloc(@$)),
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2025
				    locloc(@$));
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2026
	}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2027
| FALSE
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2028
	{$$ = new boolean_literal_c(NULL,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2029
				    new boolean_false_c(locloc(@$)),
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2030
				    locloc(@$));
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2031
	}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2032
| TRUE
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2033
	{$$ = new boolean_literal_c(NULL,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2034
				    new boolean_true_c(locloc(@$)),
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2035
				    locloc(@$));
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2036
	}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2037
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2038
|	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
  2039
|	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
  2040
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2041
/* 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
  2042
 * 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
  2043
 * and
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2044
 * 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
  2045
 * 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
  2046
 * 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
  2047
 * 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
  2048
 * 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
  2049
 * 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
  2050
 * 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
  2051
 * 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
  2052
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2053
 * 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
  2054
 * 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
  2055
 * 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
  2056
 * 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
  2057
 * 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
  2058
 * 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
  2059
 * 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
  2060
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2061
 * 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
  2062
 * 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
  2063
 * 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
  2064
 * 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
  2065
 * 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
  2066
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2067
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2068
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2069
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
/*******************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2072
/* 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
  2073
/*******************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2074
/* 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
  2075
single_byte_character_string:	single_byte_character_string_token
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2076
	{$$ = 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
  2077
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2078
double_byte_character_string:	double_byte_character_string_token
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2079
	{$$ = 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
  2080
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2081
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2082
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
  2083
  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
  2084
| 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
  2085
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2086
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2087
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2088
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2089
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2090
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2091
/***************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2092
/* 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
  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
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
  2095
  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
  2096
| date
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2097
| 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
  2098
| duration
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2099
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2100
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2101
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2102
/************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2103
/* 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
  2104
/************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2105
duration:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2106
/*  (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
  2107
/* 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
  2108
 *       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
  2109
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2110
 *       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
  2111
 *       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
  2112
 *       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
  2113
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2114
 *       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
  2115
 *       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
  2116
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2117
  TIME '#' interval
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2118
	{$$ = 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
  2119
| TIME '#' '-' interval
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2120
	{$$ = 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
  2121
| T_SHARP interval
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2122
	{$$ = 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
  2123
| T_SHARP '-' interval
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2124
	{$$ = new duration_c(new time_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $3, locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2125
| SAFETIME '#' interval
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2126
	{$$ = new duration_c(new safetime_type_name_c(locloc(@1)), NULL, $3, locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2127
| SAFETIME '#' '-' interval
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2128
	{$$ = new duration_c(new safetime_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $4, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2129
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2130
| TIME interval
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2131
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME' and interval in duration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2132
| TIME '-' interval
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2133
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME' and interval in duration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2134
| TIME '#' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2135
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2136
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for duration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2137
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for duration."); yyclearin;}
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  2138
	 yyerrok;
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  2139
	}
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  2140
| T_SHARP error
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  2141
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2142
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no value defined for duration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2143
	 else {print_err_msg(locf(@2), locl(@2), "invalid value for duration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2144
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2145
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2146
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2147
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2148
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
interval:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2151
  days
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2152
| hours
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2153
| minutes
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2154
| seconds
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2155
| milliseconds
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
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2158
integer_d:  integer_d_token  {$$ = new integer_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2159
integer_h:  integer_h_token  {$$ = new integer_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2160
integer_m:  integer_m_token  {$$ = new integer_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2161
integer_s:  integer_s_token  {$$ = new integer_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2162
integer_ms: 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
  2163
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2164
fixed_point_d:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2165
  fixed_point_d_token
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2166
	{$$ = 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
  2167
| integer_d
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2168
;
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
fixed_point_h:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2171
  fixed_point_h_token
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2172
	{$$ = 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
  2173
| integer_h
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
fixed_point_m:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2177
  fixed_point_m_token
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2178
	{$$ = 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
  2179
| integer_m
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2182
fixed_point_s:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2183
  fixed_point_s_token
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2184
	{$$ = 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
  2185
| integer_s
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2186
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2187
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2188
fixed_point_ms:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2189
  fixed_point_ms_token
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2190
	{$$ = 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
  2191
| integer_ms
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2192
;
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2195
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
  2196
  fixed_point_token
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2197
	{$$ = 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
  2198
| integer
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2199
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2200
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2201
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2202
days:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2203
/*  fixed_point ('d') */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2204
  fixed_point_d
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2205
	{$$ = new days_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
  2206
/*| integer ('d') ['_'] hours */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2207
| integer_d hours
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2208
	{$$ = new days_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
  2209
| integer_d '_' hours
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2210
	{$$ = new days_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2211
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2212
| integer_d '_' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2213
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2214
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for hours in duration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2215
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for hours in duration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2216
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2217
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2218
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2219
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2220
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2221
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2222
hours:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2223
/*  fixed_point ('h') */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2224
  fixed_point_h
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2225
	{$$ = new hours_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
  2226
/*| integer ('h') ['_'] minutes */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2227
| integer_h minutes
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2228
	{$$ = new hours_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
  2229
| integer_h '_' minutes
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2230
	{$$ = new hours_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2231
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2232
| integer_h '_' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2233
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2234
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for minutes in duration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2235
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for minutes in duration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2236
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2237
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2238
/* ERROR_CHECK_END */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2239
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2240
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2241
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2242
minutes:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2243
/*  fixed_point ('m') */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2244
  fixed_point_m
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2245
	{$$ = new minutes_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
  2246
/*| integer ('m') ['_'] seconds */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2247
| integer_m seconds
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2248
	{$$ = new minutes_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
  2249
| integer_m '_' seconds
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2250
	{$$ = new minutes_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2251
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2252
| integer_m '_' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2253
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2254
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for seconds in duration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2255
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for seconds in duration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2256
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2257
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2258
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2259
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2260
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2261
seconds:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2262
/*  fixed_point ('s') */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2263
  fixed_point_s
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2264
	{$$ = new seconds_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
  2265
/*| integer ('s') ['_'] milliseconds */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2266
| integer_s milliseconds
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2267
	{$$ = new seconds_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
  2268
| integer_s '_' milliseconds
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2269
	{$$ = new seconds_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2270
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2271
| integer_s '_' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2272
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2273
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for milliseconds in duration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2274
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for milliseconds in duration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2275
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2276
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2277
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2278
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2279
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2280
milliseconds:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2281
/*  fixed_point ('ms') */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2282
  fixed_point_ms
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2283
	{$$ = new milliseconds_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
  2284
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2285
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2286
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2287
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2288
/************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2289
/* 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
  2290
/************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2291
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
  2292
  TIME_OF_DAY '#' daytime
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2293
	{$$ = new time_of_day_c(new tod_type_name_c(locloc(@1)), $3, locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2294
| SAFETIME_OF_DAY '#' daytime
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2295
	{$$ = new time_of_day_c(new safetod_type_name_c(locloc(@1)), $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2296
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2297
| TIME_OF_DAY daytime
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2298
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME_OF_DAY' and daytime in time of day."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2299
| TIME_OF_DAY '#' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2300
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2301
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for time of day.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2302
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for time of day."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2303
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2304
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2305
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2306
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2307
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2308
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2309
daytime:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2310
  day_hour ':' day_minute ':' day_second
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2311
	{$$ = new daytime_c($1, $3, $5, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2312
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2313
| ':' day_minute ':' day_second
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2314
  {$$ = NULL; print_err_msg(locf(@1), locl(@4), "no value defined for hours in daytime."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2315
| error ':' day_minute ':' day_second
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2316
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid value defined for hours in daytime."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2317
| day_hour day_minute ':' day_second
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2318
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between hours and minutes in daytime."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2319
| day_hour ':' ':' day_second
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2320
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for minutes in daytime."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2321
| day_hour ':' error ':' day_second
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2322
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value defined for minutes in daytime."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2323
| day_hour ':' day_minute day_second
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2324
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "':' missing between minutes and seconds in daytime."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2325
| day_hour ':' day_minute ':' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2326
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2327
	 if (is_current_syntax_token()) {print_err_msg(locl(@4), locf(@5), "no value defined for seconds in daytime.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2328
	 else {print_err_msg(locf(@5), locl(@5), "invalid value for seconds in daytime."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2329
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2330
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2331
/* ERROR_CHECK_END */
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
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2333
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2334
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2335
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
  2336
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
  2337
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
  2338
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2339
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2340
date:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2341
  DATE '#' date_literal
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2342
	{$$ = 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
  2343
| D_SHARP date_literal
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2344
	{$$ = new date_c(new date_type_name_c(locloc(@1)), $2, locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2345
| SAFEDATE '#' date_literal
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2346
	{$$ = new date_c(new safedate_type_name_c(locloc(@1)), $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2347
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2348
| DATE date_literal
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2349
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE' and date literal in date."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2350
| DATE '#' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2351
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2352
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for date.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2353
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for date."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2354
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2355
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2356
| D_SHARP error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2357
  {$$ = NULL;
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2358
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no value defined for date.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2359
	 else {print_err_msg(locf(@2), locl(@2), "invalid value for date."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2360
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2361
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2362
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2363
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2364
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2365
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2366
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
  2367
  year '-' month '-' day
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2368
	{$$ = new date_literal_c($1, $3, $5, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2369
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2370
| '-' month '-' day
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2371
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no value defined for year in date literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2372
| year month '-' day
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2373
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'-' missing between year and month in date literal."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2374
| year '-' '-' day
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2375
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for month in date literal."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2376
| year '-' error '-' day
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2377
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value defined for month in date literal."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2378
| year '-' month day
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2379
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "'-' missing between month and day in date literal."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2380
| year '-' month '-' error
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2381
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2382
	 if (is_current_syntax_token()) {print_err_msg(locl(@4), locf(@5), "no value defined for day in date literal.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2383
	 else {print_err_msg(locf(@5), locl(@5), "invalid value for day in date literal."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2384
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2385
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2386
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2387
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2388
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2389
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2390
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
  2391
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
  2392
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
  2393
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2394
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2395
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
  2396
  DATE_AND_TIME '#' date_literal '-' daytime
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2397
	{$$ = new date_and_time_c(new dt_type_name_c(locloc(@1)), $3, $5, locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2398
| SAFEDATE_AND_TIME '#' date_literal '-' daytime
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2399
	{$$ = new date_and_time_c(new safedt_type_name_c(locloc(@1)), $3, $5, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2400
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2401
| DATE_AND_TIME date_literal '-' daytime
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2402
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE_AND_TIME' and date literal in date and time."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2403
| DATE_AND_TIME '#' '-' daytime
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2404
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no value defined for date literal in date and time."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2405
| DATE_AND_TIME '#' error '-' daytime
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2406
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid value for date literal in date and time."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2407
| DATE_AND_TIME '#' date_literal daytime
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2408
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "'-' missing between date literal and daytime in date and time."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2409
| DATE_AND_TIME '#' date_literal '-' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2410
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2411
	 if (is_current_syntax_token()) {print_err_msg(locl(@4), locf(@5), "no value defined for daytime in date and time.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2412
	 else {print_err_msg(locf(@5), locl(@5), "invalid value for daytime in date and time."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2413
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2414
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2415
/* ERROR_CHECK_END */
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2418
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2419
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
/**********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2424
/* 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
  2425
/**********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2426
/* 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
  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
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
  2429
  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
  2430
| 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
  2431
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2432
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2433
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2434
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
  2435
  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
  2436
| 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
  2437
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2438
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2439
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2440
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2441
/***********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2442
/* 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
  2443
/***********************************/
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2444
    /******************************************************/
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2445
    /* SAFExxxx Symbols defined in                        */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2446
    /* "Safety Software Technical Specification,          */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2447
    /*  Part 1: Concepts and Function Blocks,             */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2448
    /*  Version 1.0 – Official Release"                   */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2449
    /* by PLCopen - Technical Committee 5 - 2006-01-31    */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2450
    /******************************************************/
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2451
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2452
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
  2453
  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
  2454
| 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
  2455
| 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
  2456
| elementary_string_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2457
| TIME		{$$ = new time_type_name_c(locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2458
| 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
  2459
/* 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
  2460
 * 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
  2461
 * 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
  2462
 */
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2463
| SAFETIME	{$$ = new safetime_type_name_c(locloc(@$));}
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  2464
| 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
  2465
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2466
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2467
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
  2468
  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
  2469
| 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
  2470
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2471
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2472
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
  2473
  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
  2474
| 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
  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
signed_integer_type_name:
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2478
  SINT		{$$ = new sint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2479
| INT		{$$ = new int_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2480
| DINT		{$$ = new dint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2481
| LINT		{$$ = new lint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2482
| SAFESINT	{$$ = new safesint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2483
| SAFEINT	{$$ = new safeint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2484
| SAFEDINT	{$$ = new safedint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2485
| 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
  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
unsigned_integer_type_name:
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2489
  USINT		{$$ = new usint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2490
| UINT		{$$ = new uint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2491
| UDINT		{$$ = new udint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2492
| ULINT		{$$ = new ulint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2493
| SAFEUSINT	{$$ = new safeusint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2494
| SAFEUINT	{$$ = new safeuint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2495
| SAFEUDINT	{$$ = new safeudint_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2496
| 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
  2497
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2498
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2499
real_type_name:
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2500
  REAL		{$$ = new real_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2501
| LREAL		{$$ = new lreal_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2502
| SAFEREAL	{$$ = new safereal_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2503
| 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
  2504
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2505
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2506
date_type_name:
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2507
  DATE			{$$ = new date_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2508
| TIME_OF_DAY		{$$ = new tod_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2509
| TOD			{$$ = new tod_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2510
| DATE_AND_TIME		{$$ = new dt_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2511
| DT			{$$ = new dt_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2512
| SAFEDATE		{$$ = new safedate_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2513
| SAFETIME_OF_DAY	{$$ = new safetod_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2514
| SAFETOD		{$$ = new safetod_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2515
| SAFEDATE_AND_TIME	{$$ = new safedt_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2516
| 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
  2517
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2518
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2519
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2520
bit_string_type_name:
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2521
  BYTE		{$$ = new byte_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2522
| WORD		{$$ = new word_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2523
| DWORD		{$$ = new dword_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2524
| LWORD		{$$ = new lword_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2525
| SAFEBYTE	{$$ = new safebyte_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2526
| SAFEWORD	{$$ = new safeword_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2527
| SAFEDWORD	{$$ = new safedword_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2528
| 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
  2529
/* 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
  2530
 * 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
  2531
 * 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
  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
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2534
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2535
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2536
/* Helper symbol 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
  2537
 * 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
  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
 * 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
  2540
 * 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
  2541
 * 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
  2542
 * 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
  2543
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2544
elementary_string_type_name:
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2545
  STRING	{$$ = new string_type_name_c(locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2546
| WSTRING	{$$ = new wstring_type_name_c(locloc(@$));}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2547
| SAFESTRING	{$$ = new safestring_type_name_c(locloc(@$));}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  2548
| 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
  2549
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2550
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2551
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2552
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2553
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2554
/* 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
  2555
/********************************/
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2556
/* 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
  2557
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2558
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
  2559
  ANY
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2560
| 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
  2561
| 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
  2562
| 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
  2563
| 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
  2564
| 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
  2565
| 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
  2566
| 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
  2567
| 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
  2568
| 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
  2569
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2570
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2571
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
/* 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
  2575
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2576
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2577
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
  2578
  single_element_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2579
| prev_declared_array_type_name
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2580
| prev_declared_structure_type_name
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2581
| prev_declared_string_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
  2582
;
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
single_element_type_name:
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2585
  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
  2586
/* 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
  2587
 * 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
  2588
 * 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
  2589
 */
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2590
//| prev_declared_derived_function_block_name
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2591
| prev_declared_subrange_type_name
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2592
| 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
  2593
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2594
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2595
/* 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
  2596
 *       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
  2597
 *       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
  2598
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2599
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2600
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
  2601
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
  2602
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
  2603
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
  2604
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
  2605
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2606
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2607
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
  2608
  TYPE type_declaration_list END_TYPE
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2609
	{$$ = new data_type_declaration_c($2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2610
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2611
| TYPE END_TYPE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2612
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no data type declared in data type(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2613
| TYPE error type_declaration_list END_TYPE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2614
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'TYPE' in data type(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2615
| TYPE type_declaration_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2616
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed data type(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2617
| TYPE error END_TYPE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2618
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in data type(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2619
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2620
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2621
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2622
/* 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
  2623
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
  2624
  type_declaration ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2625
	{$$ = 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
  2626
| 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
  2627
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2628
/* ERROR_CHECK_BEGIN */
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  2629
| error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2630
	{$$ = new type_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid data type declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2631
| type_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2632
	{$$ = new type_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of data type declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2633
| type_declaration_list type_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2634
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of data type declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  2635
| type_declaration_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2636
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid data type declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2637
| type_declaration_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2638
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after data type declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2639
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2640
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2641
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2642
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
  2643
  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
  2644
| 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
  2645
| 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
  2646
| 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
  2647
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2648
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2649
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
  2650
  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
  2651
| 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
  2652
| 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
  2653
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2654
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2655
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
  2656
/*  simple_type_name ':' 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
  2657
  identifier ':' simple_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2658
	{$$ = new simple_type_declaration_c($1, $3, locloc(@$));
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2659
	 library_element_symtable.insert($1, prev_declared_simple_type_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2660
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2661
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2662
| error ':' simple_spec_init
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2663
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid name defined for data type declaration.");yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2664
| identifier simple_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2665
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in simple type declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2666
| identifier ':' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2667
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2668
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in data type declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2669
	 else {print_err_msg(locf(@3), locl(@3), "invalid specification in data type declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2670
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2671
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2672
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2673
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2674
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2675
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2676
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
  2677
  simple_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2678
  /* The following commented line was changed to the 
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2679
   * 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
  2680
   * 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
  2681
   * 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
  2682
   */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2683
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2684
| 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
  2685
	{$$ = 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
  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
| elementary_type_name ASSIGN constant
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2688
	{$$ = 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
  2689
| prev_declared_simple_type_name ASSIGN constant
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2690
	{$$ = new simple_spec_init_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2691
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2692
| elementary_type_name constant
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2693
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in specification with initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2694
| prev_declared_simple_type_name constant
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2695
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in specification with initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2696
| elementary_type_name ASSIGN error
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2697
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2698
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in specification with initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2699
	 else {print_err_msg(locf(@3), locl(@3), "invalid initial value in specification with initialization."); yyclearin;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2700
	 yyerrok;
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2701
	}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2702
| prev_declared_simple_type_name ASSIGN error
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2703
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2704
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in specification with initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2705
	 else {print_err_msg(locf(@3), locl(@3), "invalid initial value in specification with initialization."); yyclearin;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2706
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2707
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2708
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2709
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2710
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2711
/* 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
  2712
 * 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
  2713
 * 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
  2714
 * 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
  2715
 * 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
  2716
 * 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
  2717
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2718
 * 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
  2719
 * 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
  2720
 * 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
  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
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
  2723
// 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
  2724
  elementary_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2725
	{$$ = 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
  2726
| prev_declared_simple_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2727
	{$$ = 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
  2728
;
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2731
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
  2732
/*  subrange_type_name ':' subrange_spec_init */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2733
  identifier ':' subrange_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2734
	{$$ = new subrange_type_declaration_c($1, $3, locloc(@$));
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2735
	 library_element_symtable.insert($1, prev_declared_subrange_type_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2736
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2737
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2738
| error ':' subrange_spec_init
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2739
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid name defined for subrange type declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2740
| identifier subrange_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2741
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in subrange type declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2742
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2743
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2744
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2745
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
  2746
  subrange_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2747
	{$$ = 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
  2748
| subrange_specification ASSIGN signed_integer
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2749
	{$$ = new subrange_spec_init_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2750
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2751
| subrange_specification signed_integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2752
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in subrange specification with initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2753
| subrange_specification ASSIGN error
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2754
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2755
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in subrange specification with initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2756
	 else {print_err_msg(locf(@3), locl(@3), "invalid initial value in subrange specification with initialization."); yyclearin;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2757
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2758
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2759
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2760
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2761
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2762
subrange_specification:
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2763
  integer_type_name '(' subrange ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2764
	{$$ = new subrange_specification_c($1, $3, locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2765
| prev_declared_subrange_type_name
98
d0cdf1d00b74 Adding support for derived data types.
lbessard
parents: 96
diff changeset
  2766
  {$$ = new subrange_specification_c($1, NULL, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2767
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2768
| integer_type_name '(' ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2769
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no subrange defined in subrange specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2770
| integer_type_name '(' error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2771
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid subrange defined in subrange specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2772
| integer_type_name '(' subrange error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2773
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after subrange defined in subrange specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2774
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2775
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2776
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2777
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2778
subrange:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2779
  signed_integer DOTDOT signed_integer
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2780
	{$$ = new subrange_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2781
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2782
| signed_integer signed_integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2783
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'..' missing between bounds in subrange definition."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2784
| signed_integer DOTDOT error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2785
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2786
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for upper bound in subrange definition.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2787
	 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
  2788
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2789
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2790
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2791
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2792
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2793
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
  2794
/*  enumerated_type_name ':' 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
  2795
  identifier ':' enumerated_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2796
	{$$ = new enumerated_type_declaration_c($1, $3, locloc(@$));
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2797
	 library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2798
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2799
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2800
| error ':' enumerated_spec_init
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2801
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid name defined for enumerated type declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2802
| identifier enumerated_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2803
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in enumerated type declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2804
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2805
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2806
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2807
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2808
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
  2809
  enumerated_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2810
	{$$ = 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
  2811
| enumerated_specification ASSIGN enumerated_value
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2812
	{$$ = new enumerated_spec_init_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2813
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2814
| enumerated_specification enumerated_value
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2815
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in enumerated specification with initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2816
| enumerated_specification ASSIGN error
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2817
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2818
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined in enumerated specification with initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2819
	 else {print_err_msg(locf(@3), locl(@3), "invalid value in enumerated specification with initialization."); yyclearin;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2820
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2821
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2822
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2823
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2824
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2825
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
  2826
  '(' 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
  2827
	{$$ = $2;}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2828
| prev_declared_enumerated_type_name
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2829
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2830
| '(' ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2831
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no enumerated value list defined in enumerated specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2832
| '(' error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2833
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid enumerated value list defined in enumerated specification.");yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2834
| '(' enumerated_value_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2835
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of enumerated specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2836
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2837
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2838
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2839
/* 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
  2840
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
  2841
  enumerated_value
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2842
	{$$ = 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
  2843
| 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
  2844
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2845
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2846
| enumerated_value_list enumerated_value
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2847
	{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in enumerated value list.");}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2848
| enumerated_value_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  2849
	{$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2850
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined in enumerated value list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2851
	 else {print_err_msg(locf(@3), locl(@3), "invalid value in enumerated value list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2852
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2853
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2854
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2855
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2856
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2857
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2858
enumerated_value:
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  2859
  identifier 
121
9e8ce092e169 Adding support for POU struct definition in POUS.h
lbessard
parents: 118
diff changeset
  2860
  {$$ = 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
  2861
| prev_declared_enumerated_type_name '#' any_identifier
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2862
	{$$ = new enumerated_value_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2863
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2864
| prev_declared_enumerated_type_name any_identifier
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2865
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between enumerated type name and value in enumerated literal."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2866
| prev_declared_enumerated_type_name '#' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2867
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2868
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for enumerated literal.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2869
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for enumerated literal."); yyclearin;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2870
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2871
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2872
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2873
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2874
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2875
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  2876
/*
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  2877
enumerated_value_without_identifier:
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  2878
  prev_declared_enumerated_type_name '#' any_identifier
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2879
	{$$ = new enumerated_value_c($1, $3, locloc(@$));}
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  2880
;
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  2881
*/
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  2882
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2883
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2884
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
  2885
/*  array_type_name ':' array_spec_init */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2886
  identifier ':' array_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2887
	{$$ = new array_type_declaration_c($1, $3, locloc(@$));
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2888
	 library_element_symtable.insert($1, prev_declared_array_type_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2889
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2890
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2891
| identifier array_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2892
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in array type declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2893
/* ERROR_CHECK_END */
0
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
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
  2897
  array_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2898
	{$$ = 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
  2899
| array_specification ASSIGN array_initialization
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2900
	{$$ = new array_spec_init_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2901
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2902
| array_specification array_initialization
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2903
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in array specification with initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2904
| array_specification ASSIGN error
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2905
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2906
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in array specification with initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2907
	 else {print_err_msg(locf(@3), locl(@3), "invalid initial value in array specification with initialization."); yyclearin;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2908
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2909
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2914
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
  2915
  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
  2916
| ARRAY '[' array_subrange_list ']' OF non_generic_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2917
	{$$ = new array_specification_c($3, $6, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2918
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2919
| ARRAY array_subrange_list ']' OF non_generic_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2920
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'[' missing before subrange list in array specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2921
| ARRAY '[' ']' OF non_generic_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2922
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no subrange list defined in array specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2923
| ARRAY '[' error ']' OF non_generic_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2924
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid subrange list defined in array specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2925
| ARRAY OF non_generic_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2926
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no subrange list defined in array specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2927
| ARRAY error OF non_generic_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2928
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid subrange list defined in array specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2929
| ARRAY '[' array_subrange_list OF non_generic_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2930
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "']' missing after subrange list in array specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2931
| ARRAY '[' array_subrange_list ']' non_generic_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2932
	{$$ = NULL; print_err_msg(locl(@4), locf(@5), "'OF' missing between subrange list and item type name in array specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2933
| ARRAY '[' array_subrange_list ']' OF error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2934
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2935
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no item data type defined in array specification.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2936
	 else {print_err_msg(locf(@3), locl(@3), "invalid item data type in array specification."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2937
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2938
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2939
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2940
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2941
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2942
/* 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
  2943
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
  2944
  subrange
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2945
	{$$ = new array_subrange_list_c(locloc(@$)); $$->add_element($1);}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2946
| array_subrange_list ',' subrange
98
d0cdf1d00b74 Adding support for derived data types.
lbessard
parents: 96
diff changeset
  2947
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2948
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2949
| array_subrange_list subrange
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2950
	{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in subrange list."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2951
| array_subrange_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  2952
	{$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2953
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no subrange defined in subrange list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2954
	 else {print_err_msg(locf(@3), locl(@3), "invalid subrange in subrange list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2955
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2956
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2957
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2958
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2959
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2960
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2961
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
  2962
  '[' 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
  2963
	{$$ = $2;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2964
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2965
| '[' ']'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2966
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no initial values list defined in array initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2967
| '[' error ']'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2968
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid initial values list defined in array initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2969
| '[' array_initial_elements_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2970
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "']' missing at the end of array initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2971
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2972
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2973
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2974
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2975
/* 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
  2976
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
  2977
  array_initial_elements
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2978
	{$$ = 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
  2979
| 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
  2980
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2981
/* ERROR_CHECK_BEGIN 
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2982
| array_initial_elements_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  2983
	{$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2984
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no array initial value in array initial values list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2985
	 else {print_err_msg(locf(@3), locl(@3), "invalid array initial value in array initial values list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2986
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2987
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  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
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_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
  2993
  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
  2994
| integer '(' ')'
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  2995
| integer '(' array_initial_element ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  2996
	{$$ = new array_initial_elements_c($1, $3, locloc(@$));}
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2997
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  2998
| integer '(' error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  2999
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid array initial value in array initial values list."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3000
| integer '(' array_initial_element error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3001
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of array initial value in array initial values list."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3002
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3003
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3004
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3005
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3006
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
  3007
  constant
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3008
| 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
  3009
| 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
  3010
| 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
  3011
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3012
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3013
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3014
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3015
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
  3016
/*  structure_type_name ':' structure_specification */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3017
  identifier ':' structure_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3018
	{$$ = new structure_type_declaration_c($1, $3, locloc(@$));
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3019
	 library_element_symtable.insert($1, prev_declared_structure_type_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3020
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3021
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3022
| identifier structure_specification
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3023
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between data type name and specification in structure type declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3024
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3025
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3026
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3027
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3028
structure_specification:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3029
  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
  3030
| 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
  3031
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3032
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3033
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3034
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
  3035
  prev_declared_structure_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3036
	{$$ = 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
  3037
| prev_declared_structure_type_name ASSIGN structure_initialization
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3038
	{$$ = new initialized_structure_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3039
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3040
| prev_declared_structure_type_name structure_initialization
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3041
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in structure specification with initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3042
| prev_declared_structure_type_name ASSIGN error
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3043
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3044
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined in structure specification with initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3045
	 else {print_err_msg(locf(@3), locl(@3), "invalid value in structure specification with initialization."); yyclearin;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3046
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3047
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3048
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3049
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3050
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3051
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3052
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
  3053
  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
  3054
	{$$ = $2;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3055
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3056
| STRUCT END_STRUCT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3057
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no structure element declared in structure type declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3058
| STRUCT error structure_element_declaration_list END_STRUCT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3059
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'STRUCT' in structure type declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3060
| STRUCT structure_element_declaration_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3061
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed structure type declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3062
| STRUCT error END_STRUCT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3063
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in structure type declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3064
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3065
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3066
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3067
/* 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
  3068
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
  3069
  structure_element_declaration ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3070
	{$$ = 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
  3071
| 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
  3072
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3073
/* ERROR_CHECK_BEGIN */
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  3074
| error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3075
	{$$ = new structure_element_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid structure element declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3076
| structure_element_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3077
	{$$ = new structure_element_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of structure element declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3078
| structure_element_declaration_list structure_element_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3079
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of structure element declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  3080
| structure_element_declaration_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3081
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid structure element declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3082
| structure_element_declaration_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3083
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after structure element declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  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
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
  3089
  structure_element_name ':' simple_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3090
	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3091
| structure_element_name ':' subrange_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3092
	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3093
| structure_element_name ':' enumerated_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3094
	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3095
| structure_element_name ':' array_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3096
	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3097
| structure_element_name ':' initialized_structure
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3098
	{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3099
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3100
| structure_element_name simple_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3101
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and simple specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3102
| structure_element_name subrange_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3103
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and subrange specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3104
| structure_element_name enumerated_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3105
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and enumerated specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3106
| structure_element_name array_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3107
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and array specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3108
| structure_element_name initialized_structure
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3109
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between structure element name and structure specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3110
| structure_element_name ':' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3111
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3112
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in structure element declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3113
	 else {print_err_msg(locf(@3), locl(@3), "invalid specification in structure element declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3114
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3115
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3116
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3117
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3118
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3119
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3120
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
  3121
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3122
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3123
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
  3124
  '(' 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
  3125
	{$$ = $2;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3126
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3127
| '(' error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3128
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid structure element initialization list in structure initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3129
| '(' structure_element_initialization_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3130
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "expecting ')' at the end of structure element initialization list in structure initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3131
/* ERROR_CHECK_END */
0
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
/* 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
  3135
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
  3136
  structure_element_initialization
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3137
	{$$ = 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
  3138
| 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
  3139
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3140
/* ERROR_CHECK_BEGIN 
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3141
| structure_element_initialization_list structure_element_initialization
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3142
	{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in structure element initialization list in structure initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3143
| structure_element_initialization_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  3144
	{$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3145
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no structure element initialization defined in structure initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3146
	 else {print_err_msg(locf(@3), locl(@3), "invalid structure element initialization in structure initialization."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3147
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3148
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3149
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3150
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3151
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
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
  3154
  structure_element_name ASSIGN constant
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3155
	{$$ = 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
  3156
| structure_element_name ASSIGN enumerated_value
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3157
	{$$ = 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
  3158
| structure_element_name ASSIGN array_initialization
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3159
	{$$ = 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
  3160
| structure_element_name ASSIGN structure_initialization
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3161
	{$$ = new structure_element_initialization_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3162
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3163
| structure_element_name constant
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3164
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in structure element initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3165
| structure_element_name enumerated_value
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3166
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in enumerated structure element initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3167
| structure_element_name array_initialization
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3168
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in array structure element initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3169
| structure_element_name structure_initialization
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3170
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing in structured structure element initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3171
| structure_element_name ASSIGN error
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3172
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3173
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in structured structure element initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3174
	 else {print_err_msg(locf(@3), locl(@3), "invalid initial value in structured structure element initialization."); yyclearin;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3175
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3176
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3177
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3178
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3179
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3180
/* 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
  3181
 *       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
  3182
 *       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
  3183
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3184
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3185
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
  3186
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3187
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3188
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
  3189
/*  string_type_name ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3190
  identifier ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3191
	{$$ = new string_type_declaration_c($1, $3, $4, $5, locloc(@$));
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3192
	 library_element_symtable.insert($1, prev_declared_string_type_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3193
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3194
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3195
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3196
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3197
/* 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
  3198
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
  3199
  '[' integer ']'
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3200
	{$$ = $2;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3201
/* REMOVED !! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3202
//|  /* empty */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3203
//	{$$ = NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3204
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3205
/* 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
  3206
 * 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
  3207
 * 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
  3208
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3209
 * 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
  3210
 *  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
  3211
 * 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
  3212
 * 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
  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
 * 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
  3215
 * 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
  3216
 * 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
  3217
 * 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
  3218
 * 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
  3219
 * 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
  3220
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3221
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3222
/* 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
  3223
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
  3224
  /* empty */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3225
	{$$ = NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3226
| 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
  3227
	{$$ = $2;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3228
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3229
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3230
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3231
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3232
/*********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3233
/* 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
  3234
/*********************/
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3235
/* 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
  3236
 *         - The standard considers 'ENO' as a keyword...
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3237
 *         - ...which means that it may never be parsed as an 'identifier'...
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3238
 *         - ...and therefore may never be used as the name of a variable inside an expression.
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3239
 *         - 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
  3240
 *           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
  3241
 *           character sequence as an identifier!
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3242
 *        The solution we found was to also allow the ENO keyword to be 
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3243
 *         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
  3244
 *         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
  3245
 *         as the standard requires us to define it implicitly in this case!
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3246
 *         We could not therefore handle the ENO as a normal variable that would
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3247
 *         go into the previously_declared_variable symbol table, as we may need to
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3248
 *         allow it to be used as a variable even though it is not declared as such!
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3249
 */
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
variable:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3251
  symbolic_variable
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  3252
| prev_declared_direct_variable
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3253
| eno_identifier
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3254
	{$$ = new symbolic_variable_c($1, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3257
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3258
symbolic_variable:
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3259
/* 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
  3260
 *         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
  3261
 */
78
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  3262
  prev_declared_fb_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3263
	{$$ = new symbolic_variable_c($1, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3264
| prev_declared_global_var_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3265
	{$$ = new symbolic_variable_c($1, locloc(@$));}
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  3266
| prev_declared_variable_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3267
	{$$ = new symbolic_variable_c($1, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3268
| multi_element_variable
78
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  3269
/*
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  3270
| identifier
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  3271
	{$$ = new symbolic_variable_c($1, locloc(@$));}
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  3272
*/
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3273
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3274
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3275
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3276
/* 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
  3277
 *       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
  3278
 *       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
  3279
 *       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
  3280
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3281
 *       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
  3282
 *       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
  3283
 *       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
  3284
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3285
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
  3286
// 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
  3287
  any_identifier
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3288
	{$$ = new symbolic_variable_c($1, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3289
| 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
  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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3292
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3293
/* 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
  3294
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
  3295
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3296
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3297
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3298
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3299
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3300
/********************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3301
/* 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
  3302
/********************************************/
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  3303
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
  3304
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3305
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3306
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3307
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3308
/*************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3309
/* 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
  3310
/*************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3311
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
  3312
  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
  3313
| 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
  3314
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3315
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3316
/* 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
  3317
any_multi_element_variable:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3318
  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
  3319
| 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
  3320
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3321
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
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
  3324
  subscripted_variable '[' subscript_list ']'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3325
	{$$ = 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
  3326
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3327
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3328
/* 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
  3329
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
  3330
  any_subscripted_variable '[' subscript_list ']'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3331
	{$$ = 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
  3332
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3333
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3334
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3335
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
  3336
  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
  3337
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3338
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3339
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3340
/* 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
  3341
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
  3342
  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
  3343
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3344
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3345
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3346
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
  3347
  subscript
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3348
	{$$ = 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
  3349
| 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
  3350
	{$$ = $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
  3351
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3352
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
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
  3355
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3356
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3357
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
  3358
  record_variable '.' field_selector
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3359
	{$$ = 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
  3360
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3361
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3362
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3363
/* 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
  3364
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
  3365
  any_record_variable '.' field_selector
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3366
	{$$ = 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
  3367
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3368
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3369
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3370
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3371
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
  3372
  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
  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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3376
/* 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
  3377
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
  3378
  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
  3379
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3380
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3381
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3382
field_selector: 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
  3383
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3384
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3385
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3386
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3387
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3388
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3389
/******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3390
/* 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
  3391
/******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3392
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
  3393
  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
  3394
	{$$ = 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
  3395
| 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
  3396
	{$$ = 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
  3397
| 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
  3398
	{$$ = new input_declarations_c(new non_retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));}
95
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
  3399
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3400
| VAR_INPUT END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3401
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in input variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3402
| VAR_INPUT RETAIN END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3403
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive input variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3404
| VAR_INPUT NON_RETAIN END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3405
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in non-retentive input variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3406
| VAR_INPUT error input_declaration_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3407
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_INPUT' in input variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3408
| VAR_INPUT RETAIN error input_declaration_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3409
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive input variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3410
| VAR_INPUT NON_RETAIN error input_declaration_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3411
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive input variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3412
| VAR_INPUT input_declaration_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3413
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed input variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3414
| VAR_INPUT RETAIN input_declaration_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3415
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive input variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3416
| VAR_INPUT NON_RETAIN input_declaration_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3417
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive input variable(s) declaration."); yyerrok;}
95
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
  3418
| VAR_INPUT error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3419
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in input variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3420
| VAR_INPUT RETAIN error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3421
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive input variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3422
| VAR_INPUT NON_RETAIN error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3423
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non-retentive input variable(s) declaration."); yyerrok;}
95
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
  3424
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3425
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3426
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3427
/* 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
  3428
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
  3429
  input_declaration ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3430
	{$$ = 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
  3431
| 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
  3432
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3433
/* ERROR_CHECK_BEGIN */
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  3434
| error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3435
	{$$ = new input_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid input variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3436
| input_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3437
	{$$ = new input_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of input variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3438
| input_declaration_list input_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3439
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of input variable(s) declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  3440
| input_declaration_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3441
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid input variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3442
| input_declaration_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3443
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after input variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3444
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3445
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3446
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3447
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3448
/* 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
  3449
 *       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
  3450
 *       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
  3451
 *       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
  3452
 */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3453
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
  3454
  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
  3455
| 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
  3456
| 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
  3457
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3458
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3459
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3460
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
  3461
  var1_list ':' BOOL R_EDGE
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3462
	{$$ = 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
  3463
| var1_list ':' BOOL F_EDGE
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3464
	{$$ = new edge_declaration_c(new falling_edge_option_c(locloc(@3)), $1, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3465
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3466
| 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
  3467
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3468
| 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
  3469
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in edge declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3470
| 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
  3471
	{$$ = 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
  3472
| 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
  3473
	{$$ = 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
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3474
| var1_list ':' R_EDGE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3475
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3476
| var1_list ':' F_EDGE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3477
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "'BOOL' missing in edge declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3478
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3479
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3480
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3481
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3482
/* 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
  3483
 *       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
  3484
 *       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
  3485
 *       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
  3486
 *       We have added the 'en_param_declaration' clause to cover for this.
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3487
 */
146
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3488
en_param_declaration:
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3489
  en_identifier ':' BOOL ASSIGN boolean_literal
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3490
  {$$ = new en_param_declaration_c($1, new bool_type_name_c(locloc(@$)), $5, new explicit_definition_c(), locloc(@$));}
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3491
| en_identifier ':' BOOL ASSIGN integer
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3492
  {$$ = new en_param_declaration_c($1, new bool_type_name_c(locloc(@$)), $5, new explicit_definition_c(), locloc(@$));}
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3493
/* ERROR_CHECK_BEGIN */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3494
| 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
  3495
	{$$ = 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
  3496
| 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
  3497
	{$$ = 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
  3498
| 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
  3499
  {$$ = 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
  3500
| 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
  3501
	{$$ = 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
  3502
| 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
  3503
	{$$ = NULL;
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3504
	 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
  3505
	 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
  3506
	 yyerrok;
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3507
	}
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3508
/* 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
  3509
;
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3510
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3511
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
  3512
  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
  3513
| 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
  3514
| 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
  3515
| 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
  3516
| 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
  3517
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3518
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3519
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3520
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3521
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3522
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
  3523
  var1_list ':' simple_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3524
	{$$ = 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
  3525
| var1_list ':' subrange_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3526
	{$$ = 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
  3527
| var1_list ':' enumerated_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3528
	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3529
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3530
| var1_list simple_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3531
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and simple specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3532
| var1_list subrange_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3533
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and subrange specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3534
| var1_list enumerated_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3535
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and enumerated specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3536
| var1_list ':' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3537
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3538
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in variable declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3539
	 else {print_err_msg(locf(@3), locl(@3), "invalid specification in variable declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3540
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3541
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3542
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3543
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3544
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3545
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3546
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
  3547
  variable_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3548
	{$$ = 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
  3549
	 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
  3550
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3551
 | 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
  3552
	{$$ = $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
  3553
	 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
  3554
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3555
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3556
| var1_list variable_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3557
	{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in variable list."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3558
| var1_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  3559
	{$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3560
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no variable name defined in variable declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3561
	 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
  3562
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3563
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3564
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3565
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3566
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3567
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3568
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3569
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
  3570
 var1_list ':' array_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3571
	{$$ = new array_var_init_decl_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3572
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3573
| var1_list array_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3574
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and array specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3575
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3576
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3577
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3578
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3579
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
  3580
  var1_list ':' initialized_structure
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3581
	{$$ = new structured_var_init_decl_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3582
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3583
| var1_list initialized_structure
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3584
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and structured specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3585
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3586
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3587
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3588
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3589
/* 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
  3590
 *       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
  3591
 *       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
  3592
 *       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
  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
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
  3595
/*  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
  3596
  fb_name_list_with_colon function_block_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3597
	{$$ = new fb_name_decl_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
  3598
/*| 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
  3599
| fb_name_list_with_colon function_block_type_name ASSIGN structure_initialization
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3600
	{$$ = new fb_name_decl_c($1, $2, $4, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3601
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3602
| fb_name_list_with_colon ASSIGN structure_initialization
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3603
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block type name defined in function block declaration with initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3604
| fb_name_list_with_colon function_block_type_name structure_initialization
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3605
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':=' missing in function block declaration with initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3606
| fb_name_list_with_colon function_block_type_name ASSIGN error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3607
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3608
	 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no initialization defined in function block declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3609
	 else {print_err_msg(locf(@4), locl(@4), "invalid initialization in function block declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3610
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3611
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3612
/* ERROR_CHECK_END */
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
/* 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
  3618
 *       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
  3619
 *       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
  3620
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3621
 *        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
  3622
 *        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
  3623
 *        (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
  3624
 *        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
  3625
 *        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
  3626
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3627
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3628
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
  3629
 (*  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
  3630
  identifier
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3631
	{$$ = 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
  3632
	 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
  3633
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3634
(* | 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
  3635
| 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
  3636
	{$$ = $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
  3637
	 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
  3638
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3639
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3640
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3641
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3642
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
  3643
  var1_list_with_colon
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3644
	{$$ = 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
  3645
	 /* 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
  3646
	  * 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
  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
	 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
  3649
	 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
  3650
	 /* 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
  3651
	  * 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
  3652
	  * 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
  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
	 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
  3655
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3656
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3657
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3658
/* 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
  3659
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
  3660
  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
  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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3664
// 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
  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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3667
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3668
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
  3669
  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
  3670
	{$$ = 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
  3671
| 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
  3672
	{$$ = 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
  3673
| 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
  3674
	{$$ = new output_declarations_c(new non_retain_option_c(locloc(@2)), $3, new explicit_definition_c(), locloc(@$));}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3675
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3676
| VAR_OUTPUT END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3677
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in output variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3678
| VAR_OUTPUT RETAIN END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3679
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive output variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3680
| VAR_OUTPUT NON_RETAIN END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3681
	{$$ = 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
  3682
| VAR_OUTPUT error var_output_init_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3683
	{$$ = 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
  3684
| VAR_OUTPUT RETAIN error var_output_init_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3685
	{$$ = 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
  3686
| VAR_OUTPUT NON_RETAIN error var_output_init_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3687
	{$$ = 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
  3688
| VAR_OUTPUT var_output_init_decl_list error END_OF_INPUT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3689
	{$$ = 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
  3690
| VAR_OUTPUT RETAIN var_output_init_decl_list error END_OF_INPUT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3691
	{$$ = 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
  3692
| VAR_OUTPUT NON_RETAIN var_output_init_decl_list error END_OF_INPUT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3693
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive output variable(s) declaration."); yyerrok;}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3694
| VAR_OUTPUT error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3695
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in output variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3696
| VAR_OUTPUT RETAIN error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3697
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive output variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3698
| VAR_OUTPUT NON_RETAIN error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3699
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non-retentive output variable(s) declaration."); yyerrok;}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3700
/* ERROR_CHECK_END */
0
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
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3703
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3704
/* 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
  3705
 *       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
  3706
 *       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
  3707
 *       We have added the 'eno_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
  3708
 */
146
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3709
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
  3710
  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
  3711
| 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
  3712
;
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3713
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3714
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
  3715
  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
  3716
	{$$ = 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
  3717
| 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
  3718
	{$$ = $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
  3719
/* 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
  3720
| 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
  3721
	{$$ = $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
  3722
| 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
  3723
	{$$ = $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
  3724
/* 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
  3725
;
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3726
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3727
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3728
/* 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
  3729
 *       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
  3730
 *       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
  3731
 *       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
  3732
 *       We have added the 'eno_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
  3733
 */
146
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3734
eno_param_declaration:
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3735
  eno_identifier ':' BOOL
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3736
  /* 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
  3737
   *      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
  3738
   */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3739
  {$$ = 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
  3740
/* ERROR_CHECK_BEGIN */
207
56ee922d0112 Bug in eno_param_declaration error handle fixed
laurent
parents: 202
diff changeset
  3741
| eno_identifier BOOL
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  3742
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and specification in ENO declaration."); yynerrs++;}
207
56ee922d0112 Bug in eno_param_declaration error handle fixed
laurent
parents: 202
diff changeset
  3743
| 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
  3744
	{$$ = NULL;
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3745
	 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
  3746
	 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
  3747
	 yyerrok;
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3748
	}
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
  3749
/* 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
  3750
;
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3751
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3752
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3753
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
  3754
  VAR_IN_OUT var_declaration_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3755
	{$$ = new input_output_declarations_c($2, locloc(@$));}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3756
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3757
| VAR_IN_OUT END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3758
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in in_out variable(s) declaration."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3759
| VAR_IN_OUT error var_declaration_list END_VAR
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3760
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_IN_OUT' in in_out variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3761
| VAR_IN_OUT var_declaration_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3762
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed in_out variable(s) declaration."); yyerrok;}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3763
| VAR_IN_OUT error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3764
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in in_out variable(s) declaration."); yyerrok;}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3765
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3766
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3767
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3768
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3769
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3770
/* 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
  3771
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
  3772
  var_declaration ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3773
	{$$ = 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
  3774
| 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
  3775
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3776
/* ERROR_CHECK_BEGIN */
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  3777
| error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3778
	{$$ = new var_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3779
| var_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3780
	{$$ = new var_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3781
| var_declaration_list var_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3782
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of variable(s) declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  3783
| var_declaration_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3784
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3785
| var_declaration_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3786
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3787
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3788
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3789
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3790
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3791
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
  3792
  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
  3793
| 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
  3794
;
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3797
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
  3798
  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
  3799
| 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
  3800
| 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
  3801
| 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
  3802
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3803
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3804
var1_declaration:
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  3805
  var1_list ':' simple_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3806
	{$$ = 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
  3807
| var1_list ':' subrange_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3808
	{$$ = 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
  3809
| var1_list ':' enumerated_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3810
	{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3811
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3812
| var1_list simple_specification
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3813
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and simple specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3814
| var1_list subrange_specification
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3815
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and subrange specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3816
| var1_list enumerated_specification
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3817
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and enumerated specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3818
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3819
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3820
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3821
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3822
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3823
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
  3824
  var1_list ':' array_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3825
	{$$ = new array_var_declaration_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3826
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3827
| var1_list array_specification
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3828
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and array specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3829
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3830
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3831
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_declaration:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3833
  var1_list ':' prev_declared_structure_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3834
	{$$ = new structured_var_declaration_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3835
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3836
| var1_list prev_declared_structure_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3837
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and structured specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3838
/* ERROR_CHECK_END */
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3841
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3842
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
  3843
  VAR var_init_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3844
	{$$ = 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
  3845
| VAR CONSTANT var_init_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3846
	{$$ = new var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3847
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3848
| VAR END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3849
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3850
| VAR CONSTANT END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3851
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in constant variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3852
| VAR error var_init_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3853
	{$$ = NULL; print_err_msg(locl(@1), locf(@3), "unexpected token after 'VAR' in variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3854
| VAR CONSTANT error var_init_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3855
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3856
| VAR var_init_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3857
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3858
| VAR CONSTANT var_init_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3859
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3860
| VAR error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3861
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3862
| VAR CONSTANT error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3863
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3864
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3865
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3866
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3867
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3868
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
  3869
  VAR RETAIN var_init_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3870
	{$$ = new retentive_var_declarations_c($3, locloc(@$));}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3871
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3872
| VAR RETAIN END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3873
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3874
| VAR RETAIN error var_init_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3875
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3876
| VAR RETAIN var_init_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3877
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive variable(s) declaration."); yyerrok;}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3878
| VAR RETAIN error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3879
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in retentive variable(s) declaration."); yyerrok;}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3880
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3881
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3882
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3883
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3884
located_var_declarations:
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3885
  VAR located_var_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3886
	{$$ = 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
  3887
| VAR CONSTANT located_var_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3888
	{$$ = 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
  3889
| VAR RETAIN located_var_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3890
	{$$ = 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
  3891
| VAR NON_RETAIN located_var_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3892
	{$$ = new located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3893
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3894
| VAR NON_RETAIN END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3895
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in non-retentive located variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3896
| VAR error located_var_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3897
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR' in located variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3898
| VAR CONSTANT error located_var_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3899
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant located variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3900
| VAR RETAIN error located_var_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3901
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive located variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3902
| VAR NON_RETAIN error located_var_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3903
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive located variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3904
| VAR located_var_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3905
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed located variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3906
| VAR CONSTANT located_var_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3907
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant located variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3908
| VAR RETAIN located_var_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3909
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive located variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3910
| VAR NON_RETAIN located_var_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3911
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed non-retentive located variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3912
| VAR NON_RETAIN error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3913
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in non retentive variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3914
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3915
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3916
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3917
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3918
/* 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
  3919
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
  3920
  located_var_decl ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3921
	{$$ = 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
  3922
| 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
  3923
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3924
/* ERROR_CHECK_BEGIN */
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  3925
| error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3926
	{$$ = new located_var_decl_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid located variable declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3927
| located_var_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3928
	{$$ = new located_var_decl_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of located variable declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3929
| located_var_decl_list located_var_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3930
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of located variable declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  3931
| located_var_decl_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3932
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid located variable declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3933
| located_var_decl_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3934
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after located variable declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3935
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3936
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3937
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3938
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3939
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
  3940
  variable_name location ':' located_var_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3941
	{$$ = 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
  3942
	 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
  3943
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3944
| location ':' located_var_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3945
	{$$ = new located_var_decl_c(NULL, $1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3946
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3947
| variable_name location located_var_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3948
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between located variable location and specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3949
| location located_var_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3950
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between located variable location and specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3951
| variable_name location ':' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3952
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3953
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in located variable declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3954
	 else {print_err_msg(locf(@3), locl(@3), "invalid specification in located variable declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3955
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3956
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3957
| location ':' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3958
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3959
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in located variable declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3960
	 else {print_err_msg(locf(@3), locl(@3), "invalid specification in located variable declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3961
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3962
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3963
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3964
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  3965
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
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
  3970
  VAR_EXTERNAL external_declaration_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3971
	{$$ = 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
  3972
| VAR_EXTERNAL CONSTANT external_declaration_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3973
	{$$ = new external_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3974
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3975
| VAR_EXTERNAL END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3976
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in external variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3977
| VAR_EXTERNAL CONSTANT END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3978
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in constant external variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3979
| VAR_EXTERNAL error external_declaration_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3980
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_EXTERNAL' in external variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3981
| VAR_EXTERNAL CONSTANT error external_declaration_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3982
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant external variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3983
| VAR_EXTERNAL external_declaration_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3984
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed external variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3985
| VAR_EXTERNAL CONSTANT external_declaration_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3986
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant external variable(s) declaration."); yyerrok;}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3987
| VAR_EXTERNAL error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3988
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in external variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3989
| VAR_EXTERNAL CONSTANT error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  3990
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant external variable(s) declaration."); yyerrok;}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  3991
/* ERROR_CHECK_END */
0
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
/* 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
  3995
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
  3996
  external_declaration ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  3997
	{$$ = new external_declaration_list_c(locloc(@$)); $$->add_element($1);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  3998
| 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
  3999
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4000
/* ERROR_CHECK_BEGIN */
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  4001
| error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4002
	{$$ = new external_declaration_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid external variable declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4003
| external_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4004
	{$$ = new external_declaration_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of external variable declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4005
| external_declaration_list external_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4006
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of external variable declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  4007
| external_declaration_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4008
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid external variable declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4009
| external_declaration_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4010
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after external variable declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4011
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4012
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4013
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
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
  4016
  global_var_name ':' simple_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4017
	{$$ = 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
  4018
	 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
  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
| global_var_name ':' subrange_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4021
	{$$ = 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
  4022
	 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
  4023
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4024
| global_var_name ':' enumerated_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4025
	{$$ = 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
  4026
	 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
  4027
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4028
| global_var_name ':' array_specification
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4029
	{$$ = 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
  4030
	 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
  4031
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4032
| global_var_name ':' prev_declared_structure_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4033
	{$$ = 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
  4034
	 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
  4035
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4036
| global_var_name ':' function_block_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4037
	{$$ = 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
  4038
	 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
  4039
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4040
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4041
| global_var_name simple_specification
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4042
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and simple specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4043
| global_var_name subrange_specification
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4044
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and subrange specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4045
| global_var_name enumerated_specification
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4046
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and enumerated specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4047
| global_var_name array_specification
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4048
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and array specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4049
| global_var_name prev_declared_structure_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4050
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and structured specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4051
| global_var_name function_block_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4052
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between external variable name and function block type specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4053
| global_var_name ':' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4054
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4055
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in external variable declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4056
	 else {print_err_msg(locf(@3), locl(@3), "invalid specification in external variable declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4057
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4058
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4059
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4060
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4061
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4062
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4063
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
  4064
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4065
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4066
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
  4067
  VAR_GLOBAL global_var_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4068
	{$$ = 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
  4069
| VAR_GLOBAL CONSTANT global_var_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4070
	{$$ = 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
  4071
| VAR_GLOBAL RETAIN global_var_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4072
	{$$ = new global_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  4073
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4074
| VAR_GLOBAL END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4075
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in global variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4076
| VAR_GLOBAL CONSTANT END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4077
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in constant global variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4078
| VAR_GLOBAL RETAIN END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4079
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable declared in retentive global variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4080
| VAR_GLOBAL error global_var_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4081
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_GLOBAL' in global variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4082
| VAR_GLOBAL CONSTANT error global_var_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4083
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant global variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4084
| VAR_GLOBAL RETAIN error global_var_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4085
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive global variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4086
| VAR_GLOBAL global_var_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4087
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed global variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4088
| VAR_GLOBAL CONSTANT global_var_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4089
  {$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant global variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4090
| VAR_GLOBAL RETAIN global_var_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4091
  {$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed retentive global variable(s) declaration."); yyerrok;}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  4092
| VAR_GLOBAL error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4093
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in global variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4094
| VAR_GLOBAL CONSTANT error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4095
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant global variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4096
| VAR_GLOBAL RETAIN error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4097
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unknown error in constant global variable(s) declaration."); yyerrok;}
96
23baa8821b58 Adding some basic error cheching.
mario
parents: 95
diff changeset
  4098
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4099
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4100
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4101
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4102
/* 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
  4103
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
  4104
  global_var_decl ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4105
	{$$ = 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
  4106
| 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
  4107
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4108
/* ERROR_CHECK_BEGIN */
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  4109
| error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4110
	{$$ = new global_var_decl_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid global variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4111
| global_var_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4112
	{$$ = new global_var_decl_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of global variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4113
| global_var_decl_list global_var_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4114
	{$$ = $1; print_err_msg(locl(@1), locf(@2), "';' missing at end of global variable(s) declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  4115
| global_var_decl_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4116
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid global variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4117
| global_var_decl_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4118
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after global variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4119
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4120
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4121
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4122
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4123
global_var_decl:
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4124
/* 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
  4125
  global_var_spec ':'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4126
	{$$ = new global_var_decl_c($1, NULL, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4127
*/
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4128
  global_var_spec ':' located_var_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4129
	{$$ = 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
  4130
| global_var_spec ':' function_block_type_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4131
	{$$ = new global_var_decl_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4132
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4133
| global_var_list located_var_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4134
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between global variable list and type specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4135
| global_var_name location located_var_spec_init
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4136
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between global variable specification and type specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4137
| global_var_spec function_block_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4138
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between global variable specification and function block type specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4139
| global_var_spec ':' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4140
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4141
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in global variable declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4142
	 else {print_err_msg(locf(@3), locl(@3), "invalid specification in global variable declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4143
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4144
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4145
/* ERROR_CHECK_END */
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4149
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
  4150
  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
  4151
| location
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4152
	{$$ = 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
  4153
| global_var_name location
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4154
	{$$ = 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
  4155
	 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
  4156
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4157
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4158
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
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
  4161
  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
  4162
| 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
  4163
| 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
  4164
| 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
  4165
| 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
  4166
| 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
  4167
| 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
  4168
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4169
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4170
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4171
location:
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  4172
  AT direct_variable_token
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  4173
	{$$ = 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
  4174
	 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
  4175
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4176
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4177
| AT error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4178
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4179
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no location defined in location declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4180
	 else {print_err_msg(locf(@2), locl(@2), "invalid location in global location declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4181
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4182
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4183
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4184
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4185
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4186
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4187
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4188
global_var_list:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4189
  global_var_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4190
	{$$ = 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
  4191
	 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
  4192
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4193
| 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
  4194
	{$$ = $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
  4195
	 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
  4196
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4197
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4198
| global_var_list global_var_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4199
	{$$ = new global_var_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "',' missing in global variable list."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4200
| global_var_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  4201
	{$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4202
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no variable name defined in global variable declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4203
	 else {print_err_msg(locf(@3), locl(@3), "invalid variable name in global variable declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4204
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4205
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4206
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4207
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4208
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4209
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4210
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4211
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
  4212
  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
  4213
| 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
  4214
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4215
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4216
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
  4217
  var1_list ':' single_byte_string_spec
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4218
	{$$ = new single_byte_string_var_declaration_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4219
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4220
| var1_list single_byte_string_spec
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4221
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and string type specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4222
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4223
;
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
/* 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
  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
 *       [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
  4228
 *       and
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4229
 *       [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
  4230
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4231
 *       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
  4232
 *       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
  4233
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4234
 *       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
  4235
 *        - 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
  4236
 *           -> 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
  4237
 *                                     |--> 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
  4238
 *                                     |--> 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
  4239
 *        - 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
  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
 *       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
  4242
 *        -> 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
  4243
 *        -> 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
  4244
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4245
 *       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
  4246
 *        -> 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
  4247
 *        -> 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
  4248
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4249
 *       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
  4250
 *        -> 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
  4251
 *        -> 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
  4252
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4253
 *       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
  4254
 *        -> 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
  4255
 *        -> 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
  4256
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4257
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
  4258
/*  STRING
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4259
	{$$ = 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
  4260
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4261
  STRING '[' integer ']'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4262
	{$$ = new single_byte_string_spec_c($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
  4263
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4264
| STRING ASSIGN single_byte_character_string
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4265
	{$$ = new single_byte_string_spec_c(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
  4266
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4267
| STRING '[' integer ']' ASSIGN single_byte_character_string
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4268
	{$$ = new single_byte_string_spec_c($3, $6, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4269
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4270
| STRING '[' error ']'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4271
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited string type specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4272
| STRING '[' error ']' ASSIGN single_byte_character_string
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4273
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited string type specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4274
| STRING '[' ']'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4275
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited string type specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4276
| STRING '[' ']' ASSIGN single_byte_character_string
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4277
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited string type specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4278
| STRING '[' integer error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4279
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "expecting ']' after length definition for limited string type specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4280
| STRING '[' integer ']' single_byte_character_string
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4281
	{$$ = NULL; print_err_msg(locl(@4), locf(@5), "':=' missing before limited string type initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4282
| STRING '[' integer ']' ASSIGN error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4283
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4284
	 if (is_current_syntax_token()) {print_err_msg(locl(@5), locf(@6), "no initial value defined in limited string type initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4285
	 else {print_err_msg(locf(@6), locl(@6), "invalid initial value in limited string type initialization."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4286
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4287
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4288
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4289
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4290
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4291
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4292
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
  4293
  var1_list ':' double_byte_string_spec
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4294
	{$$ = new double_byte_string_var_declaration_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4295
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4296
| var1_list double_byte_string_spec
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4297
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing between variable list and double byte string type specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4298
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4299
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4300
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4301
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
  4302
/*  WSTRING
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4303
	{$$ = new double_byte_string_spec_c(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
  4304
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4305
  WSTRING '[' integer ']'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4306
	{$$ = new double_byte_string_spec_c($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
  4307
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4308
| WSTRING ASSIGN double_byte_character_string
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4309
	{$$ = new double_byte_string_spec_c(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
  4310
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4311
| WSTRING '[' integer ']' ASSIGN double_byte_character_string
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4312
	{$$ = new double_byte_string_spec_c($3, $6, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4313
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4314
| WSTRING '[' error ']'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4315
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited double byte string type specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4316
| WSTRING '[' error ']' ASSIGN single_byte_character_string
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4317
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid length value for limited double byte string type specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4318
| WSTRING '[' ']'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4319
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited double byte string type specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4320
| WSTRING '[' ']' ASSIGN single_byte_character_string
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4321
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "missing length value for limited double byte string type specification."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4322
| WSTRING '[' integer error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4323
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "expecting ']' after length definition for limited double byte string type specification."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4324
| WSTRING '[' integer ']' single_byte_character_string
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4325
	{$$ = NULL; print_err_msg(locl(@4), locf(@5), "':=' missing before limited double byte string type initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4326
| WSTRING '[' integer ']' ASSIGN error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4327
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4328
	 if (is_current_syntax_token()) {print_err_msg(locl(@5), locf(@6), "no initial value defined double byte in limited string type initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4329
	 else {print_err_msg(locf(@6), locl(@6), "invalid initial value in limited double byte string type initialization."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4330
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4331
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4332
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4333
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4334
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4335
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4336
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4337
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
  4338
  VAR            incompl_located_var_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4339
	{$$ = 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
  4340
| VAR     RETAIN incompl_located_var_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4341
	{$$ = 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
  4342
| VAR NON_RETAIN incompl_located_var_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4343
	{$$ = new incompl_located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4344
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4345
| VAR incompl_located_var_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4346
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed incomplete located variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4347
| VAR RETAIN incompl_located_var_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4348
  {$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed incomplete retentive located variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4349
| VAR NON_RETAIN incompl_located_var_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4350
  {$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed incomplete non-retentive located variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4351
| VAR error incompl_located_var_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4352
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR' in incomplete located variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4353
| VAR RETAIN error incompl_located_var_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4354
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive located variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4355
| VAR NON_RETAIN error incompl_located_var_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4356
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive located variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4357
/* ERROR_CHECK_END */
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
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4359
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4360
/* 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
  4361
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
  4362
  incompl_located_var_decl ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4363
	{$$ = 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
  4364
| 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
  4365
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4366
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4367
| incompl_located_var_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4368
	{$$ = 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
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4369
| incompl_located_var_decl_list incompl_located_var_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4370
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of incomplete located variable declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  4371
| incompl_located_var_decl_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4372
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid incomplete located variable declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4373
| incompl_located_var_decl_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4374
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after incomplete located variable declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4375
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4376
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4377
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4378
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4379
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
  4380
  variable_name incompl_location ':' var_spec
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4381
	{$$ = new incompl_located_var_decl_c($1, $2, $4, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4382
/* ERROR_CHECK_BEGIN */
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  4383
| variable_name incompl_location var_spec
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4384
	{$$ = 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
  4385
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4386
| variable_name incompl_location ':' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4387
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4388
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no specification defined in incomplete located variable declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4389
	 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
  4390
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4391
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4392
/* ERROR_CHECK_END */
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
;
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4396
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
  4397
  AT incompl_location_token
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4398
	{$$ = 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
  4399
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4400
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4401
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4402
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
  4403
  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
  4404
| 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
  4405
| 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
  4406
| 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
  4407
| 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
  4408
| 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
  4409
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4410
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4411
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4412
/* 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
  4413
/* 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
  4414
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4415
 *       STRING
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4416
 *       and
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4417
 *       WSTRING
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4418
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4419
 *       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
  4420
 *       within a 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
  4421
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4422
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
  4423
/*  STRING
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4424
	{$$ = new single_byte_string_spec_c(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
  4425
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4426
  STRING '[' integer ']'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4427
	{$$ = new single_byte_string_spec_c($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
  4428
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4429
| WSTRING
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4430
	{$$ = new double_byte_string_spec_c(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
  4431
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4432
| WSTRING '[' integer ']'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4433
	{$$ = new double_byte_string_spec_c($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
  4434
;
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4439
/* 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
  4440
 *  - 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
  4441
 *  - 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
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4443
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
  4444
  var_init_decl ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4445
	{$$ = 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
  4446
| 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
  4447
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4448
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4449
| var_init_decl_list var_init_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4450
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of variable(s) declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  4451
| var_init_decl_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4452
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4453
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4454
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4455
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4456
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4457
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4458
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4459
/***********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4460
/* 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
  4461
/***********************/
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4462
/*
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4463
function_name:
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4464
  prev_declared_derived_function_name
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4465
| standard_function_name 
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4466
;
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4467
*/
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4468
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4469
/* 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
  4470
 * 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
  4471
 * 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
  4472
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4473
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4474
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
  4475
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
  4476
//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
  4477
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4478
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
  4479
//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
  4480
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4481
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4482
/* 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
  4483
 *       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
  4484
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4485
 *       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
  4486
 *       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
  4487
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4488
 *       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
  4489
 *       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
  4490
 *       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
  4491
 *       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
  4492
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4493
 *       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
  4494
 *       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
  4495
 *       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
  4496
 *       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
  4497
 *       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
  4498
 *       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
  4499
 *       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
  4500
 *       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
  4501
 *       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
  4502
 *       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
  4503
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4504
 * 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
  4505
 *       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
  4506
 *       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
  4507
 *       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
  4508
 *       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
  4509
 *       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
  4510
 *       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
  4511
 *       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
  4512
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4513
 * 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
  4514
 *       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
  4515
 *       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
  4516
 *
78
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  4517
 * 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
  4518
 *       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
  4519
 *       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
  4520
 *       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
  4521
 *       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
  4522
 *       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
  4523
 *       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
  4524
 *       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
  4525
 *       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
  4526
 *       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
  4527
 *       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
  4528
 *       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
  4529
 *       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
  4530
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4531
/* 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
  4532
 * 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
  4533
 * 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
  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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4536
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4537
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
  4538
  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
  4539
| 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
  4540
| 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
  4541
//| 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
  4542
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4543
*/
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
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
  4546
  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
  4547
| 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
  4548
//| 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
  4549
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4550
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4551
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
  4552
  standard_function_name_token
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4553
	{$$ = 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
  4554
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4555
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4556
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4557
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
  4558
  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
  4559
//| 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
  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
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
  4563
  NOT
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4564
	{$$ = new identifier_c(strdup("NOT"), locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4565
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4566
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4567
/* 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
  4568
 * 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
  4569
 * 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
  4570
 *   - 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
  4571
 *   - 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
  4572
 *   - 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
  4573
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4574
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4575
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
  4576
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4577
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4578
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4579
standard_function_name_expression_clashes:
91
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4580
  AND	{$$ = new identifier_c(strdup("AND"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4581
| OR	{$$ = new identifier_c(strdup("OR"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4582
| XOR	{$$ = new identifier_c(strdup("XOR"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4583
| ADD	{$$ = new identifier_c(strdup("ADD"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4584
| SUB	{$$ = new identifier_c(strdup("SUB"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4585
| MUL	{$$ = new identifier_c(strdup("MUL"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4586
| DIV	{$$ = new identifier_c(strdup("DIV"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4587
| MOD	{$$ = new identifier_c(strdup("MOD"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4588
| GT	{$$ = new identifier_c(strdup("GT"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4589
| GE	{$$ = new identifier_c(strdup("GE"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4590
| EQ	{$$ = new identifier_c(strdup("EQ"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4591
| LT	{$$ = new identifier_c(strdup("LT"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4592
| LE	{$$ = new identifier_c(strdup("LE"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4593
| NE	{$$ = new identifier_c(strdup("NE"), locloc(@$));}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4594
/*
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4595
  AND_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4596
//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
  4597
//      with a standard function name, so should be commented out!
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4598
//| AND2_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4599
| OR_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4600
| XOR_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4601
| ADD_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4602
| SUB_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4603
| MUL_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4604
| DIV_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4605
| MOD_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4606
| GT_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4607
| GE_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4608
| EQ_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4609
| LT_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4610
| LE_operator	{$$ = il_operator_c_2_identifier_c($1);}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4611
| NE_operator	{$$ = il_operator_c_2_identifier_c($1);}
91
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  4612
*/
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4613
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4614
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4615
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4616
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
  4617
  identifier
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4618
| prev_declared_derived_function_name
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4619
	{$$ = $1;
77
fe4ecf7efa79 adding some comments.
mario
parents: 75
diff changeset
  4620
	 if (not(allow_function_overloading)) {
fe4ecf7efa79 adding some comments.
mario
parents: 75
diff changeset
  4621
	   fprintf(stderr, "Function overloading not allowed. Invalid identifier %s\n", ((token_c *)($1))->value);
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4622
	   ERROR;
77
fe4ecf7efa79 adding some comments.
mario
parents: 75
diff changeset
  4623
	 }
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4624
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4625
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4626
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4627
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4628
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
  4629
/*  FUNCTION derived_function_name ':' elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4630
  function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4631
	{$$ = new function_declaration_c($1, $3, $4, $5, locloc(@$));
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4632
	 variable_name_symtable.pop();
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  4633
	 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
  4634
	 if (allow_function_overloading) {
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4635
	   switch (library_element_symtable.find_value($1)) {
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4636
	     case prev_declared_derived_function_name_token:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4637
	       /* do nothing, already in map. */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4638
	       break;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4639
	     case BOGUS_TOKEN_ID:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4640
	       /* Not yet in map. Must insert...*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4641
	       library_element_symtable.insert($1, prev_declared_derived_function_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4642
	       break;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4643
	     default:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4644
	       /* Already in map but associated with something else other than a funtion name! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4645
	       ERROR;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4646
	   }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4647
	 } else {
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4648
	   library_element_symtable.insert($1, prev_declared_derived_function_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4649
	 }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4650
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4651
/* | 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
  4652
| function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4653
	{$$ = new function_declaration_c($1, $3, $4, $5, locloc(@$));
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4654
	 variable_name_symtable.pop();
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  4655
	 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
  4656
	 if (allow_function_overloading) {
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4657
	   switch (library_element_symtable.find_value($1)) {
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4658
	     case prev_declared_derived_function_name_token: /* do nothing, already in map. */ break;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4659
	     case BOGUS_TOKEN_ID: library_element_symtable.insert($1, prev_declared_derived_function_name_token); break;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4660
	     default: ERROR;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4661
	   }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4662
	 } else {
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4663
	   library_element_symtable.insert($1, prev_declared_derived_function_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4664
	 }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4665
	}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4666
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4667
| function_name_declaration elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4668
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after function name in function declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4669
| function_name_declaration derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4670
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after function name in function declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4671
| function_name_declaration ':' io_OR_function_var_declarations_list function_body END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4672
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no return type defined in function declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4673
| function_name_declaration ':' error io_OR_function_var_declarations_list function_body END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4674
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid return type defined in function declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4675
| function_name_declaration ':' elementary_type_name function_body END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4676
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared in function declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4677
| function_name_declaration ':' derived_type_name function_body END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4678
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared in function declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4679
| function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4680
	{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no body defined in function declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4681
| function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4682
	{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no body defined in function declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4683
| function_name_declaration ':' elementary_type_name END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4684
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared and body defined in function declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4685
| function_name_declaration ':' derived_type_name END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4686
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no variable(s) declared and body defined in function declaration."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4687
| function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list function_body END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4688
	{$$ = NULL; print_err_msg(locf(@1), locf(@3), "unclosed function declaration."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4689
| function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list function_body END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4690
	{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed function declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4691
| function_name_declaration error END_FUNCTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4692
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in function declaration."); yyerrok;}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4693
/* ERROR_CHECK_END */
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4694
;
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4695
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4696
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4697
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4698
/* 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
  4699
/* 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
  4700
 *       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
  4701
 *       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
  4702
 *       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
  4703
 *       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
  4704
 *       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
  4705
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4706
 *       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
  4707
 *       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
  4708
 *       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
  4709
 *       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
  4710
 *       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
  4711
 *       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
  4712
 *       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
  4713
 *       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
  4714
 *       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
  4715
 *       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
  4716
 *       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
  4717
 *       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
  4718
 *       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
  4719
 *       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
  4720
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4721
 *       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
  4722
 *       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
  4723
 *       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
  4724
 *       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
  4725
 *       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
  4726
 *       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
  4727
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4728
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
  4729
  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
  4730
	{$$ = $2;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4731
	 /* 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
  4732
	  * 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
  4733
	  *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4734
	  * 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
  4735
	  * 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
  4736
	  * 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
  4737
	  */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4738
	 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
  4739
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4740
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4741
| FUNCTION error 
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4742
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4743
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no function name defined in function declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4744
	 else {print_err_msg(locf(@2), locl(@2), "invalid function name in function declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4745
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4746
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4747
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4748
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4749
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4750
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4751
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4752
/* 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
  4753
io_OR_function_var_declarations_list:
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4754
  io_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4755
  {$$ = new var_declarations_list_c(locloc(@1));$$->add_element($1);}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4756
| function_var_decls
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4757
	{$$ = 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
  4758
| 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
  4759
	{$$ = $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
  4760
| 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
  4761
	{$$ = $1; $$->add_element($2);}
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  4762
/* ERROR_CHECK_BEGIN */
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  4763
| io_OR_function_var_declarations_list retentive_var_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4764
	{$$ = $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
  4765
| io_OR_function_var_declarations_list located_var_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4766
	{$$ = $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
  4767
| io_OR_function_var_declarations_list external_var_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4768
	{$$ = $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
  4769
| io_OR_function_var_declarations_list global_var_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4770
	{$$ = $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
  4771
| io_OR_function_var_declarations_list incompl_located_var_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4772
	{$$ = $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
  4773
| io_OR_function_var_declarations_list temp_var_decls
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4774
	{$$ = $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
  4775
| io_OR_function_var_declarations_list non_retentive_var_decls
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4776
	{$$ = $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
  4777
/*| io_OR_function_var_declarations_list access_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4778
	{$$ = $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
  4779
| io_OR_function_var_declarations_list instance_specific_initializations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4780
	{$$ = $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
  4781
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4782
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4783
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4784
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4785
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
  4786
  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
  4787
| 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
  4788
| 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
  4789
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4790
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4791
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4792
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
  4793
  VAR CONSTANT var2_init_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4794
	{$$ = 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
  4795
| VAR var2_init_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4796
	{$$ = new function_var_decls_c(NULL, $2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4797
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4798
| VAR error var2_init_decl_list END_VAR
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4799
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR' in function variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4800
| VAR CONSTANT error var2_init_decl_list END_VAR
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4801
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'CONSTANT' in constant function variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4802
| VAR var2_init_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4803
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed function variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4804
| VAR CONSTANT var2_init_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4805
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed constant function variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4806
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4807
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4808
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4809
/* 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
  4810
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
  4811
  var2_init_decl ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4812
	{$$ = 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
  4813
| 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
  4814
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4815
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4816
| var2_init_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4817
	{$$ = new var2_init_decl_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of function variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4818
| var2_init_decl_list var2_init_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4819
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of function variable(s) declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  4820
| var2_init_decl_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4821
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid function variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4822
| var2_init_decl_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4823
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after function variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4824
/* ERROR_CHECK_END */
0
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
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
  4829
  statement_list	{$$ = $1;} /* if we leave it for the default action we get a type clash! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4830
| instruction_list	{$$ = $1;} /* if we leave it for the default action we get a type clash! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4831
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4832
| 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
  4833
| 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
  4834
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4835
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4836
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4837
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4838
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
  4839
  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
  4840
| 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
  4841
| 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
  4842
| 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
  4843
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4844
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4845
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4846
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4847
/*****************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4848
/* 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
  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
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
  4851
  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
  4852
| 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
  4853
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4854
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4855
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4856
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
  4857
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4858
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
  4859
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
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
  4862
  FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4863
	{$$ = 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
  4864
	 library_element_symtable.insert($2, prev_declared_derived_function_block_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4865
	 /* Clear the variable_name_symtable. Since
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4866
	  * we have finished parsing the function block,
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4867
	  * the variable names are now out of scope, so
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4868
	  * are no longer valid!
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4869
	  */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4870
	 variable_name_symtable.pop();
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  4871
	 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
  4872
	}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4873
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4874
| FUNCTION_BLOCK io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4875
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in function block declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4876
| FUNCTION_BLOCK error io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4877
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name in function block declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4878
| FUNCTION_BLOCK derived_function_block_name function_block_body END_FUNCTION_BLOCK
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4879
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared in function declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4880
| FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list END_FUNCTION_BLOCK
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4881
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no body defined in function block declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4882
| FUNCTION_BLOCK derived_function_block_name END_FUNCTION_BLOCK
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4883
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared and body defined in function block declaration."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4884
| FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list function_block_body END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4885
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "no variable(s) declared and body defined in function block declaration."); yynerrs++;}	
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4886
| FUNCTION_BLOCK error END_FUNCTION_BLOCK
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4887
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in function block declaration."); yyerrok;}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4888
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4889
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4890
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4891
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4892
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4893
/* 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
  4894
/*  { 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
  4895
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4896
 * 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
  4897
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4898
io_OR_other_var_declarations_list:
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4899
  io_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4900
  {$$ = new var_declarations_list_c(locloc(@$));$$->add_element($1);}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4901
| other_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4902
  {$$ = 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
  4903
| 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
  4904
	{$$ = $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
  4905
| 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
  4906
	{$$ = $1; $$->add_element($2);}
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  4907
/* ERROR_CHECK_BEGIN */
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  4908
| io_OR_other_var_declarations_list located_var_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4909
	{$$ = $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
  4910
| io_OR_other_var_declarations_list global_var_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4911
	{$$ = $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
  4912
/*| io_OR_other_var_declarations_list access_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4913
	{$$ = $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
  4914
| io_OR_other_var_declarations_list instance_specific_initializations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4915
	{$$ = $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
  4916
/* ERROR_CHECK_END */
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4919
/* NOTE:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4920
 *  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
  4921
 *  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
  4922
 *     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
  4923
 *   | 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
  4924
 *   | 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
  4925
 *   | 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
  4926
 *   | 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
  4927
 *   | 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
  4928
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4929
 *  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
  4930
 *  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
  4931
 *  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
  4932
 *  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
  4933
 *  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
  4934
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4935
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
  4936
  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
  4937
| 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
  4938
| 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
  4939
| 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
  4940
| 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
  4941
| 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
  4942
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4943
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4944
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4945
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
  4946
  VAR_TEMP temp_var_decls_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4947
	{$$ = new temp_var_decls_c($2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4948
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4949
| VAR_TEMP END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4950
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in temporary variable(s) declaration."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4951
| VAR_TEMP temp_var_decls_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4952
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "unclosed temporary variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4953
| VAR_TEMP error temp_var_decls_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4954
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_TEMP' in function variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4955
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4956
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4957
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4958
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4959
/* 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
  4960
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
  4961
  temp_var_decl ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4962
	{$$ = 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
  4963
| 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
  4964
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4965
/* ERROR_CHECK_BEGIN */
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  4966
| error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4967
	{$$ = new temp_var_decls_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid temporary variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4968
| temp_var_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4969
	{$$ = new temp_var_decls_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at end of temporary variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4970
| temp_var_decls_list temp_var_decl error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4971
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of temporary variable(s) declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  4972
| temp_var_decls_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4973
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid temporary variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4974
| temp_var_decls_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4975
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after temporary variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4976
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4977
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4978
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4979
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4980
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
  4981
  VAR NON_RETAIN var_init_decl_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  4982
	{$$ = new non_retentive_var_decls_c($3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4983
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4984
| VAR NON_RETAIN var_init_decl_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4985
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unclosed non-retentive temporary variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4986
| VAR NON_RETAIN error var_init_decl_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  4987
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive temporary variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  4988
/* ERROR_CHECK_END */
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
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4990
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4991
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4992
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4993
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
  4994
  statement_list	{$$ = $1;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4995
| instruction_list	{$$ = $1;}
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  4996
| 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
  4997
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  4998
| 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
  4999
| 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
  5000
| <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
  5001
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5002
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5003
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5004
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5005
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5006
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5007
/**********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5008
/* 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
  5009
/**********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5010
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
  5011
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5012
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5013
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
  5014
  PROGRAM program_type_name program_var_declarations_list function_block_body END_PROGRAM
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5015
	{$$ = new program_declaration_c($2, $3, $4, locloc(@$));
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5016
	 library_element_symtable.insert($2, prev_declared_program_type_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5017
	 /* Clear the variable_name_symtable. Since
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5018
	  * we have finished parsing the program declaration,
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5019
	  * the variable names are now out of scope, so
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5020
	  * are no longer valid!
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5021
	  */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5022
	 variable_name_symtable.pop();
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5023
	 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
  5024
	}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5025
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5026
| PROGRAM program_var_declarations_list function_block_body END_PROGRAM
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5027
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no program name defined in program declaration.");}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5028
| PROGRAM error program_var_declarations_list function_block_body END_PROGRAM
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5029
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid program name in program declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5030
| PROGRAM program_type_name function_block_body END_PROGRAM
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5031
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared in program declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5032
| PROGRAM program_type_name program_var_declarations_list END_PROGRAM
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5033
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no body defined in program declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5034
| PROGRAM program_type_name END_PROGRAM
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5035
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared and body defined in program declaration."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5036
| PROGRAM program_type_name program_var_declarations_list function_block_body END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5037
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed program declaration."); yynerrs++;}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5038
| PROGRAM error END_PROGRAM
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5039
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in program declaration."); yyerrok;}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5040
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5041
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5042
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5043
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5044
/* 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
  5045
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5046
 * 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
  5047
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5048
program_var_declarations_list:
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5049
  io_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5050
	{$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5051
| other_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5052
	{$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5053
| located_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5054
	{$$ = 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
  5055
| 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
  5056
	{$$ = $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
  5057
| 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
  5058
	{$$ = $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
  5059
| 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
  5060
	{$$ = $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
  5061
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5062
| 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
  5063
	{$$ = $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
  5064
*/
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  5065
/* ERROR_CHECK_BEGIN */
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  5066
| program_var_declarations_list global_var_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5067
	{$$ = $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
  5068
/*| program_var_declarations_list access_declarations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5069
	{$$ = $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
  5070
| program_var_declarations_list instance_specific_initializations
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5071
	{$$ = $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
  5072
	}
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  5073
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5074
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5075
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5076
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5077
/* TODO ... */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5078
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5079
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
  5080
  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
  5081
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5082
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5083
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5084
/* 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
  5085
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5086
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
  5087
  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
  5088
| 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
  5089
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5090
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5091
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5092
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5093
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
  5094
  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
  5095
| 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
  5096
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5097
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5098
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5099
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5100
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5101
/********************************************/
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5102
/* B 1.6 Sequential Function Chart elements *
3
38850ee685e6 ST and IL parsing added into flex-bison analyser
lbessard
parents: 1
diff changeset
  5103
/********************************************/
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5104
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5105
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
  5106
  sfc_network
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5107
	{$$ = 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
  5108
| sequential_function_chart sfc_network
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5109
	{$$ = $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
  5110
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5111
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5112
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
  5113
  initial_step
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5114
	{$$ = 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
  5115
| sfc_network step
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5116
	{$$ = $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
  5117
| sfc_network transition
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5118
	{$$ = $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
  5119
| sfc_network action
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5120
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5121
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5122
| sfc_network error 
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5123
	{$$ = $1; print_err_msg(locl(@1), locf(@2), "unexpected token after SFC network in sequencial function chart."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5124
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5125
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5126
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5127
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
  5128
  INITIAL_STEP step_name ':' action_association_list END_STEP
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5129
//  INITIAL_STEP identifier ':' action_association_list END_STEP
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5130
	{$$ = new initial_step_c($2, $4, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5131
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5132
| INITIAL_STEP ':' action_association_list END_STEP
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5133
  {$$ = NULL; print_err_msg(locf(@1), locl(@2), "no step name defined in initial step declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5134
| INITIAL_STEP error ':' action_association_list END_STEP
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5135
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid step name defined in initial step declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5136
| INITIAL_STEP step_name action_association_list END_STEP
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5137
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':' missing after step name in initial step declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5138
| INITIAL_STEP step_name ':' error END_STEP
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5139
	{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid action association list in initial step declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5140
| INITIAL_STEP step_name ':' action_association_list END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5141
	{$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed initial step declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5142
| INITIAL_STEP error END_STEP
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5143
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in initial step declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5144
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5145
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5146
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5147
step:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5148
  STEP step_name ':' action_association_list END_STEP
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5149
//  STEP identifier ':' action_association_list END_STEP
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5150
	{$$ = new step_c($2, $4, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5151
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5152
| STEP ':' action_association_list END_STEP
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5153
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no step name defined in step declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5154
| STEP error ':' action_association_list END_STEP
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5155
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid step name defined in step declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5156
| STEP step_name action_association_list END_STEP
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5157
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "':' missing after step name in step declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5158
| STEP step_name ':' error END_STEP
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5159
	{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid action association list in step declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5160
| STEP step_name ':' action_association_list END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5161
	{$$ = NULL; print_err_msg(locf(@1), locl(@3), "invalid action association list in step declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5162
| STEP error END_STEP
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5163
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in step declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
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
/* 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
  5168
 *  - 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
  5169
 *  - step
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5170
 */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5171
action_association_list:
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5172
  /* empty */
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5173
	{$$ = 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
  5174
| action_association_list action_association ';'
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5175
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5176
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5177
| action_association_list action_association error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5178
	{$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at end of action association declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5179
| action_association_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5180
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after action association declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5181
/* ERROR_CHECK_END */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5182
;
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5183
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5184
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5185
// step_name: identifier;
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5186
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
  5187
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5188
action_association:
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5189
  action_name '(' {cmd_goto_sfc_qualifier_state()} action_qualifier {cmd_pop_state()} indicator_name_list ')'
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5190
	{$$ = new action_association_c($1, $4, $6, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5191
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5192
/*| action_name '(' error ')'
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5193
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid qualifier defined in action association."); yyerrok;}*/
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5194
/* ERROR_CHECK_END */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5195
;
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5196
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5197
/* 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
  5198
indicator_name_list:
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5199
  /* empty */
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5200
	{$$ = 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
  5201
| indicator_name_list ',' indicator_name
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5202
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5203
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5204
| indicator_name_list indicator_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5205
	{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing at end of action association declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5206
| indicator_name_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  5207
	{$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5208
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no indicator defined in indicator list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5209
	 else {print_err_msg(locf(@3), locl(@3), "invalid indicator in indicator list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5210
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5211
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5212
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5213
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5214
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5215
// action_name: identifier;
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5216
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
  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
action_qualifier:
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5219
  /* empty */
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5220
	{$$ = NULL;}
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5221
| qualifier
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5222
	{$$ = 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
  5223
| timed_qualifier ',' action_time
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5224
	{$$ = new action_qualifier_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5225
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5226
| timed_qualifier action_time
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5227
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "',' missing between timed qualifier and action time in action qualifier."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5228
| timed_qualifier ',' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5229
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5230
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no action time defined in action qualifier.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5231
	 else {print_err_msg(locf(@3), locl(@3), "invalid action time in action qualifier."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5232
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5233
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5234
/* ERROR_CHECK_END */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5235
;
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5236
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5237
qualifier:
94
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  5238
  N		{$$ = new qualifier_c(strdup("N"), locloc(@$));}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5239
| R		{$$ = new qualifier_c(strdup("R"), locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5240
| S		{$$ = new qualifier_c(strdup("S"), locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5241
| P		{$$ = new qualifier_c(strdup("P"), locloc(@$));}
0
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
timed_qualifier:
94
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  5245
  L		{$$ = new timed_qualifier_c(strdup("L"), locloc(@$));}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5246
| D		{$$ = new timed_qualifier_c(strdup("D"), locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5247
| SD		{$$ = new timed_qualifier_c(strdup("SD"), locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5248
| DS		{$$ = new timed_qualifier_c(strdup("DS"), locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5249
| 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
  5250
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5251
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5252
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
  5253
  duration
10
66f4f7f85d0a generate_iec completed
lbessard
parents: 5
diff changeset
  5254
| variable
66f4f7f85d0a generate_iec completed
lbessard
parents: 5
diff changeset
  5255
;
66f4f7f85d0a generate_iec completed
lbessard
parents: 5
diff changeset
  5256
66f4f7f85d0a generate_iec completed
lbessard
parents: 5
diff changeset
  5257
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
  5258
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5259
// transition_name: identifier;
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5260
transition_name: any_identifier;
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5261
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5262
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5263
steps:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5264
  step_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5265
	{$$ = 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
  5266
| '(' step_name_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5267
	{$$ = new steps_c(NULL, $2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5268
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5269
| '(' step_name_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5270
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "expecting ')' at the end of step list in transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5271
| '(' error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5272
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid step list in transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5273
/* ERROR_CHECK_END */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5274
;
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5275
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5276
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
  5277
  step_name ',' step_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5278
	{$$ = 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
  5279
| step_name_list ',' step_name
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5280
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5281
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5282
| step_name_list step_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5283
	{$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in step list."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5284
| step_name_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  5285
	{$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5286
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no step name defined in step list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5287
	 else {print_err_msg(locf(@3), locl(@3), "invalid step name in step list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5288
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5289
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5290
/* ERROR_CHECK_END */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5291
;
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5292
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5293
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5294
/* NOTE: flex will automatically pop() out of body_state to previous state.
94
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  5295
 *       We do not need to give a command from bison to return to previous flex state,
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  5296
 *       after forcing flex to go to body_state.
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5297
 */
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5298
transition:
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5299
  TRANSITION transition_priority
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5300
    FROM steps TO steps 
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5301
    {cmd_goto_body_state();} transition_condition 
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5302
  END_TRANSITION 
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5303
	{$$ = new transition_c(NULL, $2, $4, $6, $8, locloc(@$));}
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5304
//| TRANSITION identifier FROM steps TO steps ... 
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5305
| TRANSITION transition_name transition_priority
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5306
    FROM steps TO steps 
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5307
    {cmd_goto_body_state();} transition_condition 
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5308
  END_TRANSITION 
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5309
	{$$ = new transition_c($2, $3, $5, $7, $9, locloc(@$));}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5310
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5311
| TRANSITION error transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5312
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid transition name defined in transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5313
| TRANSITION transition_name error FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5314
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid transition priority defined in transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5315
| TRANSITION transition_priority FROM TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5316
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "no origin step(s) defined in transition declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5317
| TRANSITION transition_name transition_priority FROM TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5318
	{$$ = NULL; print_err_msg(locl(@4), locf(@5), "no origin step(s) defined in transition declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5319
| TRANSITION transition_priority FROM error TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5320
	{$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid origin step(s) defined in transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5321
| TRANSITION transition_name transition_priority FROM error TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5322
	{$$ = NULL; print_err_msg(locf(@5), locl(@5), "invalid origin step(s) defined in transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5323
| TRANSITION transition_priority FROM steps steps {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5324
	{$$ = NULL; print_err_msg(locl(@4), locf(@5), "'TO' missing between origin step(s) and destination step(s) in transition declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5325
| TRANSITION transition_name transition_priority FROM steps steps {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5326
	{$$ = NULL; print_err_msg(locl(@5), locf(@6), "'TO' missing between origin step(s) and destination step(s) in transition declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5327
| TRANSITION transition_priority FROM steps TO {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5328
	{$$ = NULL; print_err_msg(locl(@5), locf(@7), "no destination step(s) defined in transition declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5329
| TRANSITION transition_name transition_priority FROM steps TO {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5330
	{$$ = NULL; print_err_msg(locl(@6), locf(@8), "no destination step(s) defined in transition declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5331
| TRANSITION transition_priority FROM steps TO error {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5332
	{$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid destination step(s) defined in transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5333
| TRANSITION transition_name transition_priority FROM steps TO error {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5334
	{$$ = NULL; print_err_msg(locf(@7), locl(@7), "invalid destination step(s) defined in transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5335
| TRANSITION transition_priority {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5336
	{$$ = NULL; print_err_msg(locl(@2), locf(@4), "no origin and destination step(s) defined in transition declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5337
| TRANSITION transition_name transition_priority {cmd_goto_body_state();} transition_condition END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5338
	{$$ = NULL; print_err_msg(locl(@3), locf(@5), "no origin and destination step(s) defined in transition declaration."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5339
/*| TRANSITION transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5340
  {$$ = NULL; print_err_msg(locf(@1), locl(@6), "unclosed transition declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5341
| TRANSITION transition_name transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5342
  {$$ = NULL; print_err_msg(locf(@1), locl(@7), "unclosed transition declaration."); yyerrok;}*/
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5343
| TRANSITION error END_TRANSITION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5344
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5345
/* ERROR_CHECK_END */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5346
;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5347
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5348
transition_priority:
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5349
  /* empty */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5350
  {$$ = NULL;}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5351
| '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')'
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5352
	{$$ = $6;}
142
120772c527f3 Bug while wearching errors in transition with priority fixed
lbessard
parents: 136
diff changeset
  5353
/* ERROR_CHECK_BEGIN 
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  5354
| '(' ASSIGN integer ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5355
	{$$ = 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
  5356
| '(' error ASSIGN integer ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5357
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "expecting 'PRIORITY' between '(' and ':=' in transition declaration with priority."); yyerrok;}
142
120772c527f3 Bug while wearching errors in transition with priority fixed
lbessard
parents: 136
diff changeset
  5358
 ERROR_CHECK_END */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5359
;
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5360
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5361
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5362
transition_condition:
10
66f4f7f85d0a generate_iec completed
lbessard
parents: 5
diff changeset
  5363
  ':' eol_list simple_instr_list
88
dab799d3d4a6 Adding location data to new transition_condition_c.
mario
parents: 87
diff changeset
  5364
	{$$ = new transition_condition_c($3, NULL, locloc(@$));}
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5365
| ASSIGN expression ';'
88
dab799d3d4a6 Adding location data to new transition_condition_c.
mario
parents: 87
diff changeset
  5366
	{$$ = new transition_condition_c(NULL, $2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5367
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5368
| eol_list simple_instr_list
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5369
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing before IL condition in transition declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5370
| ':' eol_list error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5371
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5372
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no instructions defined in IL condition of transition declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5373
	 else {print_err_msg(locf(@3), locl(@3), "invalid instructions in IL condition of transition declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5374
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5375
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5376
| ASSIGN ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5377
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no expression defined in ST condition of transition declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5378
| ASSIGN error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5379
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid expression defined in ST condition of transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5380
| ASSIGN expression error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5381
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "expecting ';' after expression defined in ST condition of transition declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5382
/* ERROR_CHECK_END */
10
66f4f7f85d0a generate_iec completed
lbessard
parents: 5
diff changeset
  5383
;
3
38850ee685e6 ST and IL parsing added into flex-bison analyser
lbessard
parents: 1
diff changeset
  5384
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5385
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5386
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5387
action:
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5388
//  ACTION identifier ':' ... 
151
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5389
  ACTION action_name {cmd_goto_body_state();} action_body END_ACTION
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5390
	{$$ = new action_c($2, $4, locloc(@$));}
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5391
/* ERROR_CHECK_BEGIN */
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5392
| ACTION {cmd_goto_body_state();} action_body END_ACTION
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5393
  {$$ = NULL; print_err_msg(locl(@1), locf(@3), "no action name defined in action declaration."); yynerrs++;}
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5394
| ACTION error {cmd_goto_body_state();} action_body END_ACTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5395
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid action name defined in action declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5396
| ACTION action_name {cmd_goto_body_state();} function_block_body END_ACTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5397
	{$$ = NULL; print_err_msg(locl(@2), locf(@4), "':' missing after action name in action declaration."); yynerrs++;}
151
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5398
/*| ACTION action_name {cmd_goto_body_state();} action_body END_OF_INPUT
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5399
	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed action declaration."); yyerrok;}*/
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5400
| ACTION error END_ACTION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5401
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in action declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5402
/* ERROR_CHECK_END */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5403
;
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
  5404
151
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5405
action_body:
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5406
  ':' function_block_body
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5407
  {$$ = $2;}
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5408
/* ERROR_CHECK_BEGIN */
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5409
| ':' error
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5410
	{$$ = NULL;
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5411
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no body defined in action declaration.");}
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5412
	 else {print_err_msg(locf(@2), locl(@2), "invalid body defined in action declaration."); yyclearin;}
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5413
	 yyerrok;
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5414
	}
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5415
/* ERROR_CHECK_END */
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5416
;
3b898fb11e73 Bug on language selection in SFC Action fixed
lbessard
parents: 147
diff changeset
  5417
0
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
/* 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
  5421
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5422
/* NOTE:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5423
 * 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
  5424
 * 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
  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
 * 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
  5427
 * 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
  5428
 * 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
  5429
 * 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
  5430
 * 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
  5431
 * 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
  5432
 * 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
  5433
 * 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
  5434
 * 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
  5435
 *   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
  5436
 * 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
  5437
 * 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
  5438
 * 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
  5439
 * 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
  5440
 * 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
  5441
 * 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
  5442
 * 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
  5443
 * 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
  5444
 * the resource names that need to be distinguished into a 
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5445
 * 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
  5446
 * 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
  5447
 * 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
  5448
 * 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
  5449
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5450
 * 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
  5451
 * 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
  5452
 * 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
  5453
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5454
 * 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
  5455
 * 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
  5456
 */
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5457
prev_declared_global_var_name: prev_declared_global_var_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5458
prev_declared_resource_name: prev_declared_resource_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5459
prev_declared_program_name: prev_declared_program_name_token {$$ = new identifier_c($1, locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5460
// 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
  5461
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5462
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5463
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5464
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5465
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5466
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5467
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
  5468
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5469
/* 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
  5470
 *       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
  5471
 *       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
  5472
 *       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
  5473
 *       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
  5474
 *       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
  5475
 *       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
  5476
 *       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
  5477
 *       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
  5478
 *       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
  5479
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5480
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5481
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
  5482
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5483
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
  5484
  CONFIGURATION 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
  5485
   optional_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
  5486
   single_resource_declaration
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5487
   {variable_name_symtable.pop();
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5488
    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
  5489
   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
  5490
   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
  5491
  END_CONFIGURATION
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5492
	{$$ = 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
  5493
	 library_element_symtable.insert($2, prev_declared_configuration_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5494
	 variable_name_symtable.pop();
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5495
	 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
  5496
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5497
| CONFIGURATION 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
  5498
   optional_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
  5499
   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
  5500
   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
  5501
   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
  5502
 END_CONFIGURATION
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5503
	{$$ = 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
  5504
	 library_element_symtable.insert($2, prev_declared_configuration_name_token);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5505
	 variable_name_symtable.pop();
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5506
	 direct_variable_symtable.pop();
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  5507
}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5508
/* ERROR_CHECK_BEGIN */
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5509
| CONFIGURATION 
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5510
   optional_global_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5511
   single_resource_declaration
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5512
   {variable_name_symtable.pop();
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5513
    direct_variable_symtable.pop();}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5514
   optional_access_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5515
   optional_instance_specific_initializations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5516
  END_CONFIGURATION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5517
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no configuration name defined in configuration declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5518
| CONFIGURATION
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5519
   optional_global_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5520
   resource_declaration_list
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5521
   optional_access_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5522
   optional_instance_specific_initializations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5523
  END_CONFIGURATION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5524
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no configuration name defined in configuration declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5525
| CONFIGURATION error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5526
   optional_global_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5527
   single_resource_declaration
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5528
   {variable_name_symtable.pop();
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5529
    direct_variable_symtable.pop();}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5530
   optional_access_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5531
   optional_instance_specific_initializations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5532
  END_CONFIGURATION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5533
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid configuration name defined in configuration declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5534
| CONFIGURATION error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5535
   optional_global_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5536
   resource_declaration_list
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5537
   optional_access_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5538
   optional_instance_specific_initializations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5539
  END_CONFIGURATION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5540
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid configuration name defined in configuration declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5541
| CONFIGURATION configuration_name
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5542
   optional_global_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5543
   optional_access_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5544
   optional_instance_specific_initializations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5545
  END_CONFIGURATION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5546
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "no resource(s) defined in configuration declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5547
| CONFIGURATION configuration_name
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5548
   optional_global_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5549
   error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5550
   optional_access_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5551
   optional_instance_specific_initializations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5552
  END_CONFIGURATION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5553
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid resource(s) defined in configuration declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5554
/*| CONFIGURATION configuration_name
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5555
   optional_global_var_declarations
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5556
   single_resource_declaration
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5557
   {variable_name_symtable.pop();
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5558
    direct_variable_symtable.pop();}
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5559
   optional_access_declarations
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5560
   optional_instance_specific_initializations
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5561
  END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5562
  {$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed configuration declaration."); yyerrok;}*/
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5563
| CONFIGURATION configuration_name
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5564
   optional_global_var_declarations
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5565
   resource_declaration_list
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5566
   optional_access_declarations
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5567
   optional_instance_specific_initializations
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5568
  END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5569
  {$$ = 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
  5570
| CONFIGURATION error END_CONFIGURATION
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5571
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in configuration declaration."); yyerrok;}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5572
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5573
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5574
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5575
// 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
  5576
//  - 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
  5577
//  - 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
  5578
//
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5579
optional_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
  5580
  // empty
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5581
	{$$ = NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5582
| 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
  5583
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5584
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5585
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5586
// 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
  5587
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
  5588
  // empty
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5589
	{$$ = NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5590
//| 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
  5591
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5592
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5593
// 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
  5594
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
  5595
  // empty
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5596
	{$$ = NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5597
| 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
  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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5600
// 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
  5601
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
  5602
  resource_declaration
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5603
	{$$ = 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
  5604
| 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
  5605
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5606
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5607
| resource_declaration_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5608
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected token after resource declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5609
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5610
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5611
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5612
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5613
resource_declaration:
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5614
  RESOURCE {variable_name_symtable.push();direct_variable_symtable.push();} resource_name ON resource_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
  5615
   optional_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
  5616
   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
  5617
  END_RESOURCE
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5618
	{$$ = new resource_declaration_c($3, $5, $6, $7, locloc(@$));
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  5619
	 variable_name_symtable.pop();
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5620
	 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
  5621
	 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
  5622
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5623
/* ERROR_CHECK_BEGIN */
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5624
| RESOURCE {variable_name_symtable.push();direct_variable_symtable.push();} ON resource_type_name
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5625
   optional_global_var_declarations
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5626
   single_resource_declaration
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5627
  END_RESOURCE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5628
  {$$ = 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
  5629
/*|	RESOURCE {variable_name_symtable.push();direct_variable_symtable.push();} resource_name ON resource_type_name
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5630
   optional_global_var_declarations
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5631
   single_resource_declaration
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5632
  END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5633
	{$$ = NULL; print_err_msg(locf(@1), locl(@5), "unclosed resource declaration."); yyerrok;}*/
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5634
| RESOURCE error END_RESOURCE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5635
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in resource declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5636
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5637
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5638
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5639
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5640
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
  5641
 task_configuration_list program_configuration_list
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5642
	{$$ = 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
  5643
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5644
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
// 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
  5647
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
  5648
  // empty
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5649
	{$$ = 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
  5650
| 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
  5651
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5652
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5653
| task_configuration_list task_configuration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5654
  {$$ = $1; print_err_msg(locl(@1), locf(@2), "';' missing at the end of task configuration in resource declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5655
| task_configuration_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5656
  {$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after task configuration in resource declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5657
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5658
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5659
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5660
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5661
// 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
  5662
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
  5663
  program_configuration ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5664
	{$$ = 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
  5665
| 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
  5666
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5667
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5668
| program_configuration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5669
  {$$ = 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
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5670
| program_configuration_list program_configuration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5671
  {$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at the end of program configuration in resource declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  5672
| program_configuration_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5673
  {$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid program configuration in resource declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5674
| program_configuration_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5675
  {$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after program configuration in resource declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5676
/* ERROR_CHECK_END */
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5679
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5680
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
  5681
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5682
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5683
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
  5684
 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
  5685
	{$$ = NULL;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5686
// ERROR_CHECK_BEGIN //
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5687
| VAR_ACCESS END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5688
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in access variable(s) declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5689
| VAR_ACCESS error access_declaration_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5690
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_ACCESS' in access variable(s) declaration."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5691
| VAR_ACCESS access_declaration_list error END_VAR
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5692
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed access variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5693
| VAR_ACCESS error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5694
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in access variable(s) declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5695
// ERROR_CHECK_END //
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5696
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5697
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5698
// 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
  5699
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
  5700
  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
  5701
| access_declaration_list access_declaration ';'
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5702
// ERROR_CHECK_BEGIN //
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  5703
| error ';'
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  5704
  {$$ = // create a new list //;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5705
	 print_err_msg(locf(@1), locl(@1), "invalid access variable declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5706
| access_declaration error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  5707
  {$$ = // create a new list //;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5708
	 print_err_msg(locl(@1), locf(@2), "';' missing at the end of access variable declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5709
| access_declaration_list access_declaration error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5710
  {$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at the end of access variable declaration."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  5711
| access_declaration_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5712
  {$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid access variable declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5713
| access_declaration_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5714
  {$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after access variable declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5715
// ERROR_CHECK_END //
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5716
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5717
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5718
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5719
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
  5720
  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
  5721
| 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
  5722
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5723
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5724
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5725
access_path:
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5726
  prev_declared_direct_variable
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5727
| 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
  5728
| any_fb_name_list symbolic_variable
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5729
| prev_declared_resource_name '.' any_fb_name_list symbolic_variable
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5730
| prev_declared_program_name '.'  any_fb_name_list symbolic_variable
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5731
| 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
  5732
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5733
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5734
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5735
// 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
  5736
//  - 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
  5737
//  - 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
  5738
//
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5739
/* 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
  5740
 *       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
  5741
 *       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
  5742
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5743
 *       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
  5744
 *       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
  5745
 *       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
  5746
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5747
 *       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
  5748
 *       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
  5749
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5750
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
  5751
  // empty
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5752
	{$$ = 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
  5753
//| 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
  5754
| 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
  5755
	{$$ = $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
  5756
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5757
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5760
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
  5761
//  [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
  5762
                                  prev_declared_global_var_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5763
	{$$ = 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
  5764
|                                 prev_declared_global_var_name '.' structure_element_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5765
	{$$ = 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
  5766
| prev_declared_resource_name '.' prev_declared_global_var_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5767
	{$$ = 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
  5768
| prev_declared_resource_name '.' prev_declared_global_var_name '.' structure_element_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5769
	{$$ = 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
  5770
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5771
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5772
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5773
//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
  5774
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5775
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5776
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
  5777
/* NOTE:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5778
 * 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
  5779
 * 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
  5780
 * 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
  5781
 * _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
  5782
 * 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
  5783
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5784
 * 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
  5785
 * 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
  5786
 * initialization!
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5787
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5788
//  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
  5789
  program_name '.' symbolic_variable
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5790
	{$$ = 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
  5791
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5792
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5793
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
  5794
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5795
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5796
direction:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5797
  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
  5798
	{$$ = NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5799
| 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
  5800
	{$$ = NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5801
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5802
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5803
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5804
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
  5805
  TASK task_name task_initialization
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5806
	{$$ = new task_configuration_c($2, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5807
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5808
| TASK task_initialization
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5809
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no task name defined in task declaration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5810
| TASK error task_initialization
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5811
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid task name defined in task declaration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5812
| TASK task_name error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5813
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5814
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no task initialization defined in task declaration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5815
	 else {print_err_msg(locf(@3), locl(@3), "invalid task initialization in task declaration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5816
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5817
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5818
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5819
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5820
75
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5821
/* 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
  5822
 *       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
  5823
 *       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
  5824
 *       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
  5825
 *       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
  5826
 *       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
  5827
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5828
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
  5829
74
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5830
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5831
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
  5832
//  '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' //
75
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5833
  '(' {cmd_goto_task_init_state();} task_initialization_single task_initialization_interval task_initialization_priority ')'
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5834
	{$$ = new task_initialization_c($3, $4, $5, locloc(@$));}
74
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5835
;
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5836
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5837
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5838
task_initialization_single:
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5839
// [SINGLE ASSIGN data_source ',']
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5840
  /* empty */
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5841
	{$$ = NULL;}
75
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5842
| SINGLE ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} 
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5843
	{$$ = $4;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5844
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5845
| SINGLE {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5846
  {$$ = NULL; print_err_msg(locl(@1), locf(@3), "':=' missing after 'SINGLE' in task initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5847
| SINGLE ASSIGN {cmd_pop_state();} ',' {cmd_goto_task_init_state();}
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5848
  {$$ = NULL; print_err_msg(locl(@2), locf(@4), "no data source defined in 'SINGLE' statement of task initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5849
| SINGLE ASSIGN {cmd_pop_state();} error ',' {cmd_goto_task_init_state();}
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5850
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid data source defined in 'SINGLE' statement of task initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5851
/* ERROR_CHECK_END */
74
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5852
;
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5853
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5854
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5855
task_initialization_interval:
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5856
// [INTERVAL ASSIGN data_source ','] 
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5857
  /* empty */
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5858
	{$$ = NULL;}
75
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5859
| INTERVAL ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5860
	{$$ = $4;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5861
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5862
| INTERVAL {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5863
  {$$ = NULL; print_err_msg(locl(@1), locf(@3), "':=' missing after 'INTERVAL' in task initialization.");}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5864
| INTERVAL ASSIGN {cmd_pop_state();} ',' {cmd_goto_task_init_state();}
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5865
  {$$ = NULL; print_err_msg(locl(@2), locf(@4), "no data source defined in 'INTERVAL' statement of task initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5866
| INTERVAL ASSIGN {cmd_pop_state();} error ',' {cmd_goto_task_init_state();}
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5867
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid data source defined in 'INTERVAL' statement of task initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5868
/* ERROR_CHECK_END */
75
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5869
;
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5870
74
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5871
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5872
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5873
task_initialization_priority:
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5874
// PRIORITY ASSIGN integer
75
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5875
  PRIORITY ASSIGN {cmd_pop_state();} integer 
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5876
	{$$ = $4;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5877
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5878
| PRIORITY {cmd_pop_state();} integer
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5879
  {$$ = NULL; print_err_msg(locl(@1), locf(@3), "':=' missing after 'PRIORITY' in task initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5880
| PRIORITY ASSIGN {cmd_pop_state();} error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5881
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5882
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@4), "no priority number defined in 'PRIORITY' statement of task initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5883
	 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
  5884
	 yyerrok;
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5885
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5886
/* ERROR_CHECK_END */
75
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5887
;
0e381bdb8888 Fixing handling of task initialisation.
mario
parents: 74
diff changeset
  5888
74
85af9521bf63 fixing identifier issues of PRIORITY, SINGLE, and INTERVAL
mario
parents: 73
diff changeset
  5889
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5890
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5891
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
  5892
  constant
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5893
| 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
  5894
| program_output_reference
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  5895
| 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
  5896
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5897
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5898
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
  5899
//  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
  5900
  PROGRAM program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5901
	{$$ = 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
  5902
	 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
  5903
	}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5904
| PROGRAM RETAIN program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5905
	{$$ = 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
  5906
	 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
  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
| PROGRAM NON_RETAIN program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5909
	{$$ = 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
  5910
	 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
  5911
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5912
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5913
| PROGRAM program_name optional_task_name ':' identifier optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5914
  {$$ = NULL; print_err_msg(locf(@5), locl(@5), "invalid program type name after ':' in program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5915
| PROGRAM RETAIN program_name optional_task_name ':' identifier optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5916
  {$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid program type name after ':' in program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5917
| PROGRAM NON_RETAIN program_name optional_task_name ':' identifier optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5918
  {$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid program type name after ':' in program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5919
| PROGRAM error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5920
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'PROGRAM' in program configuration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5921
| PROGRAM RETAIN error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5922
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'RETAIN' in retentive program configuration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5923
| PROGRAM NON_RETAIN error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5924
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "unexpected token after 'NON_RETAIN' in non-retentive program configuration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5925
| PROGRAM optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5926
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no program name defined in program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5927
| PROGRAM RETAIN optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5928
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "no program name defined in retentive program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5929
| PROGRAM NON_RETAIN optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5930
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "no program name defined in non-retentive program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5931
| PROGRAM error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5932
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid program name defined in program configuration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5933
| PROGRAM RETAIN error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5934
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid program name defined in retentive program configuration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5935
| PROGRAM NON_RETAIN error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5936
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid program name defined in non-retentive program configuration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5937
| PROGRAM program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5938
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "':' missing after program name or optional task name in program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5939
| PROGRAM RETAIN program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5940
  {$$ = NULL; print_err_msg(locl(@4), locf(@5), "':' missing after program name or optional task name in retentive program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5941
| PROGRAM NON_RETAIN program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5942
  {$$ = NULL; print_err_msg(locl(@4), locf(@5), "':' missing after program name or optional task name in non-retentive program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5943
| PROGRAM program_name optional_task_name ':' optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5944
  {$$ = NULL; print_err_msg(locl(@4), locf(@5), "no program type defined in program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5945
| PROGRAM RETAIN program_name optional_task_name ':' optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5946
  {$$ = NULL; print_err_msg(locl(@5), locf(@6), "no program type defined in retentive program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5947
| PROGRAM NON_RETAIN program_name optional_task_name ':' optional_prog_conf_elements
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5948
  {$$ = NULL; print_err_msg(locl(@5), locf(@6), "no program type defined in non-retentive program configuration."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5949
/* ERROR_CHECK_END */
0
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
// 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
  5953
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
  5954
  // empty //
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5955
	{$$ = NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5956
| 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
  5957
	{$$ = $2;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5958
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5959
| WITH error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5960
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5961
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no task name defined in optional task name of program configuration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5962
	 else {print_err_msg(locf(@2), locl(@2), "invalid task name in optional task name of program configuration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5963
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5964
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5965
/* ERROR_CHECK_END */
0
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
// 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
  5969
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
  5970
  // empty //
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5971
	{$$ = NULL;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5972
| '(' 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
  5973
	{$$ = $2;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5974
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5975
| '(' error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5976
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid program configuration elements in program configuration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5977
| '(' prog_conf_elements error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5978
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of program configuration elements in program configuration."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5979
/* ERROR_CHECK_END */
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
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5981
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5982
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5983
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
  5984
  prog_conf_element
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  5985
	{$$ = 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
  5986
| 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
  5987
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5988
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5989
| prog_conf_elements prog_conf_element
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5990
  {$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in program configuration elements list."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5991
| prog_conf_elements ',' error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5992
  {$$ = $1;
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5993
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for program configuration element in program configuration list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  5994
	 else {print_err_msg(locf(@3), locl(@3), "invalid value for program configuration element in program configuration list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5995
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5996
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  5997
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5998
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  5999
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6000
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6001
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
  6002
  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
  6003
| 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
  6004
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6005
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6006
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6007
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
  6008
  // 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
  6009
/* 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
  6010
 *       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
  6011
 *       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
  6012
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6013
  any_identifier WITH task_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6014
	{$$ = new fb_task_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6015
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6016
| any_identifier WITH error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6017
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6018
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no task name defined in function block configuration.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6019
	 else {print_err_msg(locf(@3), locl(@3), "invalid task name in function block configuration."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6020
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6021
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6022
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6023
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6024
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6025
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6026
/* NOTE:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6027
 *  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
  6028
 *  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
  6029
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6030
 *  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
  6031
 *  (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
  6032
 *  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
  6033
 *  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
  6034
 *  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
  6035
 *  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
  6036
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6037
 *  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
  6038
 *  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
  6039
 *  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
  6040
 *  '(' 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
  6041
 *  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
  6042
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6043
 *  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
  6044
 *  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
  6045
 *  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
  6046
 *  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
  6047
 *  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
  6048
 *  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
  6049
 *  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
  6050
 *  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
  6051
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6052
 *  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
  6053
 *  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
  6054
 *  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
  6055
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6056
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
  6057
  any_symbolic_variable ASSIGN prog_data_source
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6058
	{$$ = 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
  6059
| any_symbolic_variable SENDTO data_sink
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6060
	{$$ = new prog_cnxn_sendto_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6061
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6062
| any_symbolic_variable constant
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6063
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing between parameter and value in program configuration element."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6064
| any_symbolic_variable enumerated_value
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6065
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing between parameter and value in program configuration element."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6066
| any_symbolic_variable data_sink
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6067
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' or '=>' missing between parameter and variable in program configuration element."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6068
| any_symbolic_variable ASSIGN error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6069
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6070
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value or variable defined in program configuration assignment element.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6071
	 else {print_err_msg(locf(@3), locl(@3), "invalid value or variable in program configuration assignment element."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6072
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6073
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6074
| any_symbolic_variable SENDTO error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6075
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6076
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no variable defined in program configuration sendto element.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6077
	 else {print_err_msg(locf(@3), locl(@3), "invalid variable in program configuration sendto element."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6078
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6079
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6080
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6081
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6082
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6083
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
  6084
  constant
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6085
| 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
  6086
| global_var_reference
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  6087
| 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
  6088
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6089
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6090
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
  6091
  global_var_reference
175
dadda1b5401e Adding support for checking direct variable declared before using
lbessard
parents: 151
diff changeset
  6092
| 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
  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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6095
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
  6096
 VAR_CONFIG instance_specific_init_list END_VAR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6097
	{$$ = new instance_specific_initializations_c($2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6098
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6099
| VAR_CONFIG END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6100
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no variable declared in configuration variable(s) initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6101
| VAR_CONFIG error instance_specific_init_list END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6102
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'VAR_CONFIG' in configuration variable(s) initialization."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6103
| VAR_CONFIG instance_specific_init_list error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6104
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed configuration variable(s) initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6105
| VAR_CONFIG error END_VAR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6106
	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in configuration variable(s) initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6107
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6108
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6109
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6110
// 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
  6111
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
  6112
  instance_specific_init ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6113
	{$$ = 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
  6114
| 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
  6115
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6116
/* ERROR_CHECK_BEGIN */
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  6117
| error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6118
  {$$ = new instance_specific_init_list_c(locloc(@$)); print_err_msg(locf(@1), locl(@1), "invalid configuration variable initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6119
| instance_specific_init error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6120
  {$$ = new instance_specific_init_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at the end of configuration variable initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6121
| instance_specific_init_list instance_specific_init error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6122
  {$$ = $1; print_err_msg(locl(@2), locf(@3), "';' missing at the end of configuration variable initialization."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  6123
| instance_specific_init_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6124
  {$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid configuration variable initialization."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6125
| instance_specific_init_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6126
  {$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after configuration variable initialization."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6127
/* ERROR_CHECK_END */
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6131
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
  6132
//
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6133
//  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
  6134
//  ((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
  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
//  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
  6137
/* 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
  6138
 *       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
  6139
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6140
/* 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
  6141
 *       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
  6142
 *       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
  6143
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6144
  prev_declared_resource_name '.' program_name '.' any_fb_name_list any_identifier ':' located_var_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6145
	{$$ = 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
  6146
| prev_declared_resource_name '.' program_name '.' any_fb_name_list any_identifier location ':' located_var_spec_init
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6147
	{$$ = 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
  6148
| prev_declared_resource_name '.' program_name '.' any_fb_name_list any_identifier ':' fb_initialization
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6149
	{$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
  6150
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6151
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6152
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6153
/* 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
  6154
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
  6155
  function_block_type_name ASSIGN structure_initialization
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6156
	{$$ = new fb_initialization_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6157
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6158
| function_block_type_name structure_initialization
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6159
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':=' missing between function block name and initialization in function block initialization."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6160
| function_block_type_name ASSIGN error
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6161
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6162
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no initial value defined in function block initialization.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6163
	 else {print_err_msg(locf(@3), locl(@3), "invalid initial value in function block initialization."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6164
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6165
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6166
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6167
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6168
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6169
/***********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6170
/* 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
  6171
/***********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6172
/* 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
  6173
/* 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
  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
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
  6176
  EOL
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6177
| 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
  6178
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6179
94
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6180
0
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
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
  6183
  il_instruction
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6184
	{$$ = 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
  6185
| any_pragma eol_list
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6186
	{$$ = new instruction_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
  6187
| 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
  6188
	{$$ = $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
  6189
| 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
  6190
	{$$ = $1; $$->add_element($2);}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6191
;
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6192
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6193
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6194
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6195
il_instruction:
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6196
  il_incomplete_instruction eol_list
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6197
	{$$ = new il_instruction_c(NULL, $1, locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6198
| label ':' il_incomplete_instruction eol_list
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6199
	{$$ = new il_instruction_c($1, $3, locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6200
/* ERROR_CHECK_BEGIN */
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6201
| error eol_list
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6202
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid IL instruction."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6203
| il_incomplete_instruction error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6204
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of IL instruction."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6205
| error ':' il_incomplete_instruction eol_list
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6206
	{$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid label in IL instruction."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6207
| label il_incomplete_instruction eol_list
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6208
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after label in IL instruction."); yynerrs++;}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6209
| label ':' error eol_list
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6210
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid IL instruction."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6211
| label ':' il_incomplete_instruction error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6212
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "EOL missing at the end of IL instruction."); yyerrok;}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  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
/* 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
  6218
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
  6219
  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
  6220
| 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
  6221
| 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
  6222
| 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
  6223
| 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
  6224
| 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
  6225
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6226
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6227
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6228
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
  6229
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6230
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6231
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6232
il_simple_operation:
94
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6233
// (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
  6234
  il_simple_operator
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6235
	{$$ = new il_simple_operation_c($1, NULL, locloc(@$));}
93
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6236
/*
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6237
 * Note: Bison is getting confused with the following rule,
94
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6238
 *       i.e. it is finding conflicts where there seemingly are really none.
93
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6239
 *       The rule was therefore replaced by the equivalent following
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6240
 *       two rules.
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6241
 */
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6242
/*
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6243
| il_simple_operator il_operand
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6244
	{$$ = new il_simple_operation_c($1, $2, locloc(@$));}
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6245
*/
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6246
| il_simple_operator_noclash il_operand
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6247
	{$$ = new il_simple_operation_c($1, $2, locloc(@$));}
91
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6248
| il_simple_operator_clash il_operand
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6249
	{$$ = 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
  6250
/* 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
  6251
 *         | 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
  6252
 *       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
  6253
 *       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
  6254
 *       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
  6255
 *       without any operands, could be reduced to either an operator or a
89
5b2ec5c057fa Cleaning up comments.
mario
parents: 88
diff changeset
  6256
 *       function call. 
5b2ec5c057fa Cleaning up comments.
mario
parents: 88
diff changeset
  6257
 *
5b2ec5c057fa Cleaning up comments.
mario
parents: 88
diff changeset
  6258
 *       I (Mario) have chosen to reduce it to an operator.
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6259
 *       In order to do this, we must remove from the syntax that defines
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6260
 *       function calls all the functions whose names clash with the IL operators.
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6261
 *
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6262
 *       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
  6263
 *         | 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
  6264
 *       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
  6265
 *         | 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
  6266
 *       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
  6267
 *       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
  6268
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6269
| function_name_no_clashes
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6270
	{$$ = new il_function_call_c($1, NULL, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6271
/* 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
  6272
 *         | il_simple_operator il_operand
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6273
 *       already contains the 'NOT', 'MOD', etc. operators, followed by a single il_operand.
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6274
 *       However, this same code (MOD x) may also be reduced to a function call to the MOD
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6275
 *       function. This means that (MOD, AND,...) could be interpret as a function name
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6276
 *       or as an IL operator! This would lead us to a reduce/reduce conflict!
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6277
 *
89
5b2ec5c057fa Cleaning up comments.
mario
parents: 88
diff changeset
  6278
 *       I (Mario) have chosen to reduce it to an operand, rather than a function call.
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6279
 *       In order to do this, we must remove from the syntax that defines
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6280
 *       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
  6281
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6282
 *       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
  6283
 *         | 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
  6284
 *       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
  6285
 *         | 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
  6286
 *       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
  6287
 *       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
  6288
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6289
 *       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
  6290
 *       this alternative syntax does not cover the possibility of
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6291
 *       the function 'NOT', 'MOD', etc... being called with more than one il_operand,
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6292
 *       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
  6293
 *       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
  6294
 *       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
  6295
 *       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
  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
| function_name_no_clashes il_operand_list
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6298
	{$$ = new il_function_call_c($1, $2, locloc(@$));}
91
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6299
| il_simple_operator_clash il_operand_list2
93
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6300
	{$$ = new il_function_call_c(il_operator_c_2_identifier_c($1), $2, locloc(@$));}
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6301
;
284ef59bb133 Cleaning up comments.
mario
parents: 92
diff changeset
  6302
91
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6303
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6304
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6305
il_expression:
94
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6306
// il_expr_operator '(' [il_operand] EOL {EOL} [simple_instr_list] ')'
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6307
/*
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6308
 * Note: Bison is getting confused with the use of il_expr_operator,
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6309
 *       i.e. it is finding conflicts where there seemingly are really none.
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6310
 *       il_expr_operator was therefore replaced by the equivalent 
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6311
 *       il_expr_operator_noclash | il_expr_operator_clash.
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6312
 */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6313
  il_expr_operator_noclash '(' eol_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6314
	{$$ = 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
  6315
| il_expr_operator_noclash '(' il_operand eol_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6316
	{$$ = new il_expression_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
  6317
| il_expr_operator_noclash '(' eol_list simple_instr_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6318
	{$$ = 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
  6319
| il_expr_operator_noclash '(' il_operand eol_list simple_instr_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6320
	{$$ = new il_expression_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
  6321
| il_expr_operator_clash '(' eol_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6322
	{$$ = 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
  6323
| il_expr_operator_clash '(' il_operand eol_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6324
	{$$ = new il_expression_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
  6325
| il_expr_operator_clash '(' il_operand eol_list simple_instr_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6326
	{$$ = new il_expression_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
  6327
| il_expr_operator_clash_eol_list simple_instr_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6328
	{$$ = new il_expression_c($1, NULL, $2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6329
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6330
| il_expr_operator_noclash '(' eol_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6331
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of IL expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6332
| il_expr_operator_noclash '(' il_operand eol_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6333
  {$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6334
| il_expr_operator_noclash '(' eol_list simple_instr_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6335
  {$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6336
| il_expr_operator_noclash '(' il_operand eol_list simple_instr_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6337
  {$$ = NULL; print_err_msg(locl(@5), locf(@6), "')' missing at the end of IL expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6338
| il_expr_operator_clash '(' il_operand eol_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6339
  {$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6340
| il_expr_operator_clash '(' il_operand eol_list simple_instr_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6341
  {$$ = NULL; print_err_msg(locl(@5), locf(@6), "')' missing at the end of IL expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6342
| il_expr_operator_clash_eol_list simple_instr_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6343
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of IL expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6344
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6345
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6346
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6347
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6348
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
  6349
  il_jump_operator label
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6350
	{$$ = new il_jump_operation_c($1, $2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6351
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6352
| il_jump_operator error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6353
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid label defined in IL jump operation."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6354
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6355
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6356
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6357
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6358
il_fb_call:
94
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6359
// 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
  6360
  il_call_operator prev_declared_fb_name
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6361
	{$$ = 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
  6362
| il_call_operator prev_declared_fb_name '(' ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6363
	{$$ = 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
  6364
| il_call_operator prev_declared_fb_name '(' eol_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6365
	{$$ = 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
  6366
| il_call_operator prev_declared_fb_name '(' il_operand_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6367
	{$$ = 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
  6368
| il_call_operator prev_declared_fb_name '(' eol_list il_param_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6369
	{$$ = new il_fb_call_c($1, $2, NULL, $5, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6370
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6371
| il_call_operator error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6372
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6373
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6374
	 else {print_err_msg(locf(@2), locl(@2), "invalid function block name in IL function block call."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6375
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6376
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6377
| il_call_operator '(' ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6378
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6379
| il_call_operator '(' eol_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6380
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6381
| il_call_operator '(' il_operand_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6382
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6383
| il_call_operator '(' eol_list il_param_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6384
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no function block name defined in IL function block call."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6385
| il_call_operator error '(' ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6386
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6387
| il_call_operator error '(' eol_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6388
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6389
| il_call_operator error '(' il_operand_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6390
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6391
| il_call_operator error '(' eol_list il_param_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6392
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid function block name defined in IL function block call."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6393
| il_call_operator prev_declared_fb_name ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6394
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'(' missing after function block name defined in IL function block call."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6395
| il_call_operator prev_declared_fb_name il_operand_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6396
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "'(' missing after function block name defined in IL function block call."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6397
| il_call_operator prev_declared_fb_name '(' error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6398
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of IL function block call."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6399
| il_call_operator prev_declared_fb_name '(' eol_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6400
  {$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL function block call."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6401
| il_call_operator prev_declared_fb_name '(' il_operand_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6402
  {$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of IL function block call."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6403
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6404
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6405
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6406
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6407
/* 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
  6408
il_formal_funct_call:
94
40288323acc0 Fixing some more comments.
mario
parents: 93
diff changeset
  6409
// 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
  6410
/*  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
  6411
/* 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
  6412
 *         - 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
  6413
 *         - 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
  6414
 *       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
  6415
 *       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
  6416
 *       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
  6417
 *       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
  6418
 *       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
  6419
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6420
 *       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
  6421
 *       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
  6422
 *       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
  6423
 *       as operators, rather than as function calls!
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6424
 *       (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
  6425
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6426
  function_name_no_clashes '(' eol_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6427
	{$$ = new il_formal_funct_call_c($1, NULL, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6428
| function_name_simpleop_clashes '(' eol_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6429
	{$$ = new il_formal_funct_call_c($1, NULL, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6430
/* | function_name '(' eol_list il_param_list ')' */
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6431
/* For the above syntax, we no longer have two ways of interpreting the
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6432
 * same syntax. The above is always a function call!
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6433
 * However, some of the functions that we may be calling
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6434
 * may have the same name as an IL operator. This means that
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6435
 * flex will be parsing them and handing them over to bison as
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6436
 * IL operator tokens, and not as function name tokens.
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6437
 * (when parsing ST, flex no longer recognizes IL operators,
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6438
 * so will always return the correct function name, unless that
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6439
 * name also coincides with an operator used in ST -> XOR, OR, MOD, AND, NOT)
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6440
 *
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6441
 * We must therefore interpret the IL operators as function names!
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6442
 */
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
| function_name_no_clashes '(' eol_list il_param_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6444
	{$$ = new il_formal_funct_call_c($1, $4, locloc(@$));}
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6445
| function_name_simpleop_clashes '(' eol_list il_param_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6446
	{$$ = new il_formal_funct_call_c($1, $4, locloc(@$));}
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6447
/* The following line should read:
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6448
 *
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6449
 * | function_name_expression_clashes '(' eol_list il_param_list ')'
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6450
 *
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6451
 * 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
  6452
 * 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
  6453
 * 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
  6454
 * 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
  6455
 * 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
  6456
 * 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
  6457
 * 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
  6458
 * 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
  6459
 * 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
  6460
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6461
 * 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
  6462
 * 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
  6463
 * 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
  6464
 * 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
  6465
 * This is a lot of work, so I put it in a function
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6466
 * at the end of this file... il_operator_c_2_identifier_c()
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6467
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6468
| il_expr_operator_clash_eol_list il_param_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6469
	{$$ = new il_formal_funct_call_c(il_operator_c_2_identifier_c($1), $2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6470
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6471
| function_name_no_clashes '(' eol_list error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6472
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid parameter list defined in IL formal function call."); yyerrok;} 
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6473
| function_name_simpleop_clashes '(' eol_list error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6474
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid parameter list defined in IL formal function call."); yyerrok;} 
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6475
| il_expr_operator_clash_eol_list error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6476
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter list defined in IL formal function call."); yyerrok;} 
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6477
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6478
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6479
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6480
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6481
il_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
  6482
  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
  6483
	{$$ = $1;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6484
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6485
| il_expr_operator_clash '(' error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6486
  {$$ = $1; print_err_msg(locl(@2), locf(@3), "EOL missing after '(' in IL instruction."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6487
/* ERROR_CHECK_END */
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6490
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6491
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
  6492
  variable
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  6493
| 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
  6494
| constant
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6495
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6496
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6497
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6498
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
  6499
  il_operand
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6500
	{$$ = new il_operand_list_c(locloc(@$)); $$->add_element($1);}
91
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6501
| il_operand_list2
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6502
;
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6503
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6504
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6505
/* List with 2 or more il_operands */ 
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6506
il_operand_list2:
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6507
  il_operand ',' il_operand 
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6508
	{$$ = new il_operand_list_c(locloc(@$)); $$->add_element($1); $$->add_element($3);}
ac119a256fc0 Cleaning up some bison rules.
mario
parents: 90
diff changeset
  6509
| 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
  6510
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6511
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6512
| il_operand_list2 il_operand
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6513
  {$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in IL operand list."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6514
| il_operand ',' error
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6515
  {$$ = new il_operand_list_c(locloc(@$));
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6516
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no operand defined in IL operand list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6517
	 else {print_err_msg(locf(@3), locl(@3), "invalid operand name in IL operand list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6518
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6519
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6520
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6521
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6522
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6523
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6524
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
  6525
  il_simple_instruction
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6526
	{$$ = 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
  6527
| 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
  6528
	{$$ = $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
  6529
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6530
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6531
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6532
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
  6533
  il_simple_operation 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
  6534
| il_expression 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
  6535
| il_formal_funct_call eol_list
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6536
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6537
| il_expression error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6538
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing after expression IL instruction."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6539
| il_formal_funct_call error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6540
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing after formal function call IL instruction."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6541
/* ERROR_CHECK_END */
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6545
/* 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
  6546
 * 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
  6547
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6548
 * 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
  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
 * 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
  6551
 * 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
  6552
 * 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
  6553
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6554
 * 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
  6555
 * 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
  6556
 * 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
  6557
 * 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
  6558
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6559
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
  6560
  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
  6561
	{$$ = $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
  6562
| il_param_last_instruction
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6563
	{$$ = new il_param_list_c(locloc(@$)); $$->add_element($1);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6564
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6565
| il_param_instruction_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6566
  {$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid parameter assignment in parameter assignment list."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6567
| il_param_last_instruction il_param_last_instruction
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6568
  {$$ = 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
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6569
| il_param_instruction_list il_param_last_instruction il_param_last_instruction
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6570
  {$$ = $1; print_err_msg(locl(@2), locf(@3), "',' missing at the end of parameter assignment in parameter assignment list."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6571
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6572
;
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6575
/* 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
  6576
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
  6577
  il_param_instruction
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6578
	{$$ = 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
  6579
| 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
  6580
	{$$ = $1; $$->add_element($2);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6581
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6582
| il_param_last_instruction il_param_instruction
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6583
  {$$ = 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
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6584
| il_param_instruction_list il_param_last_instruction il_param_instruction
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6585
  {$$ = $1; print_err_msg(locl(@2), locf(@3), "',' missing at the end of parameter assignment in parameter assignment list."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6586
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6587
;
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6590
il_param_instruction:
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6591
  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
  6592
| il_param_out_assignment ',' eol_list
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6593
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6594
| il_param_assignment ',' error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6595
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "EOL missing at the end of parameter assignment in parameter assignment list."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6596
| il_param_out_assignment ',' error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6597
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "EOL missing at the end of parameter out assignment in parameter assignment list."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6598
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6599
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6600
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6601
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6602
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
  6603
  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
  6604
| il_param_out_assignment eol_list
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6605
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6606
| il_param_assignment error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6607
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of last parameter assignment in parameter assignment list."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6608
| il_param_out_assignment error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6609
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "EOL missing at the end of last parameter out assignment in parameter assignment list."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6610
/* ERROR_CHECK_END */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6611
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6612
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6613
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6614
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6615
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
  6616
  il_assign_operator il_operand
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6617
	{$$ = 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
  6618
| il_assign_operator '(' eol_list simple_instr_list ')'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6619
	{$$ = new il_param_assignment_c($1, NULL, $4, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6620
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6621
| error il_operand
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6622
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid operator in parameter assignment."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6623
| error '(' eol_list simple_instr_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6624
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid operator in parameter assignment."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6625
| il_assign_operator error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6626
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6627
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no operand defined in parameter assignment.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6628
	 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
  6629
	 yyerrok;
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  6630
	}
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  6631
| il_assign_operator '(' eol_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6632
  {$$ = 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
  6633
| il_assign_operator '(' eol_list error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6634
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid instruction list defined in parameter assignment."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6635
| il_assign_operator '(' eol_list simple_instr_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6636
  {$$ = NULL; print_err_msg(locl(@4), locf(@5), "')' missing at the end of instruction list defined in parameter assignment."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6637
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6638
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6639
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6640
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6641
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
  6642
  il_assign_out_operator variable
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6643
	{$$ = new il_param_out_assignment_c($1, $2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6644
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6645
| il_assign_out_operator error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6646
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6647
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no variable defined in IL operand list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6648
	 else {print_err_msg(locf(@2), locl(@2), "invalid variable in IL operand list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6649
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6650
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6651
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6652
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6653
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6654
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6655
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6656
/*******************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6657
/* 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
  6658
/*******************/
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6659
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
  6660
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6661
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6662
/* NOTE:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6663
 *  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
  6664
 * 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
  6665
 * 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
  6666
 * 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
  6667
 * (Mario)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6668
 */
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6669
LD_operator: 		LD 	{$$ = new LD_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6670
LDN_operator: 		LDN 	{$$ = new LDN_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6671
ST_operator: 		ST 	{$$ = new ST_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6672
STN_operator: 		STN 	{$$ = new STN_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6673
NOT_operator: 		NOT 	{$$ = new NOT_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6674
S_operator: 		S 	{$$ = new S_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6675
R_operator: 		R 	{$$ = new R_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6676
S1_operator: 		S1 	{$$ = new S1_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6677
R1_operator: 		R1 	{$$ = new R1_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6678
CLK_operator: 		CLK 	{$$ = new CLK_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6679
CU_operator: 		CU 	{$$ = new CU_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6680
CD_operator: 		CD 	{$$ = new CD_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6681
PV_operator: 		PV 	{$$ = new PV_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6682
IN_operator: 		IN 	{$$ = new IN_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6683
PT_operator: 		PT 	{$$ = new PT_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6684
AND_operator: 		AND 	{$$ = new AND_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6685
AND2_operator: 		AND2 	{$$ = new AND_operator_c(locloc(@$));}; /* '&' in the source code! */
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6686
OR_operator: 		OR 	{$$ = new OR_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6687
XOR_operator: 		XOR 	{$$ = new XOR_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6688
ANDN_operator: 		ANDN 	{$$ = new ANDN_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6689
ANDN2_operator:		ANDN2 	{$$ = new ANDN_operator_c(locloc(@$));}; /* '&N' in the source code! */
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6690
ORN_operator: 		ORN 	{$$ = new ORN_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6691
XORN_operator: 		XORN 	{$$ = new XORN_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6692
ADD_operator: 		ADD 	{$$ = new ADD_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6693
SUB_operator: 		SUB 	{$$ = new SUB_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6694
MUL_operator: 		MUL 	{$$ = new MUL_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6695
DIV_operator: 		DIV 	{$$ = new DIV_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6696
MOD_operator: 		MOD 	{$$ = new MOD_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6697
GT_operator: 		GT 	{$$ = new GT_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6698
GE_operator: 		GE 	{$$ = new GE_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6699
EQ_operator: 		EQ 	{$$ = new EQ_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6700
LT_operator: 		LT 	{$$ = new LT_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6701
LE_operator: 		LE 	{$$ = new LE_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6702
NE_operator: 		NE 	{$$ = new NE_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6703
CAL_operator: 		CAL 	{$$ = new CAL_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6704
CALC_operator: 		CALC 	{$$ = new CALC_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6705
CALCN_operator: 	CALCN 	{$$ = new CALCN_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6706
RET_operator: 		RET 	{$$ = new RET_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6707
RETC_operator: 		RETC 	{$$ = new RETC_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6708
RETCN_operator: 	RETCN 	{$$ = new RETCN_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6709
JMP_operator: 		JMP 	{$$ = new JMP_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6710
JMPC_operator: 		JMPC 	{$$ = new JMPC_operator_c(locloc(@$));};
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6711
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
  6712
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6713
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6714
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
  6715
  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
  6716
| 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
  6717
;
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
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_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
  6721
  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
  6722
| 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
  6723
| 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
  6724
| 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
  6725
| 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
  6726
| 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
  6727
| 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
  6728
| 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
  6729
| 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
  6730
| 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
  6731
| 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
  6732
| 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
  6733
| 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
  6734
| 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
  6735
| 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
  6736
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6737
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6738
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6739
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
  6740
  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
  6741
| il_simple_operator_clash2
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6742
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6743
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6744
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
  6745
  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
  6746
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6747
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6748
il_simple_operator_clash2:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6749
  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
  6750
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6751
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6752
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
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
  6755
  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
  6756
| 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
  6757
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6758
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6759
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_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
  6761
  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
  6762
| 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
  6763
| 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
  6764
| 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
  6765
| 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
  6766
| 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
  6767
| 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
  6768
| 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
  6769
| 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
  6770
| 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
  6771
| 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
  6772
| 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
  6773
| 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
  6774
| 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
  6775
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6776
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6777
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6778
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
  6779
  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
  6780
| 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
  6781
| 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
  6782
| 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
  6783
| 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
  6784
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6785
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6786
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6787
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6788
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6789
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
  6790
/*  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
  6791
  any_identifier ASSIGN
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  6792
	{$$ = 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
  6793
| en_identifier ASSIGN
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  6794
	{$$ = new il_assign_operator_c($1, locloc(@$));}
239
b3063ca418c1 Bug when parsing standard function block call in IL
laurent
parents: 207
diff changeset
  6795
| S1_operator ASSIGN
b3063ca418c1 Bug when parsing standard function block call in IL
laurent
parents: 207
diff changeset
  6796
	{$$ = 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
  6797
| R1_operator ASSIGN
b3063ca418c1 Bug when parsing standard function block call in IL
laurent
parents: 207
diff changeset
  6798
	{$$ = 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
  6799
| CLK_operator ASSIGN
b3063ca418c1 Bug when parsing standard function block call in IL
laurent
parents: 207
diff changeset
  6800
	{$$ = 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
  6801
| CU_operator ASSIGN
b3063ca418c1 Bug when parsing standard function block call in IL
laurent
parents: 207
diff changeset
  6802
	{$$ = 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
  6803
| CD_operator ASSIGN
b3063ca418c1 Bug when parsing standard function block call in IL
laurent
parents: 207
diff changeset
  6804
	{$$ = 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
  6805
| PV_operator ASSIGN
b3063ca418c1 Bug when parsing standard function block call in IL
laurent
parents: 207
diff changeset
  6806
	{$$ = 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
  6807
| IN_operator ASSIGN
b3063ca418c1 Bug when parsing standard function block call in IL
laurent
parents: 207
diff changeset
  6808
	{$$ = 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
  6809
| PT_operator ASSIGN
b3063ca418c1 Bug when parsing standard function block call in IL
laurent
parents: 207
diff changeset
  6810
	{$$ = new il_assign_operator_c(il_operator_c_2_identifier_c($1), locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6811
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6812
| error ASSIGN
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6813
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid parameter defined in parameter assignment."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6814
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6815
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6816
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6817
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6818
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
  6819
/*  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
  6820
/*  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
  6821
  sendto_identifier SENDTO
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6822
	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6823
/* The following is not required, as the sendto_identifier_token returned by flex will 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6824
 * also include the 'ENO' identifier.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6825
 * The resulting abstract syntax tree is identical with or without this following rule,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6826
 * as both the eno_identifier and the sendto_identifier are stored as
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6827
 * an identifier_c !!
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6828
 */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6829
/*
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  6830
| eno_identifier SENDTO
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  6831
	{$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6832
*/
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6833
/*| 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
  6834
| NOT sendto_identifier SENDTO
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6835
	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6836
/* The following is not required, as the sendto_identifier_token returned by flex will 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6837
 * also include the 'ENO' identifier.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6838
 * The resulting abstract syntax tree is identical with or without this following rule,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6839
 * as both the eno_identifier and the sendto_identifier are stored as
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6840
 * an identifier_c !!
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6841
 *
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6842
 * NOTE: Removing the following rule also removes a shift/reduce conflict from the parser.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6843
 *       This conflict is not really an error/ambiguity in the syntax, but rather
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6844
 *       due to the fact that more than a single look-ahead token would be required
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6845
 *       to correctly parse the syntax, something that bison does not support.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6846
 *
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6847
 *       The shift/reduce conflict arises because bison does not know whether
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6848
 *       to parse the 'NOT ENO' in the following code
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6849
 *         LD 1
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6850
 *         funct_name (
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6851
 *                      NOT ENO => bool_var,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6852
 *                      EN := TRUE
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6853
 *                    )
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6854
 *        as either a il_param_assignment (wrong!) or an il_param_out_assignment.(correct).
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6855
 *        The '=>' delimiter (known as SEND_TO in this iec.y file) is a dead giveaway that 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6856
 *        it should be parsed as an il_param_out_assignment, but still, bison gets confused!
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6857
 *        Bison considers the possibility of reducing the 'NOT ENO' as an NOT_operator with
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6858
 *        the 'ENO' operand
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6859
 *        (NOT_operator -> il_simple_operator -> il_simple_operation -> il_simple_instruction ->
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6860
 *          -> simple_instr_list -> il_param_assignment)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6861
 *        instead of reducing it to an il_param_out_operator.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6862
 *        ( il_param_out_operator -> il_param_out_assignment)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6863
 *
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6864
 *        Note that the shift/reduce conflict only manifests itself in the il_formal_funct_call,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6865
 *        where both the il_param_out_assignment and il_param_assignment are used!
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6866
 * 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6867
 *          il_param_out_assignment --+--> il_param_instruction -> il_param_instruction_list --+
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6868
 *                                    |                                                        |
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6869
 *          il_param_assignment     --+                                                        |
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6870
 *                                                                                             |
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6871
 *                                                     il_formal_funct_call <- il_param_list <-+
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6872
 *
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6873
 */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6874
/*
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  6875
| NOT eno_identifier SENDTO
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  6876
	{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  6877
*/
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6878
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6879
| error SENDTO
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6880
  {$$ = 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
  6881
| NOT SENDTO
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6882
  {$$ = 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
  6883
| NOT error SENDTO
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6884
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter defined in parameter out assignment."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6885
/* ERROR_CHECK_END */
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
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6887
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6888
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6889
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
  6890
  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
  6891
| 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
  6892
| 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
  6893
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6894
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6895
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6896
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
  6897
  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
  6898
| 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
  6899
| 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
  6900
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6901
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6902
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6903
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
  6904
  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
  6905
| 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
  6906
| 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
  6907
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6908
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6909
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6910
/***********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6911
/* 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
  6912
/***********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6913
expression:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6914
  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
  6915
| expression OR xor_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6916
	{$$ = new or_expression_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6917
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6918
| expression OR error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6919
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6920
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'OR' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6921
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'OR' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6922
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6923
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6924
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6925
;
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
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
  6928
  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
  6929
| xor_expression XOR and_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6930
	{$$ = new xor_expression_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6931
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6932
| xor_expression XOR error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6933
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6934
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'XOR' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6935
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'XOR' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6936
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6937
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6938
/* ERROR_CHECK_END */
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
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6940
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6941
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
  6942
  comparison
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6943
| and_expression '&' comparison
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6944
	{$$ = 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
  6945
| and_expression AND comparison
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6946
	{$$ = 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
  6947
/* 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
  6948
 *       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
  6949
 *       AND2!
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6950
 *       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
  6951
 *       but we leave it in nevertheless just in case we later decide
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6952
 *       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
  6953
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6954
| and_expression AND2 comparison
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6955
	{$$ = new and_expression_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6956
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6957
| and_expression '&' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6958
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6959
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '&' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6960
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '&' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6961
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6962
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6963
| and_expression AND error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6964
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6965
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'AND' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6966
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'AND' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6967
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6968
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6969
| and_expression AND2 error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6970
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6971
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '&' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6972
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '&' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6973
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6974
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6975
/* ERROR_CHECK_END */
0
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
comparison:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6979
  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
  6980
| comparison '=' equ_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6981
	{$$ = 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
  6982
| comparison OPER_NE equ_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  6983
	{$$ = new notequ_expression_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6984
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6985
| comparison '=' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6986
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6987
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '=' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6988
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '=' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6989
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6990
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6991
| comparison OPER_NE error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6992
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6993
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '<>' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  6994
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '<>' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6995
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6996
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  6997
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6998
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  6999
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7000
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
  7001
  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
  7002
| equ_expression '<' add_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7003
	{$$ = 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
  7004
| equ_expression '>' add_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7005
	{$$ = 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
  7006
| equ_expression OPER_LE add_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7007
	{$$ = 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
  7008
| equ_expression OPER_GE add_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7009
	{$$ = new ge_expression_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7010
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7011
| equ_expression '<' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7012
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7013
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '<' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7014
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '<' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7015
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7016
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7017
| equ_expression '>' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7018
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7019
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '>' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7020
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '>' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7021
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7022
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7023
| equ_expression OPER_LE error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7024
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7025
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '<=' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7026
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '<=' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7027
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7028
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7029
| equ_expression OPER_GE error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7030
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7031
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '>=' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7032
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '>=' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7033
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7034
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7035
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7036
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7037
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7038
/* 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
  7039
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
  7040
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7041
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7042
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
  7043
  term
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7044
| add_expression '+' term
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7045
	{$$ = 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
  7046
| add_expression '-' term
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7047
	{$$ = new sub_expression_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7048
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7049
| add_expression '+' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7050
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7051
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '+' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7052
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '+' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7053
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7054
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7055
| add_expression '-' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7056
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7057
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '-' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7058
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '-' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7059
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7060
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7061
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7062
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7063
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7064
/* 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
  7065
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
  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
term:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7069
  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
  7070
| term '*' power_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7071
	{$$ = 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
  7072
| term '/' power_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7073
	{$$ = 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
  7074
| term MOD power_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7075
	{$$ = new mod_expression_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7076
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7077
| term '*' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7078
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7079
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '*' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7080
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '*' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7081
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7082
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7083
| term '/' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7084
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7085
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '/' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7086
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '/' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7087
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7088
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7089
| term MOD error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7090
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7091
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after 'MOD' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7092
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after 'MOD' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7093
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7094
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7095
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7096
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7097
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7098
/* 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
  7099
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
  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
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
  7103
  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
  7104
| power_expression OPER_EXP unary_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7105
	{$$ = new power_expression_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7106
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7107
| power_expression OPER_EXP error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7108
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7109
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after '**' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7110
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after '**' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7111
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7112
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7113
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7114
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7115
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7116
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7117
unary_expression:
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7118
  non_negative_primary_expression
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7119
| '-' non_negative_primary_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7120
	{$$ = 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
  7121
| NOT primary_expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7122
	{$$ = new not_expression_c($2, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7123
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7124
| '-' error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7125
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7126
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no expression defined after '-' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7127
	 else {print_err_msg(locf(@2), locl(@2), "invalid expression after '-' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7128
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7129
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7130
| NOT error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7131
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7132
	 if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no expression defined after 'NOT' in ST expression.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7133
	 else {print_err_msg(locf(@2), locl(@2), "invalid expression after 'NOT' in ST expression."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7134
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7135
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7136
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7137
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7138
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7139
/* 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
  7140
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
  7141
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7142
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7143
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7144
/* 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
  7145
 *       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
  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
 *       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
  7148
 *       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
  7149
 *       (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
  7150
 *       OR
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7151
 *       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
  7152
 *       (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
  7153
 *
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7154
 *       To remove the conflict, we only allow constants without
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7155
 *       a preceding '-' to be used in primary_expression
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7156
 *       (i.e. as a parameter to the unary negation 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
  7157
 */
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  7158
/* NOTE: We use enumerated_value_without_identifier instead of enumerated_value
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  7159
 *       in order to remove a reduce/reduce conflict between reducing an
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  7160
 *       identifier to a variable or an enumerated_value.
78
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  7161
 *
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  7162
 *       This change follows the IEC specification. The specification seems to
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7163
 *       imply (by introducing syntax that allows to unambiguosly reference an
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7164
 *       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
  7165
 *       for a variable and an enumerated value, then the variable shall be
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7166
 *       considered.
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  7167
 */
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7168
non_negative_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
  7169
  non_negative_constant
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7170
//| enumerated_value_without_identifier
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7171
| 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
  7172
| variable
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7173
| '(' expression ')'
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7174
	{$$ = $2;}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7175
|  function_invocation
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7176
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7177
| '(' expression error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7178
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of expression in ST expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7179
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7180
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7181
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7182
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7183
primary_expression:
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7184
  constant
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7185
//| enumerated_value_without_identifier
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7186
  enumerated_value
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7187
| variable
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7188
| '(' expression ')'
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7189
	{$$ = $2;}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7190
|  function_invocation
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7191
/* ERROR_CHECK_BEGIN */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7192
| '(' expression error
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7193
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of expression in ST expression."); yyerrok;}
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7194
/* ERROR_CHECK_END */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7195
;
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7196
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7197
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7198
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7199
/* 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
  7200
/* 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
  7201
 *       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
  7202
 *       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
  7203
 *       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
  7204
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7205
 *       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
  7206
 *       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
  7207
 *           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
  7208
 *       with
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7209
 *           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
  7210
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7211
 *       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
  7212
 *       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
  7213
 *       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
  7214
 *       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
  7215
 *       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
  7216
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7217
 *       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
  7218
 *       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
  7219
 *       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
  7220
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7221
 *       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
  7222
 *       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
  7223
 *       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
  7224
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7225
function_invocation:
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7226
/*  function_name '(' [param_assignment_list] ')' */
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7227
  function_name_no_NOT_clashes '(' param_assignment_formal_list ')'
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7228
	{$$ = new function_invocation_c($1, $3, NULL, locloc(@$));}
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7229
| function_name_no_NOT_clashes '(' param_assignment_nonformal_list ')'
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7230
	{$$ = new function_invocation_c($1, NULL, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7231
/* ERROR_CHECK_BEGIN */ 
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7232
| function_name_no_NOT_clashes param_assignment_formal_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7233
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function name in ST expression."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7234
| function_name_no_NOT_clashes '(' ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7235
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "no parameter defined in function invocation of ST expression."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7236
| function_name_no_NOT_clashes '(' error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7237
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid parameter(s) defined in function invocation of ST expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7238
| function_name_no_NOT_clashes '(' param_assignment_formal_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7239
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of function invocation in ST expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7240
| function_name_no_NOT_clashes '(' param_assignment_nonformal_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7241
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of function invocation in ST expression."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7242
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7243
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7244
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7245
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7246
/********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7247
/* 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
  7248
/********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7249
statement_list:
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  7250
  statement ';'
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7251
	{$$ = 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
  7252
| any_pragma
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7253
	{$$ = 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
  7254
| 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
  7255
	{$$ = $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
  7256
| 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
  7257
	{$$ = $1; $$->add_element($2);}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7258
/* ERROR_CHECK_BEGIN */
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  7259
| statement error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7260
	{$$ = new statement_list_c(locloc(@$)); print_err_msg(locl(@1), locf(@2), "';' missing at the end of statement in ST statement."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  7261
| statement_list statement error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7262
	{$$ = $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
  7263
| statement_list error ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7264
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "invalid statement in ST statement."); yyerrok;}
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  7265
| statement_list ';'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7266
	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unexpected ';' after statement in ST statement."); yynerrs++;}
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7267
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7268
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7269
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7270
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7271
statement:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7272
  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
  7273
| 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
  7274
| 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
  7275
| 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
  7276
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7277
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7278
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7279
/*********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7280
/* 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
  7281
/*********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7282
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
  7283
  variable ASSIGN expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7284
	{$$ = new assignment_statement_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7285
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7286
| error ASSIGN expression
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7287
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "invalid variable before ':=' in ST assignment statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7288
| variable ASSIGN error
133
fff75b8283be Some bugs on syntax checking tests fixed
lbessard
parents: 131
diff changeset
  7289
	{$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7290
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined after ':=' in ST assignment statement.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7291
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression after ':=' in ST assignment statement."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7292
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7293
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7294
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7295
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7296
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7297
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7298
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7299
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7300
/*****************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7301
/* 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
  7302
/*****************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7303
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
  7304
  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
  7305
| 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
  7306
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7307
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7308
return_statement:
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7309
  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
  7310
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7311
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7312
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7313
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7314
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
  7315
  prev_declared_fb_name '(' ')'
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7316
	{$$ = new fb_invocation_c($1, NULL, NULL, locloc(@$));	}
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7317
| 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
  7318
	{$$ = new fb_invocation_c($1, $3, NULL, locloc(@$));}
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7319
| 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
  7320
	{$$ = new fb_invocation_c($1, NULL, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7321
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7322
| prev_declared_fb_name ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7323
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function block name in ST statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7324
| prev_declared_fb_name param_assignment_formal_list ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7325
	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function block name in ST statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7326
| prev_declared_fb_name '(' error ')'
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7327
	{$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid parameter list in function block invocation in ST statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7328
| prev_declared_fb_name '(' error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7329
	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing after parameter list of function block invocation in ST statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7330
| prev_declared_fb_name '(' param_assignment_formal_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7331
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after parameter list of function block invocation in ST statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7332
| prev_declared_fb_name '(' param_assignment_nonformal_list error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7333
	{$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after parameter list of function block invocation in ST statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7334
/* ERROR_CHECK_END */
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7338
/* 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
  7339
 * - 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
  7340
 * - 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
  7341
 */
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7342
param_assignment_formal_list:
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7343
  param_assignment_formal
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7344
	{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);}
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7345
| 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
  7346
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7347
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7348
| param_assignment_formal_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  7349
  {$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7350
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no parameter assignment defined in ST parameter assignment list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7351
	 else {print_err_msg(locf(@3), locl(@3), "invalid parameter assignment in ST parameter assignment list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7352
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7353
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7354
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7355
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7356
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7357
/* helper symbol for
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7358
 * - fb_invocation
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7359
 * - function_invocation
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7360
 */
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7361
param_assignment_nonformal_list:
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7362
  param_assignment_nonformal
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7363
	{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);}
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7364
| param_assignment_nonformal_list ',' param_assignment_nonformal
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7365
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7366
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7367
| param_assignment_nonformal_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  7368
  {$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7369
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no parameter assignment defined in ST parameter assignment list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7370
	 else {print_err_msg(locf(@3), locl(@3), "invalid parameter assignment in ST parameter assignment list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7371
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7372
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7373
/* ERROR_CHECK_END */
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7374
;
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7375
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7376
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7377
/* NOTE: According to the IEC 61131-3 standard, there are two possible
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7378
 *       syntaxes for calling function blocks within ST.
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7379
 *       The formal method has the form:
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7380
 *        fb ( invar := x, inoutvar := var1, outvar => var2);
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7381
 *       The non-formal method has the form:
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7382
 *        fb (x, var1, var2);
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7383
 *       In the text of IEC 61131-3 (where the semantics are defined),
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7384
 *       it is obvious that mixing the two syntaxes is considered incorrect.
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7385
 *       The following should therefore be incorrect: 
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7386
 *        fb ( invar := x, var1, var2);
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7387
 *       However, according to the syntax definition, as defined in IEC 61131-3,
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7388
 *       mixing the formal and non-formal methods of invocation is allowed.
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7389
 *       We have two alternatives:
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7390
 *        (a) implement the syntax here in iec.y according to the standard,
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7391
 *            and leave it to the semantic analyser stage to find this error
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7392
 *        (b) or implement the syntax in iec.y correctly, not allowing 
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7393
 *            the mixing of formal and non-formal invocation syntaxes.
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7394
 *       Considering that this is a syntax issue, and not semantic issue,
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7395
 *       I (Mario) have decided to go with alternative (a).
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7396
 *       In other words, in iec.y we do not follow the syntax as defined in
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7397
 *       Annex B of the IEC 61131-3 standard, but rather implement
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7398
 *       the syntax also taking into account the textual part of the standard too.
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7399
 */
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7400
/*
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7401
param_assignment:
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7402
  variable_name ASSIGN expression 
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7403
*/
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7404
param_assignment_nonformal:
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7405
  expression
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7406
;
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7407
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7408
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7409
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
  7410
  any_identifier ASSIGN expression
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7411
	{$$ = 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
  7412
| en_identifier ASSIGN expression
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7413
	{$$ = 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
  7414
/*| 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
  7415
/*| 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
  7416
| sendto_identifier SENDTO variable
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7417
	{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7418
/* The following is not required, as the sendto_identifier_token returned by flex will 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7419
 * also include the 'ENO' identifier.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7420
 * The resulting abstract syntax tree is identical with or without this following rule,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7421
 * as both the eno_identifier and the sendto_identifier are stored as
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7422
 * an identifier_c !!
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7423
 */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7424
/*
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7425
| eno_identifier SENDTO variable
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7426
	{$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7427
*/
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  7428
/*| 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
  7429
/*| 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
  7430
| NOT sendto_identifier SENDTO variable
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7431
	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7432
/* The following is not required, as the sendto_identifier_token returned by flex will 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7433
 * also include the 'ENO' identifier.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7434
 * The resulting abstract syntax tree is identical with or without this following rule,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7435
 * as both the eno_identifier and the sendto_identifier are stored as
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7436
 * an identifier_c !!
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7437
 */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7438
/*
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7439
| NOT eno_identifier SENDTO variable
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7440
	{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7441
*/
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7442
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7443
| any_identifier ASSIGN error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7444
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7445
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter assignment.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7446
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter assignment."); yyclearin;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7447
	 yyerrok;
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7448
	}
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7449
| en_identifier ASSIGN error
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7450
  {$$ = NULL;
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7451
	 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
  7452
	 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
  7453
	 yyerrok;
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7454
	}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7455
| sendto_identifier SENDTO error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7456
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7457
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7458
	 else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7459
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7460
	}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7461
/*
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7462
| eno_identifier SENDTO error
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7463
  {$$ = NULL;
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7464
	 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
  7465
	 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
  7466
	 yyerrok;
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7467
	}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7468
*/
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7469
| NOT SENDTO variable
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7470
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter name defined in ST formal parameter out negated assignment."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7471
| NOT error SENDTO variable
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7472
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid parameter name defined in ST formal parameter out negated assignment."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7473
| NOT sendto_identifier SENDTO error
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7474
  {$$ = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7475
	 if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7476
	 else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7477
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7478
	}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7479
/*
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7480
| NOT eno_identifier SENDTO error
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7481
  {$$ = NULL;
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7482
	 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
  7483
	 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
  7484
	 yyerrok;
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 142
diff changeset
  7485
	}
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  7486
*/
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7487
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7488
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7489
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
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7495
/* 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
  7496
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7497
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
  7498
  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
  7499
| 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
  7500
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7501
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7502
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7503
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
  7504
  IF expression THEN statement_list elseif_statement_list END_IF
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7505
	{$$ = 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
  7506
| IF expression THEN statement_list elseif_statement_list ELSE statement_list END_IF
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7507
	{$$ = new if_statement_c($2, $4, $5, $7, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7508
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7509
| IF THEN statement_list elseif_statement_list END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7510
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'IF' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7511
| IF THEN statement_list elseif_statement_list ELSE statement_list END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7512
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'IF' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7513
| IF error THEN statement_list elseif_statement_list END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7514
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'IF' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7515
| IF error THEN statement_list elseif_statement_list ELSE statement_list END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7516
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'IF' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7517
| IF expression error statement_list elseif_statement_list END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7518
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'THEN' after test expression in ST 'IF' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7519
| IF expression error statement_list elseif_statement_list ELSE statement_list END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7520
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'THEN' after test expression in ST 'IF' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7521
| IF expression THEN elseif_statement_list END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7522
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "no statement defined after 'THEN' in ST 'IF' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7523
| IF expression THEN elseif_statement_list ELSE statement_list END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7524
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "no statement defined after 'THEN' in ST 'IF' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7525
| IF expression THEN statement_list elseif_statement_list ELSE END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7526
  {$$ = NULL; print_err_msg(locl(@6), locf(@7), "no statement defined after 'ELSE' in ST 'IF' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7527
| IF expression THEN statement_list elseif_statement_list ELSE error END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7528
  {$$ = NULL; print_err_msg(locf(@7), locl(@7), "invalid statement defined after 'ELSE' in ST 'IF' statement."); yynerrs++; yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7529
| IF expression error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7530
  {$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed 'IF' statement in ST."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7531
| IF expression THEN statement_list elseif_statement_list END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7532
  {$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'IF' statement in ST."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7533
| IF expression THEN statement_list elseif_statement_list ELSE statement_list END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7534
  {$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'IF' statement in ST."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7535
| IF error END_IF
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7536
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'IF' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7537
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7538
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7539
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7540
/* 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
  7541
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
  7542
  /* empty */
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7543
	{$$ = 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
  7544
| 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
  7545
	{$$ = $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
  7546
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7547
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7548
/* 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
  7549
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
  7550
  ELSIF expression THEN statement_list
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7551
	{$$ = new elseif_statement_c($2, $4, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7552
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7553
| ELSIF THEN statement_list
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7554
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined for 'ELSEIF' statement in ST 'IF' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7555
| ELSIF error THEN statement_list
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7556
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for 'ELSEIF' statement in ST 'IF' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7557
| ELSIF expression error statement_list
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7558
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'THEN' after test expression in 'ELSEIF' statement of ST 'IF' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7559
| ELSIF expression THEN error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7560
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid statement list in 'ELSEIF' statement of ST 'IF' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7561
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7562
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7563
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7564
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7565
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
  7566
  CASE expression OF case_element_list END_CASE
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7567
	{$$ = 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
  7568
| CASE expression OF case_element_list ELSE statement_list END_CASE
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7569
	{$$ = new case_statement_c($2, $4, $6, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7570
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7571
| CASE OF case_element_list END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7572
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'CASE' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7573
| CASE OF case_element_list ELSE statement_list END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7574
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'CASE' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7575
| CASE error OF case_element_list END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7576
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'CASE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7577
| CASE error OF case_element_list ELSE statement_list END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7578
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'CASE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7579
| CASE expression error case_element_list END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7580
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'OF' after test expression in ST 'CASE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7581
| CASE expression error case_element_list ELSE statement_list END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7582
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'OF' after test expression in ST 'CASE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7583
| CASE expression OF END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7584
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "no case element(s) defined after 'OF' in ST 'CASE' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7585
| CASE expression OF ELSE statement_list END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7586
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "no case element(s) defined after 'OF' in ST 'CASE' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7587
| CASE expression OF error END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7588
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid case element(s) defined after 'OF' in ST 'CASE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7589
| CASE expression OF error ELSE statement_list END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7590
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid case element(s) defined after 'OF' in ST 'CASE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7591
| CASE expression OF case_element_list ELSE END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7592
  {$$ = NULL; print_err_msg(locl(@5), locf(@6), "no statement defined after 'ELSE' in ST 'CASE' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7593
| CASE expression OF case_element_list ELSE error END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7594
  {$$ = NULL; print_err_msg(locf(@6), locl(@6), "invalid statement defined after 'ELSE' in ST 'CASE' statement."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7595
| CASE expression error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7596
  {$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed 'CASE' statement in ST."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7597
| CASE expression OF case_element_list END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7598
  {$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'CASE' statement in ST."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7599
| CASE expression OF case_element_list ELSE statement_list END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7600
  {$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed 'CASE' statement in ST."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7601
| CASE error END_CASE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7602
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'CASE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7603
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7604
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7605
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7606
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7607
/* 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
  7608
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
  7609
  case_element
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7610
	{$$ = 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
  7611
| 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
  7612
	{$$ = $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
  7613
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7614
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7615
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7616
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
  7617
  case_list ':' statement_list
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7618
	{$$ = new case_element_c($1, $3, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7619
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7620
| case_list statement_list
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7621
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing after case list in ST 'CASE' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7622
| case_list ':' error
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7623
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid statement in case element of ST 'CASE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7624
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7625
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7626
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7627
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7628
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
  7629
  case_list_element
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7630
	{$$ = 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
  7631
| 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
  7632
	{$$ = $1; $$->add_element($3);}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7633
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7634
| case_list ',' error
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  7635
  {$$ = $1;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7636
	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no case defined in case list of ST parameter assignment list.");}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7637
	 else {print_err_msg(locf(@3), locl(@3), "invalid case in case list of ST parameter assignment list."); yyclearin;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7638
	 yyerrok;
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7639
	}
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7640
/* ERROR_CHECK_END */
0
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7644
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
  7645
  signed_integer
78
aead91ec37cd removing 'identifier' from definition of symbolic_variable
mario
parents: 77
diff changeset
  7646
| 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
  7647
| 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
  7648
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7649
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7650
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7651
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7652
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7653
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7654
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7655
/* 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
  7656
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7657
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
  7658
  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
  7659
| 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
  7660
| 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
  7661
| 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
  7662
;
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
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
  7666
  FOR control_variable ASSIGN expression TO expression BY expression DO statement_list END_FOR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7667
	{$$ = 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
  7668
| FOR control_variable ASSIGN expression TO expression DO statement_list END_FOR
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7669
	{$$ = new for_statement_c($2, $4, $6, NULL, $8, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7670
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7671
| FOR ASSIGN expression TO expression BY expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7672
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no control variable defined in ST 'FOR' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7673
| FOR ASSIGN expression TO expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7674
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no control variable defined in ST 'FOR' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7675
| FOR error ASSIGN expression TO expression BY expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7676
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid control variable defined for ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7677
| FOR error ASSIGN expression TO expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7678
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid control variable defined for ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7679
| FOR control_variable expression TO expression BY expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7680
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "':=' missing between control variable and start expression in ST 'FOR' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7681
| FOR control_variable expression TO expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7682
  {$$ = NULL; print_err_msg(locl(@2), locf(@3), "':=' missing between control variable and start expression in ST 'FOR' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7683
| FOR control_variable error expression TO expression BY expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7684
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting ':=' between control variable and start expression in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7685
| FOR control_variable error expression TO expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7686
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting ':=' between control variable and start expression in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7687
| FOR control_variable ASSIGN TO expression BY expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7688
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "no start expression defined in ST 'FOR' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7689
| FOR control_variable ASSIGN TO expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7690
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "no start expression defined in ST 'FOR' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7691
| FOR control_variable ASSIGN error TO expression BY expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7692
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid start expression defined in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7693
| FOR control_variable ASSIGN error TO expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7694
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid start expression in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7695
| FOR control_variable ASSIGN expression error expression BY expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7696
  {$$ = NULL; print_err_msg(locf(@5), locl(@5), "expecting 'TO' between start expression and end expression in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7697
| FOR control_variable ASSIGN expression error expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7698
  {$$ = NULL; print_err_msg(locf(@5), locl(@5), "expecting 'TO' between start expression and end expression in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7699
| FOR control_variable ASSIGN expression TO expression error expression DO statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7700
  {$$ = NULL; print_err_msg(locf(@7), locl(@7), "expecting 'BY' between end expression and step expression in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7701
| FOR control_variable ASSIGN expression TO expression BY expression error statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7702
  {$$ = NULL; print_err_msg(locf(@9), locl(@9), "expecting 'DO' after step expression in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7703
| FOR control_variable ASSIGN expression TO expression error statement_list END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7704
  {$$ = NULL; print_err_msg(locf(@7), locl(@7), "expecting 'DO' after end expression in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7705
| FOR control_variable ASSIGN expression TO expression BY expression DO END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7706
  {$$ = NULL; print_err_msg(locl(@9), locf(@10), "no statement(s) defined after 'DO' in ST 'FOR' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7707
| FOR control_variable ASSIGN expression TO expression DO END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7708
  {$$ = NULL; print_err_msg(locl(@7), locf(@8), "no statement(s) defined after 'DO' in ST 'FOR' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7709
| FOR control_variable ASSIGN expression TO expression BY expression DO error END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7710
  {$$ = NULL; print_err_msg(locf(@10), locl(@10), "invalid statement(s) defined after 'DO' in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7711
| FOR control_variable ASSIGN expression TO expression DO error END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7712
  {$$ = NULL; print_err_msg(locf(@8), locl(@8), "invalid statement(s) defined after 'DO' in ST 'FOR' statement."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7713
| FOR control_variable error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7714
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7715
| FOR control_variable ASSIGN expression error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7716
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7717
| FOR control_variable ASSIGN expression TO expression DO statement_list END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7718
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7719
| FOR control_variable ASSIGN expression TO expression BY expression error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7720
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'FOR' statement in ST."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7721
| FOR control_variable ASSIGN expression TO expression BY expression DO statement_list END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7722
  {$$ = 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
  7723
| FOR error END_FOR
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7724
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'FOR' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7725
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7726
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7727
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7728
/* 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
  7729
 * 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
  7730
 * 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
  7731
 * (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
  7732
 * (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
  7733
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7734
 * 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
  7735
 * must have been declared in some VAR .. END_VAR
79
7417b346e5a3 fixing buf in FOR control variable.
mario
parents: 78
diff changeset
  7736
 * 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
  7737
 * control_variable: prev_declared_variable_name;
13
77174ccc5471 Many major changes to support SFC!
mario
parents: 10
diff changeset
  7738
 * 
79
7417b346e5a3 fixing buf in FOR control variable.
mario
parents: 78
diff changeset
  7739
 * If we don't, then the correct use of any previosuly declared 
7417b346e5a3 fixing buf in FOR control variable.
mario
parents: 78
diff changeset
  7740
 * 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
  7741
*/
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7742
control_variable: 
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7743
  prev_declared_variable_name 
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7744
	{$$ = new symbolic_variable_c($1,locloc(@$));};
79
7417b346e5a3 fixing buf in FOR control variable.
mario
parents: 78
diff changeset
  7745
// 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
  7746
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7747
/* 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
  7748
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7749
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
  7750
  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
  7751
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7752
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7753
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7754
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7755
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
  7756
  WHILE expression DO statement_list END_WHILE
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7757
	{$$ = new while_statement_c($2, $4, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7758
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7759
| WHILE DO statement_list END_WHILE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7760
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no test expression defined in ST 'WHILE' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7761
| WHILE error DO statement_list END_WHILE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7762
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid test expression defined for ST 'WHILE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7763
| WHILE expression error statement_list END_WHILE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7764
  {$$ = NULL; print_err_msg(locf(@3), locl(@3), "expecting 'DO' after test expression in ST 'WHILE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7765
| WHILE expression DO END_WHILE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7766
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "no statement(s) defined after 'DO' in ST 'WHILE' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7767
| WHILE expression DO error END_WHILE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7768
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid statement(s) defined after 'DO' in ST 'WHILE' statement."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7769
| WHILE expression error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7770
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'WHILE' statement in ST."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7771
| WHILE expression DO statement_list END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7772
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'WHILE' statement in ST."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7773
| WHILE error END_WHILE
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7774
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'WHILE' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7775
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7776
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7777
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7778
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7779
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
  7780
  REPEAT statement_list UNTIL expression END_REPEAT
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7781
	{$$ = new repeat_statement_c($2, $4, locloc(@$));}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7782
/* ERROR_CHECK_BEGIN */
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7783
| REPEAT UNTIL expression END_REPEAT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7784
  {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no statement(s) defined after 'REPEAT' in ST 'REPEAT' statement."); yynerrs++;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7785
| REPEAT error UNTIL expression END_REPEAT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7786
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid statement(s) defined after 'REPEAT' for ST 'REPEAT' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7787
| REPEAT statement_list UNTIL END_REPEAT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7788
  {$$ = NULL; print_err_msg(locl(@3), locf(@4), "no test expression defined after 'UNTIL' in ST 'REPEAT' statement.");}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7789
| REPEAT statement_list UNTIL error END_REPEAT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7790
  {$$ = NULL; print_err_msg(locf(@4), locl(@4), "invalid test expression defined after 'UNTIL' in ST 'REPEAT' statement."); yyerrok;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7791
| REPEAT statement_list END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7792
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'REPEAT' statement in ST."); yynerrs++;}
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7793
| REPEAT statement_list UNTIL expression error END_OF_INPUT
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7794
  {$$ = NULL; print_err_msg(locf(@1), locl(@1), "unclosed 'REPEAT' statement in ST."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7795
| REPEAT error END_REPEAT
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7796
  {$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in ST 'REPEAT' statement."); yyerrok;}
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7797
/* ERROR_CHECK_END */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7798
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7799
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7800
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7801
exit_statement:
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7802
  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
  7803
;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7804
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7805
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7806
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
%%
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7810
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7811
#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
  7812
#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
  7813
#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
  7814
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7815
/* variables defined in code 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
  7816
extern FILE *yyin;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7817
extern int yylineno;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7818
extern tracking_t* current_tracking;
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7819
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7820
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7821
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7822
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7823
/*************************************************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7824
/* 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
  7825
/*       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
  7826
/*       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
  7827
/*       option is to use global variables! yuck!                                                */ 
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7828
/*************************************************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7829
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7830
/* 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
  7831
 * 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
  7832
 * but disallows them in user code...
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7833
 *
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7834
 * 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
  7835
 * 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
  7836
 */
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7837
bool allow_function_overloading = false;
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7838
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7839
/* A global flag used to tell the parser whether to include the full variable location
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7840
 * when printing out error messages...
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7841
 */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7842
bool full_token_loc;
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  7843
15
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7844
/* A pointer to the root of the parsing tree that will be generated 
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7845
 * by bison.
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7846
 */
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7847
symbol_c *tree_root;
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7848
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7849
0b472e25eb16 Adding changes to make the compiler compatible with bison ver 2.3
mario
parents: 13
diff changeset
  7850
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7851
/* 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
  7852
 * 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
  7853
 * 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
  7854
 * 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
  7855
 * 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
  7856
 * 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
  7857
 * (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
  7858
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7859
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
  7860
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
  7861
  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
  7862
/* fprintf(stderr, "error %d: %s\n", yynerrs // global variable //, error_msg); */
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7863
/*  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
  7864
}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7865
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7866
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7867
/* ERROR_CHECK_BEGIN */
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7868
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
  7869
  switch (yychar) {
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7870
    case ';':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7871
    case ',':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7872
    case ')':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7873
    case ']':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7874
    case '+':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7875
    case '*':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7876
    case '-':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7877
    case '/':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7878
    case '<':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7879
    case '>':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7880
    case '=':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7881
    case '&':
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7882
    case OR:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7883
    case XOR:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7884
    case AND:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7885
    case AND2:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7886
    case OPER_NE:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7887
    case OPER_LE:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7888
    case OPER_GE:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7889
    case MOD:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7890
    case OPER_EXP:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7891
    case NOT:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7892
      return true;
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7893
    default:
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7894
     return false;
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7895
  }
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7896
}
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7897
/* ERROR_CHECK_END */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7898
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7899
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7900
void print_err_msg(int first_line,
95
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
  7901
                   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
  7902
                   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
  7903
                   long int first_order,
95
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
  7904
                   int last_line,
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
  7905
                   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
  7906
                   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
  7907
                   long int last_order,
95
b119b1db0a7a Changing format of error reporting.
mario
parents: 94
diff changeset
  7908
                   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
  7909
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  7910
  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
  7911
  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
  7912
  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
  7913
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  7914
  if (full_token_loc) {
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  7915
    if (first_filename == last_filename)
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  7916
      fprintf(stderr, "%s:%d-%d..%d-%d: error : %s\n", first_filename, first_line, first_column, last_line, last_column, additional_error_msg);
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  7917
    else
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  7918
      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);
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  7919
  } else {
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  7920
      fprintf(stderr, "%s:%d: error : %s\n", first_filename, first_line, additional_error_msg);
a4f4990d5c66 Adding tracking of filename in which token is located.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  7921
  }
131
f55ef301e14c Adding some human-readable error messages
lbessard
parents: 121
diff changeset
  7922
  //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
  7923
  print_include_stack();
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  7924
  //fprintf(stderr, "%s(%d-%d): %s\n", current_filename, first_line, last_line, current_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
  7925
}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7926
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7927
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7928
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7929
/* 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
  7930
/* 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
  7931
 * 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
  7932
 * 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
  7933
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7934
#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
  7935
  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
  7936
  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
  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
/* 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
  7940
 *       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
  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
symbol_c *il_operator_c_2_identifier_c(symbol_c *il_operator) {
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  7943
  const char *name = NULL;
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  7944
  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
  7945
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7946
  op_2_str(NOT,   "NOT");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7947
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7948
  op_2_str(AND,   "AND");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7949
  op_2_str(OR,    "OR");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7950
  op_2_str(XOR,   "XOR");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7951
  op_2_str(ADD,   "ADD");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7952
  op_2_str(SUB,   "SUB");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7953
  op_2_str(MUL,   "MUL");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7954
  op_2_str(DIV,   "DIV");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7955
  op_2_str(MOD,   "MOD");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7956
  op_2_str(GT,    "GT");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7957
  op_2_str(GE,    "GE");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7958
  op_2_str(EQ,    "EQ");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7959
  op_2_str(LT,    "LT");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7960
  op_2_str(LE,    "LE");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7961
  op_2_str(NE,    "NE");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7962
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7963
  op_2_str(LD,    "LD");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7964
  op_2_str(LDN,   "LDN");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7965
  op_2_str(ST,    "ST");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7966
  op_2_str(STN,   "STN");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7967
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7968
  op_2_str(S,     "S");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7969
  op_2_str(R,     "R");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7970
  op_2_str(S1,    "S1");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7971
  op_2_str(R1,    "R1");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7972
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7973
  op_2_str(CLK,   "CLK");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7974
  op_2_str(CU,    "CU");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7975
  op_2_str(CD,    "CD");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7976
  op_2_str(PV,    "PV");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7977
  op_2_str(IN,    "IN");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7978
  op_2_str(PT,    "PT");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7979
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7980
  op_2_str(ANDN,  "ANDN");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7981
  op_2_str(ORN,   "ORN");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7982
  op_2_str(XORN,  "XORN");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7983
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7984
  op_2_str(ADD,   "ADD");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7985
  op_2_str(SUB,   "SUB");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7986
  op_2_str(MUL,   "MUL");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7987
  op_2_str(DIV,   "DIV");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7988
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7989
  op_2_str(GT,    "GT");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7990
  op_2_str(GE,    "GE");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7991
  op_2_str(EQ,    "EQ");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7992
  op_2_str(LT,    "LT");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7993
  op_2_str(LE,    "LE");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7994
  op_2_str(NE,    "NE");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7995
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7996
  op_2_str(CAL,   "CAL");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  7997
  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
  7998
  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
  7999
  op_2_str(RET,   "RET");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  8000
  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
  8001
  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
  8002
  op_2_str(JMP,   "JMP");
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 193
diff changeset
  8003
  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
  8004
  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
  8005
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8006
  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
  8007
    ERROR;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8008
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  8009
  res = new identifier_c(strdup(name), 
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  8010
                         il_operator->first_line,
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  8011
                         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
  8012
                         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
  8013
                         il_operator->first_order,
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  8014
                         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
  8015
                         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
  8016
                         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
  8017
                         il_operator->last_order
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  8018
                        );
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8019
  free(il_operator);
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  8020
  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
  8021
}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8022
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8023
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
  8024
#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
  8025
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8026
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
  8027
// 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
  8028
//   Table 34 - Standard bistable function blocks
73
0e623bbdee95 fixing infinite error loops at library level, and ...
mario
parents: 68
diff changeset
  8029
"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
  8030
// 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
  8031
//   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
  8032
"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
  8033
// 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
  8034
//   Table 36 - Standard counter function blocks
68
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  8035
"CTU","CTU_DINT","CTU_LINT","CTU_UDINT","CTU_ULINT",
b0a43002dcac Adding basic error checking.
mario
parents: 52
diff changeset
  8036
"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
  8037
"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
  8038
// 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
  8039
//   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
  8040
"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
  8041
/* 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
  8042
NULL
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8043
};
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8044
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8045
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8046
#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
  8047
#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
  8048
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
  8049
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
  8050
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  8051
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  8052
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  8053
int stage2__(const char *filename, 
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  8054
             const char *includedir,     /* Include directory, where included files will be searched for... */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  8055
             symbol_c **tree_root_ref,
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  8056
             bool full_token_loc_        /* error messages specify full token location */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  8057
            ) {
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  8058
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8059
  FILE *in_file = NULL, *lib_file = NULL;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8060
  char *libfilename = NULL;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  8061
	
278
050d31dd7c74 Merged matiec library headers update from Mario to LGPL
Edouard Tisserant
parents: 275
diff changeset
  8062
  for(int i = 0; standard_function_names[i] != NULL; i++)
050d31dd7c74 Merged matiec library headers update from Mario to LGPL
Edouard Tisserant
parents: 275
diff changeset
  8063
    if (library_element_symtable.find_value(standard_function_names[i]) ==
050d31dd7c74 Merged matiec library headers update from Mario to LGPL
Edouard Tisserant
parents: 275
diff changeset
  8064
        library_element_symtable.end_value())
050d31dd7c74 Merged matiec library headers update from Mario to LGPL
Edouard Tisserant
parents: 275
diff changeset
  8065
      library_element_symtable.insert(standard_function_names[i], standard_function_name_token);
050d31dd7c74 Merged matiec library headers update from Mario to LGPL
Edouard Tisserant
parents: 275
diff changeset
  8066
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8067
  if((in_file = fopen(filename, "r")) == NULL) {
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8068
    char *errmsg = strdup2("Error opening main file ", filename);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8069
    perror(errmsg);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8070
    free(errmsg);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8071
    return -1;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8072
  }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8073
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8074
  if (includedir != NULL) {
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents: 28
diff changeset
  8075
    INCLUDE_DIRECTORIES[0] = includedir;
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8076
  }
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
  8077
  if ((libfilename = strdup3(INCLUDE_DIRECTORIES[0], "/", LIBFILE)) == NULL) {
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
  8078
    fprintf (stderr, "Out of memory. Bailing out!\n");
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
  8079
    return -1;
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
  8080
  }
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
  8081
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
  8082
  if((lib_file = fopen(libfilename, "r")) == NULL) {
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
  8083
    char *errmsg = strdup2("Error opening library file ", libfilename);
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
  8084
    perror(errmsg);
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
  8085
    free(errmsg);
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8086
  }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8087
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8088
  if (lib_file == NULL) {
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8089
    /* we give up... */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8090
    free(libfilename);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8091
    fclose(in_file);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8092
    return -1;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8093
  }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8094
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8095
  /* first parse the standard library file... */
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  8096
  /*
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  8097
  #if YYDEBUG
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  8098
    yydebug = 1;
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  8099
  #endif
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  8100
  */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8101
  yyin = lib_file;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8102
  allow_function_overloading = true;
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  8103
  full_token_loc = full_token_loc_;
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8104
  current_filename = libfilename;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  8105
  current_tracking = GetNewTracking(yyin);
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8106
  if (yyparse() != 0)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8107
      ERROR;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8108
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8109
  if (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
  8110
    fprintf (stderr, "\nFound %d error(s) in %s. Bailing out!\n", yynerrs /* global variable */, libfilename);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8111
    ERROR;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8112
  }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8113
  free(libfilename);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8114
  fclose(lib_file);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8115
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8116
  /* if by any chance the library is not complete, we
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8117
   * now add the missing reserved keywords to the list!!!
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8118
   */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8119
  for(int i = 0; standard_function_block_names[i] != NULL; i++)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8120
    if (library_element_symtable.find_value(standard_function_block_names[i]) ==
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8121
        library_element_symtable.end_value())
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8122
      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
  8123
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8124
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8125
  /* now parse the input file... */
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  8126
  #if YYDEBUG
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  8127
    yydebug = 1;
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
  8128
  #endif
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8129
  yyin = in_file;
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8130
  allow_function_overloading = false;
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 175
diff changeset
  8131
  full_token_loc = full_token_loc_;
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8132
  current_filename = filename;
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  8133
  current_tracking = GetNewTracking(yyin);
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  8134
  {int res;
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  8135
    if ((res = yyparse()) != 0) {
136
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  8136
      fprintf (stderr, "\nParsing failed because of too many consecutive syntax errors. Bailing out!\n");
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  8137
  		exit(EXIT_FAILURE);
32bd7ef40897 Adding some improvements:
lbessard
parents: 134
diff changeset
  8138
  	}
85
a6e651ba55c2 Fixing handling of enumeration values;
mario
parents: 79
diff changeset
  8139
  }
0
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
  if (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
  8142
    fprintf (stderr, "\nFound %d error(s). Bailing out!\n", yynerrs /* global variable */);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8143
    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
  8144
  }
134
0e43c556cd2d Fixed some uncatched errors and error bounds in error messages
lbessard
parents: 133
diff changeset
  8145
  
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8146
  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
  8147
    *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
  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
  fclose(in_file);
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8150
  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
  8151
}
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8152
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8153
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  8154