absyntax/absyntax.def
author Mario de Sousa <msousa@fe.up.pt>
Thu, 22 Nov 2012 18:53:37 +0000
changeset 738 e47cc8c954db
parent 690 6156ee2b4e32
child 805 b737cfc92614
permissions -rw-r--r--
Start to move enumeration declaration checking to its own class.
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
     1
/*
261
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
     3
 *  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: 267
diff changeset
     4
 *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
261
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
     5
 *
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
     6
 *  This program is free software: you can redistribute it and/or modify
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
     7
 *  it under the terms of the GNU General Public License as published by
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
     8
 *  the Free Software Foundation, either version 3 of the License, or
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
     9
 *  (at your option) any later version.
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    10
 *
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    11
 *  This program is distributed in the hope that it will be useful,
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    14
 *  GNU General Public License for more details.
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    15
 *
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    16
 *  You should have received a copy of the GNU General Public License
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    17
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    18
 *
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    19
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    20
 * 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
    21
 * 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
    22
 */
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
/*
261
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    25
 * 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
    26
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    27
 * 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
    28
 * 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
    29
 *
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
261
db2ad6541d92 Updating licensing information.
Mario de Sousa <msousa@fe.up.pt>
parents: 257
diff changeset
    32
0
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
 * Definition of the Abstract Syntax data structure components
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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    38
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    39
 * ABSYNTAX.DEF
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    40
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    41
 * This generates the parse tree structure used to bind the components
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    42
 * identified by Bison in the correct syntax order. At the end 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
    43
 * Bison analysis the tree is walked in a sequential fashion generating
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    44
 * the relavent code.
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
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    48
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    49
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    50
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    51
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    52
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    53
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    54
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    55
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    56
/*                                                               */
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
    57
/*      safe<xxxxxx> Symbols are defined in:                     */
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    58
/*      PLCopen - Technical Committee 5                          */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    59
/*      Safety Software Technical Specification,                 */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    60
/*      Part 1: Concepts and Function Blocks,                    */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    61
/*      Version 1.0 – Official Release - 2006-01-31              */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    62
/*                                                               */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    63
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    64
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    65
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    66
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    67
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    68
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    69
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    70
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    71
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    72
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    73
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    74
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    75
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    76
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    77
/*                                                               */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    78
/*             Symbols defined in:                               */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    79
/*      FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)          */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    80
/*                                                               */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    81
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    82
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    83
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    84
/*****************************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    85
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    86
/* Based on the                                    */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    87
/* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    88
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents: 152
diff changeset
    89
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 118
diff changeset
    90
/* EN/ENO */
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
    91
/* NOTE we store 'EN' and 'ENO' tokens in an identifier_c
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
    92
 *      as they may be used as variables, and it is much easier 
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
    93
 *      to handle them (fewer special cases) if we do it that way...
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
    94
 */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
    95
/*
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 118
diff changeset
    96
SYM_REF0(en_param_c)
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 118
diff changeset
    97
SYM_REF0(eno_param_c)
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
    98
*/
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 118
diff changeset
    99
459
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 457
diff changeset
   100
/* A class used to identify an entry (literal, variable, etc...) in the abstract syntax tree with an invalid data type */
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 457
diff changeset
   101
/* This is only used from stage3 onwards. Stages 1 and 2 will never create any instances of invalid_type_name_c */
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 457
diff changeset
   102
SYM_REF0(invalid_type_name_c)
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 457
diff changeset
   103
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 457
diff changeset
   104
01f6664bf8c5 Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents: 457
diff changeset
   105
267
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 261
diff changeset
   106
/********************/
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 261
diff changeset
   107
/* 2.1.6 - Pragmas  */
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 261
diff changeset
   108
/********************/
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 261
diff changeset
   109
SYM_REF0(disable_code_generation_pragma_c)
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 261
diff changeset
   110
SYM_REF0(enable_code_generation_pragma_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
   111
SYM_TOKEN(pragma_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   112
267
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 261
diff changeset
   113
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   114
/***************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   115
/* 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
   116
/***************************/
738
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   117
/* enumvalue_symtable is filled in by enum_declaration_check_c, during stage3 semantic verification, with a list of all enumerated constants declared inside this POU */
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   118
SYM_LIST(library_c, enumvalue_symtable_t enumvalue_symtable;)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   119
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   120
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   121
/*************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   122
/* B.1 - Common elements */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   123
/*************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   124
/*******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   125
/* 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
   126
/*******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   127
SYM_TOKEN(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
   128
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   129
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   130
/*********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   131
/* 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
   132
/*********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   133
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   134
/******************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   135
/* 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
   136
/******************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   137
SYM_TOKEN(real_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   138
SYM_TOKEN(integer_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   139
SYM_TOKEN(binary_integer_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   140
SYM_TOKEN(octal_integer_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   141
SYM_TOKEN(hex_integer_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   142
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   143
/* Note:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   144
 * We do not have signed_integer_c and signed_real_c classes.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   145
 * These are stored in the parse tree as a integer_c or real_c
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   146
 * preceded by a unary minus operator if they are inside an expression,
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   147
 * or a neg_integer_c and neg_real_c when used outside an ST 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
   148
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   149
/* 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
   150
SYM_TOKEN(signed_integer_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   151
SYM_TOKEN(signed_real_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   152
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   153
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   154
/* NOTE: literal __values__ are stored directly in classes such as:
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   155
 *          - real_c
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   156
 *          - integer_c
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   157
 *          - binary_integer_c
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   158
 *          - etc...
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   159
 *
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   160
 *       However, for both the real_c and the integer_c, if they are preceded 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   161
 *       by a '-' negation sign, they are further encapsulated inside 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   162
 *       a neg_literal_c (i.e. the neg_literal_c will point to the 
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   163
 *       real_c or integer_c with the value being negated.
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   164
 *          neg_literal_c -> integer_literal_c
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   165
 *                OR
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   166
 *          neg_literal_c -> real_literal_c
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   167
 *
471
da650a87662d Bringing comment up to date.
Mario de Sousa <msousa@fe.up.pt>
parents: 459
diff changeset
   168
 *       However, this has since been changed to...
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   169
 *        - replace the neg_literal_c with two distinc classes
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   170
 *              (neg_integer_c and neg_real_c), one for each
471
da650a87662d Bringing comment up to date.
Mario de Sousa <msousa@fe.up.pt>
parents: 459
diff changeset
   171
 *              lietral type. 
da650a87662d Bringing comment up to date.
Mario de Sousa <msousa@fe.up.pt>
parents: 459
diff changeset
   172
 *
da650a87662d Bringing comment up to date.
Mario de Sousa <msousa@fe.up.pt>
parents: 459
diff changeset
   173
 *       This change was done in order to ease the writing of semantic verification (stage3) code.
da650a87662d Bringing comment up to date.
Mario de Sousa <msousa@fe.up.pt>
parents: 459
diff changeset
   174
 *       However, that version of the code has since been replaced by a newer and better algoritm.
da650a87662d Bringing comment up to date.
Mario de Sousa <msousa@fe.up.pt>
parents: 459
diff changeset
   175
 *       This means the above change can now be undone, but there is really no need to undo it,
da650a87662d Bringing comment up to date.
Mario de Sousa <msousa@fe.up.pt>
parents: 459
diff changeset
   176
 *       so we leave it as it is.
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   177
 */  
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   178
SYM_REF1(neg_real_c, exp)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   179
SYM_REF1(neg_integer_c, exp)
118
d4cf7ea933a4 Problem with negated literals while compiling generated C file on 32bits systems fixed
lbessard
parents: 97
diff changeset
   180
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   181
/* Not 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
   182
SYM_REF2(numeric_literal_c, type, value)
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   183
*/
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   184
SYM_REF2(integer_literal_c, type, value)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   185
SYM_REF2(real_literal_c, type, value)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   186
SYM_REF2(bit_string_literal_c, type, value)
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   187
/* A typed or untyped boolean literal... */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   188
/* type may be NULL */
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   189
SYM_REF2(boolean_literal_c, type, value)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   190
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   191
/* helper class for boolean_literal_c */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   192
SYM_REF0(boolean_true_c)
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
/* helper class for boolean_literal_c */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   195
SYM_REF0(boolean_false_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   196
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
/*******************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   199
/* 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
   200
/*******************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   201
SYM_TOKEN(double_byte_character_string_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   202
SYM_TOKEN(single_byte_character_string_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   203
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   204
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   205
/***************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   206
/* 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
   207
/***************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   208
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   209
/************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   210
/* 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
   211
/************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   212
SYM_REF0(neg_time_c)
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   213
SYM_REF3(duration_c, type_name, neg, interval)
547
dab341e80664 Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents: 498
diff changeset
   214
SYM_REF5(interval_c, days, hours, minutes, seconds, milliseconds)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   215
SYM_TOKEN(fixed_point_c)
547
dab341e80664 Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents: 498
diff changeset
   216
/*
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   217
SYM_REF2(days_c, days, hours)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   218
SYM_REF2(hours_c, hours, minutes)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   219
SYM_REF2(minutes_c, minutes, seconds)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   220
SYM_REF2(seconds_c, seconds, milliseconds)
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   221
SYM_REF1(milliseconds_c, milliseconds)
547
dab341e80664 Fix parsing os TIME literals & rename the extract_integer() function.
mjsousa <msousa@fe.up.pt>
parents: 498
diff changeset
   222
*/
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   223
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   224
/************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   225
/* 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
   226
/************************************/
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   227
SYM_REF2(time_of_day_c, type_name, daytime)
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   228
SYM_REF3(daytime_c, day_hour, day_minute, day_second)
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   229
SYM_REF2(date_c, type_name, date_literal)
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   230
SYM_REF3(date_literal_c, year, month, day)
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   231
SYM_REF3(date_and_time_c, type_name, date_literal, daytime)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   232
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   233
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   234
/**********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   235
/* 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
   236
/**********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   237
/***********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   238
/* 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
   239
/***********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   240
SYM_REF0(time_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   241
SYM_REF0(bool_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   242
SYM_REF0(sint_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   243
SYM_REF0(int_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   244
SYM_REF0(dint_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   245
SYM_REF0(lint_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   246
SYM_REF0(usint_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   247
SYM_REF0(uint_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   248
SYM_REF0(udint_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   249
SYM_REF0(ulint_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   250
SYM_REF0(real_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   251
SYM_REF0(lreal_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   252
SYM_REF0(date_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   253
SYM_REF0(tod_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   254
SYM_REF0(dt_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   255
SYM_REF0(byte_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   256
SYM_REF0(word_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   257
SYM_REF0(dword_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   258
SYM_REF0(lword_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   259
SYM_REF0(string_type_name_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   260
SYM_REF0(wstring_type_name_c)
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   261
257
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   262
  /*****************************************************************/
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   263
  /* Keywords defined in "Safety Software Technical Specification" */
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   264
  /*****************************************************************/
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   265
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   266
SYM_REF0(safetime_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   267
SYM_REF0(safebool_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   268
SYM_REF0(safesint_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   269
SYM_REF0(safeint_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   270
SYM_REF0(safedint_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   271
SYM_REF0(safelint_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   272
SYM_REF0(safeusint_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   273
SYM_REF0(safeuint_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   274
SYM_REF0(safeudint_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   275
SYM_REF0(safeulint_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   276
SYM_REF0(safereal_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   277
SYM_REF0(safelreal_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   278
SYM_REF0(safedate_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   279
SYM_REF0(safetod_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   280
SYM_REF0(safedt_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   281
SYM_REF0(safebyte_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   282
SYM_REF0(safeword_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   283
SYM_REF0(safedword_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   284
SYM_REF0(safelword_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   285
SYM_REF0(safestring_type_name_c)
90782e241346 Huge change.
Mario de Sousa <msousa@fe.up.pt>
parents: 202
diff changeset
   286
SYM_REF0(safewstring_type_name_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
   287
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   288
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   289
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   290
/* 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
   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
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   294
/* 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
   295
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   296
/*  TYPE type_declaration_list END_TYPE */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   297
SYM_REF1(data_type_declaration_c, type_declaration_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
   298
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   299
/* 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
   300
SYM_LIST(type_declaration_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
   301
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   302
/*  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
   303
SYM_REF2(simple_type_declaration_c, 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
   304
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   305
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   306
/* 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
   307
SYM_REF2(simple_spec_init_c, simple_specification, constant)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   308
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   309
/*  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
   310
SYM_REF2(subrange_type_declaration_c, 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
   311
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   312
/* subrange_specification ASSIGN 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
   313
SYM_REF2(subrange_spec_init_c, subrange_specification, 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
   314
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   315
/*  integer_type_name '(' subrange')' */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   316
SYM_REF2(subrange_specification_c, integer_type_name, subrange)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   317
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   318
/*  signed_integer DOTDOT signed_integer */
592
99a284cec1f2 Add 'dimension' parameter to subrange_c, fill it correctly, and use it.
Mario de Sousa <msousa@fe.up.pt>
parents: 547
diff changeset
   319
/* dimension will be filled in during stage 3 (array_range_check_c) with the number of elements in this subrange */
99a284cec1f2 Add 'dimension' parameter to subrange_c, fill it correctly, and use it.
Mario de Sousa <msousa@fe.up.pt>
parents: 547
diff changeset
   320
SYM_REF2(subrange_c, lower_limit, upper_limit, unsigned long long int dimension;)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   321
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   322
/*  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
   323
SYM_REF2(enumerated_type_declaration_c, 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
   324
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   325
/* enumerated_specification ASSIGN 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
   326
SYM_REF2(enumerated_spec_init_c, enumerated_specification, 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
   327
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   328
/* helper symbol for enumerated_specification->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
   329
/* 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
   330
SYM_LIST(enumerated_value_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
   331
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   332
/* 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
   333
SYM_REF2(enumerated_value_c, type, value)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   334
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   335
/*  identifier ':' 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
   336
SYM_REF2(array_type_declaration_c, identifier, 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
   337
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   338
/* array_specification [ASSIGN 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
   339
/* array_initialization may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   340
SYM_REF2(array_spec_init_c, array_specification, 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
   341
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   342
/* ARRAY '[' array_subrange_list ']' OF 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
   343
SYM_REF2(array_specification_c, array_subrange_list, 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
   344
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   345
/* 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
   346
/* array_subrange_list ',' subrange */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   347
SYM_LIST(array_subrange_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
   348
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   349
/* array_initialization:  '[' 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
   350
/* 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
   351
/* 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
   352
SYM_LIST(array_initial_elements_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
   353
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   354
/* integer '(' [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
   355
/* array_initial_element may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   356
SYM_REF2(array_initial_elements_c, integer, 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
   357
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   358
/*  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
   359
SYM_REF2(structure_type_declaration_c, 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
   360
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   361
/* structure_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
   362
/* structure_initialization may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   363
SYM_REF2(initialized_structure_c, structure_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
   364
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   365
/* 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
   366
/* structure_declaration:  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
   367
/* 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
   368
SYM_LIST(structure_element_declaration_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
   369
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   370
/*  structure_element_name ':' *_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
   371
SYM_REF2(structure_element_declaration_c, structure_element_name, 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
   372
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   373
/* 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
   374
/* structure_initialization: '(' 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
   375
/* 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
   376
SYM_LIST(structure_element_initialization_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
   377
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   378
/*  structure_element_name ASSIGN value */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   379
SYM_REF2(structure_element_initialization_c, structure_element_name, value)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   380
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   381
/*  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
   382
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   383
 * NOTE:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   384
 * (Summary: Contrary to what is expected, the
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   385
 *           string_type_declaration_c is not used to store
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   386
 *           simple string type declarations that do not include
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   387
 *           size limits.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   388
 *           For e.g.:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   389
 *             str1_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
   390
 *           will be stored in a simple_type_declaration_c
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   391
 *           instead of a string_type_declaration_c.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   392
 *           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
   393
 *             str2_type: STRING [64] := "hello!"
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   394
 *           will be stored in a sring_type_declaration_c
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   395
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   396
 *           Read on for why this is done...
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   397
 * End Summary)
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
 * According to the spec, the valid construct
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   400
 * TYPE new_str_type : STRING := "hello!"; 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
   401
 * has two possible routes to 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
   402
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   403
 * Route 1:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   404
 * type_declaration: 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
   405
 * single_element_type_declaration: 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
   406
 * simple_type_declaration: identifier ':' 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
   407
 * simple_spec_init: 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
   408
 * (shift:  identifier <- 'new_str_type')
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   409
 * simple_specification: 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
   410
 * elementary_type_name: STRING
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   411
 * (shift: elementary_type_name <- STRING)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   412
 * (reduce: simple_specification <- 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
   413
 * (shift: constant <- "hello!")
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   414
 * (reduce: simple_spec_init: 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
   415
 * (reduce: ...)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   416
 *
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
 * Route 2:
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   419
 * type_declaration: 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
   420
 * string_type_declaration: identifier ':' 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
   421
 * (shift:  identifier <- 'new_str_type')
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   422
 * elementary_string_type_name: STRING
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   423
 * (shift: elementary_string_type_name <- STRING)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   424
 * (shift: string_type_declaration_size <-  empty )
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   425
 * string_type_declaration_init: 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
   426
 * (shift: character_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
   427
 * (reduce: string_type_declaration_init <- 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
   428
 * (reduce: string_type_declaration <- identifier ':' 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
   429
 * (reduce: type_declaration <- 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
   430
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   431
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   432
 * At first glance it seems that removing route 1 would make
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   433
 * the most sense. Unfortunately the construct '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
   434
 * shows up multiple times in other rules, so changing this construct
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   435
 * would also mean changing all the rules in which it appears.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   436
 * I (Mario) therefore chose to remove route 2 instead. This means
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   437
 * that the above declaration gets stored in a
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   438
 * simple_type_declaration_c, and not in a string_type_declaration_c
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   439
 * as would be expected!
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   440
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   441
/*  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
   442
SYM_REF4(string_type_declaration_c,	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
   443
					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
   444
					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
   445
					string_type_declaration_init) /* may be == NULL! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   446
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   447
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   448
/*********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   449
/* B 1.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
   450
/*********************/
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   451
SYM_REF1(symbolic_variable_c, var_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
   452
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   453
/********************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   454
/* 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
   455
/********************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   456
SYM_TOKEN(direct_variable_c)
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.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
   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
/*  subscripted_variable '[' 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
   462
SYM_REF2(array_variable_c, subscripted_variable, 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
   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
/* 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
   465
SYM_LIST(subscript_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
   466
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   467
/*  record_variable '.' 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
   468
/*  WARNING: input and/or output variables of function blocks
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   469
 *           may be accessed as fields of a structured variable!
619
f8c9ac5c529a Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents: 592
diff changeset
   470
 *           Code handling a structured_variable_c must take this into account!
f8c9ac5c529a Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents: 592
diff changeset
   471
 *           (i.e. that a FB instance may be accessed as a structured variable)!
f8c9ac5c529a Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents: 592
diff changeset
   472
 *
f8c9ac5c529a Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents: 592
diff changeset
   473
 *  WARNING: Status bit (.X) and activation time (.T) of STEPS in SFC diagrams
f8c9ac5c529a Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents: 592
diff changeset
   474
 *           may be accessed as fields of a structured variable!
f8c9ac5c529a Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents: 592
diff changeset
   475
 *           Code handling a structured_variable_c must take this into account 
f8c9ac5c529a Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents: 592
diff changeset
   476
 *           (i.e. that an SFC STEP may be accessed as a structured 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
   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
SYM_REF2(structured_variable_c, record_variable, 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
   479
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   480
/******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   481
/* 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
   482
/******************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   483
SYM_REF0(constant_option_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   484
SYM_REF0(retain_option_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   485
SYM_REF0(non_retain_option_c)
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
/* option -> the RETAIN/NON_RETAIN/<NULL> directive... */
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   488
/* NOTE: We need to implicitly define the EN and ENO function and FB parameters when the user
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   489
 *       does not do it explicitly in the IEC 61131-3 source code. 
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   490
 *       To be able to distinguish later on between implictly and explicitly defined
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   491
 *       variables, we use the 'method' flag that allows us to remember
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   492
 *       whether this declaration was in the original source code (method -> implicit_definition_c) 
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   493
 *       or not (method -> explicit_definition_c).
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   494
 */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   495
SYM_REF3(input_declarations_c, option, input_declaration_list, method)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   496
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   497
/* 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
   498
SYM_LIST(input_declaration_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
   499
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   500
/* 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: 194
diff changeset
   501
 *       consider the EN and ENO keywords!
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   502
 *       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: 194
diff changeset
   503
 *       used in several ways. One of them is to declare an EN input parameter, or
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   504
 *       an ENO output parameter.
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   505
 *       We have added the 'en_param_declaration_c' and 'eno_param_declaration_c' 
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   506
 *       to cover for this.
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   507
 *
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   508
 *       We could have re-used the standard class used for all other input variables (with
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   509
 *       an identifier set to 'EN' or 'ENO') however we may sometimes need to add this
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   510
 *       declaration implicitly (if the user does not include it in the source
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   511
 *       code himself), and it is good to know whether it was added implicitly or not.
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   512
 *       So we create a new class that has a 'method' flag that allows us to remember
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   513
 *       whether this declaration was in the original source code (method -> implicit_definition_c) 
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   514
 *       or not (method -> explicit_definition_c).
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   515
 */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   516
SYM_REF0(implicit_definition_c)
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   517
SYM_REF0(explicit_definition_c)
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   518
SYM_REF4(en_param_declaration_c, name, type, value, method)
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   519
SYM_REF3(eno_param_declaration_c, name, type, method)
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   520
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   521
/* edge -> The F_EDGE or R_EDGE directive */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   522
SYM_REF2(edge_declaration_c, edge, 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
   523
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   524
SYM_REF0(raising_edge_option_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   525
SYM_REF0(falling_edge_option_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   526
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   527
/* spec_init is one of 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
   528
 *    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
   529
 *    subrange_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
   530
 *    enumerated_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
   531
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   532
SYM_REF2(var1_init_decl_c, var1_list, 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
   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
/* | 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
   535
SYM_LIST(var1_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
   536
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   537
/* | [var1_list ','] variable_name integer '..' */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   538
/* NOTE: This is an extension to the standard!!! */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   539
/* In order to be able to handle extensible standard functions
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   540
 * (i.e. standard functions that may have a variable number of
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   541
 * input parameters, such as AND(word#33, word#44, word#55, word#66),
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   542
 * we have extended the acceptable syntax to allow var_name '..'
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   543
 * in an input variable declaration.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   544
 *
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   545
 * This allows us to parse the declaration of standard
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   546
 * extensible functions and load their interface definition
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   547
 * into the abstract syntax tree just like we do to other 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   548
 * user defined functions.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   549
 * This has the advantage that we can later do semantic
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   550
 * checking of calls to functions (be it a standard or user defined
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   551
 * function) in (almost) exactly the same way.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   552
 *
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   553
 * The integer tells the compiler the number of the first parameter.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   554
 * for example, for ADD(IN1 := 11, IN2:=22), the index for IN starts off at 1.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   555
 * Some other standard library functions, such as MUX, has the extensible
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   556
 * variable starting off from 0 (IN0, IN1, IN2, ...).
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   557
 *
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   558
 * Of course, we have a flag that disables this syntax when parsing user
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   559
 * written code, so we only allow this extra syntax while parsing the 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   560
 * 'header' file that declares all the standard IEC 61131-3 functions.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   561
 */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   562
SYM_REF2(extensible_input_parameter_c, var_name, first_index)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   563
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   564
/* var1_list ':' 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
   565
SYM_REF2(array_var_init_decl_c, var1_list, 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
   566
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   567
/*  var1_list ':' 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
   568
SYM_REF2(structured_var_init_decl_c, var1_list, 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
   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
/* 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
   571
/* structure_initialization -> may be NULL ! */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   572
SYM_REF3(fb_name_decl_c, fb_name_list, function_block_type_name, structure_initialization)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   573
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   574
/* 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
   575
SYM_LIST(fb_name_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
   576
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   577
/* VAR_OUTPUT [RETAIN | NON_RETAIN] var_init_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
   578
/* option -> may be NULL ! */
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   579
/* NOTE: We need to implicitly define the EN and ENO function and FB parameters when the user
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   580
 *       does not do it explicitly in the IEC 61131-3 source code. 
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   581
 *       To be able to distinguish later on between implictly and explicitly defined
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   582
 *       variables, we use the 'method' flag that allows us to remember
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   583
 *       whether this declaration was in the original source code (method -> implicit_definition_c) 
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   584
 *       or not (method -> explicit_definition_c).
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   585
 */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
   586
SYM_REF3(output_declarations_c, option, var_init_decl_list, method)
146
eef5e62048c7 Adding support for EN/ENO params in function and function blocks (standard function not supported yet)
lbessard
parents: 143
diff changeset
   587
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   588
/*  VAR_IN_OUT var_declaration_list END_VAR */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   589
SYM_REF1(input_output_declarations_c, var_declaration_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
   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
/* 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
   592
/* 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
   593
SYM_LIST(var_declaration_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
   594
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   595
/*  var1_list ':' 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
   596
SYM_REF2(array_var_declaration_c, var1_list, 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
   597
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   598
/*  var1_list ':' 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
   599
SYM_REF2(structured_var_declaration_c, var1_list, 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
   600
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   601
/* VAR [CONSTANT] var_init_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
   602
/* option -> may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   603
SYM_REF2(var_declarations_c, option, 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
   604
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   605
/*  VAR RETAIN var_init_decl_list END_VAR */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   606
SYM_REF1(retentive_var_declarations_c, var_init_decl_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
   607
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   608
/*  VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_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
   609
/* option -> may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   610
SYM_REF2(located_var_declarations_c, option, 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
   611
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   612
/* 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
   613
/* 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
   614
SYM_LIST(located_var_decl_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
   615
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   616
/*  [variable_name] location ':' 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
   617
/* variable_name -> may be NULL ! */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   618
SYM_REF3(located_var_decl_c, variable_name, location, located_var_spec_init)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   619
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   620
/*| VAR_EXTERNAL [CONSTANT] external_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
   621
/* option -> may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   622
SYM_REF2(external_var_declarations_c, option, 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
   623
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   624
/* 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
   625
/*| external_declaration_list 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
   626
SYM_LIST(external_declaration_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
   627
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   628
/*  global_var_name ':' (simple_specification|subrange_specification|enumerated_specification|array_specification|prev_declared_structure_type_name|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
   629
SYM_REF2(external_declaration_c, global_var_name, specification)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   630
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   631
/*| VAR_GLOBAL [CONSTANT|RETAIN] global_var_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
   632
/* option -> may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   633
SYM_REF2(global_var_declarations_c, option, 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
   634
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   635
/* 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
   636
/*| 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
   637
SYM_LIST(global_var_decl_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
   638
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   639
/*| global_var_spec ':' [located_var_spec_init|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
   640
/* type_specification ->may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   641
SYM_REF2(global_var_decl_c, global_var_spec, type_specification)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   642
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   643
/*| global_var_name location */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   644
SYM_REF2(global_var_spec_c, global_var_name, location)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   645
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   646
/*  AT direct_variable */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   647
SYM_REF1(location_c, 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
   648
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   649
/*| 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
   650
SYM_LIST(global_var_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
   651
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   652
/*  var1_list ':' 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
   653
SYM_REF2(single_byte_string_var_declaration_c, var1_list, 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
   654
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   655
/*  STRING ['[' integer ']'] [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
   656
/* integer ->may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   657
/* single_byte_character_string ->may be NULL ! */
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   658
SYM_REF2(single_byte_string_spec_c, string_spec, single_byte_character_string)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   659
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   660
/*   STRING ['[' integer ']'] */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   661
/* integer ->may be NULL ! */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   662
SYM_REF2(single_byte_limited_len_string_spec_c, string_type_name, character_string_len)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   663
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   664
/*  WSTRING ['[' integer ']'] */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   665
/* integer ->may be NULL ! */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   666
SYM_REF2(double_byte_limited_len_string_spec_c, string_type_name, character_string_len)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   667
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   668
/*  var1_list ':' 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
   669
SYM_REF2(double_byte_string_var_declaration_c, var1_list, 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
   670
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   671
/*  WSTRING ['[' integer ']'] [ASSIGN 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
   672
/* integer ->may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   673
/* double_byte_character_string ->may be NULL ! */
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   674
SYM_REF2(double_byte_string_spec_c, string_spec, double_byte_character_string)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   675
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   676
/*| VAR [RETAIN|NON_RETAIN] incompl_located_var_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
   677
/* option ->may be NULL ! */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   678
SYM_REF2(incompl_located_var_declarations_c, option, 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
   679
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   680
/* 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
   681
/*| 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
   682
SYM_LIST(incompl_located_var_decl_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
   683
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   684
/*  variable_name incompl_location ':' var_spec */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   685
SYM_REF3(incompl_located_var_decl_c, variable_name, incompl_location, var_spec)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   686
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   687
/*  AT 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
   688
SYM_TOKEN(incompl_location_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   689
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   690
/* 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
   691
 *  - 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
   692
 *  - 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
   693
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   694
SYM_LIST(var_init_decl_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
   695
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   696
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   697
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
/**************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   700
/* B.1.5 - Program organization units */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   701
/**************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   702
/***********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   703
/* 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
   704
/***********************/
738
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   705
/* enumvalue_symtable is filled in by enum_declaration_check_c, during stage3 semantic verification, with a list of all enumerated constants declared inside this POU */
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   706
SYM_REF4(function_declaration_c, derived_function_name, type_name, var_declarations_list, function_body, enumvalue_symtable_t enumvalue_symtable;)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   707
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   708
/* 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
   709
 * - 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
   710
 * - 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
   711
 * - 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
   712
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   713
SYM_LIST(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
   714
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   715
/* option -> storage method, CONSTANT or <null> */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   716
SYM_REF2(function_var_decls_c, option, 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
   717
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   718
/* 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
   719
SYM_LIST(var2_init_decl_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
   720
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   721
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   722
/*****************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   723
/* 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
   724
/*****************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   725
/*  FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */
738
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   726
/* enumvalue_symtable is filled in by enum_declaration_check_c, during stage3 semantic verification, with a list of all enumerated constants declared inside this POU */
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   727
SYM_REF3(function_block_declaration_c, fblock_name, var_declarations, fblock_body, enumvalue_symtable_t enumvalue_symtable;)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   728
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   729
/* 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
   730
/*  { 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
   731
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   732
 * 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
   733
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   734
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   735
/*  VAR_TEMP temp_var_decl_list END_VAR */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   736
SYM_REF1(temp_var_decls_c, var_decl_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
   737
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   738
/* 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
   739
SYM_LIST(temp_var_decls_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
   740
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   741
/*  VAR NON_RETAIN var_init_decl_list END_VAR */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   742
SYM_REF1(non_retentive_var_decls_c, var_decl_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
   743
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   744
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   745
/**********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   746
/* 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
   747
/**********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   748
/*  PROGRAM program_type_name program_var_declarations_list function_block_body END_PROGRAM */
738
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   749
/* enumvalue_symtable is filled in by enum_declaration_check_c, during stage3 semantic verification, with a list of all enumerated constants declared inside this POU */
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   750
SYM_REF3(program_declaration_c, program_type_name, var_declarations, function_block_body, enumvalue_symtable_t enumvalue_symtable;)
0
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
/* intermediate helper symbol for program_declaration_c */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   753
/*  { 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
   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
 * 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
   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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   758
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   759
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   760
/*********************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   761
/* 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
   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
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   764
/* | sequential_function_chart sfc_network */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   765
SYM_LIST(sequential_function_chart_c)
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   766
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   767
/* initial_step {step | transition | action} */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   768
SYM_LIST(sfc_network_c)
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   769
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   770
/* INITIAL_STEP step_name ':' action_association_list END_STEP */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   771
SYM_REF2(initial_step_c, step_name, action_association_list)
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   772
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   773
/* | action_association_list action_association ';' */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   774
SYM_LIST(action_association_list_c)
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   775
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   776
/* STEP step_name ':' action_association_list END_STEP */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   777
SYM_REF2(step_c, step_name, action_association_list)
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   778
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   779
/* action_name '(' action_qualifier indicator_name_list ')' */
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   780
/* action_qualifier -> may be NULL ! */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   781
SYM_REF3(action_association_c, action_name, action_qualifier, indicator_name_list)
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   782
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   783
/* N | R | S | P */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   784
SYM_TOKEN(qualifier_c)
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   785
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   786
/* L | D | SD | DS | SL */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   787
SYM_TOKEN(timed_qualifier_c)
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   788
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   789
/* | indicator_name_list ',' indicator_name */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   790
SYM_LIST(indicator_name_list_c)
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   791
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   792
/* qualifier | timed_qualifier ',' action_time */
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   793
/* action_time -> may be NULL ! */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   794
SYM_REF2(action_qualifier_c, action_qualifier, action_time)
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   795
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   796
/* TRANSITION [transition_name] ['(' PRIORITY ASSIGN integer ')'] 
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   797
 *   FROM steps TO steps 
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   798
 *   transition_condition 
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   799
 * END_TRANSITION
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   800
*/
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   801
/* transition_name -> may be NULL ! */
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   802
/* integer -> may be NULL ! */
87
b97f9ad7b2c6 Bug on SFC transition parsing and generation fixed
lbessard
parents: 69
diff changeset
   803
SYM_REF5(transition_c, transition_name, integer, from_steps, to_steps, transition_condition)
b97f9ad7b2c6 Bug on SFC transition parsing and generation fixed
lbessard
parents: 69
diff changeset
   804
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   805
/* ':' eol_list simple_instr_list | ASSIGN expression ';' */
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   806
/* transition_condition_il -> may be NULL ! */
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   807
/* transition_condition_st -> may be NULL ! */
87
b97f9ad7b2c6 Bug on SFC transition parsing and generation fixed
lbessard
parents: 69
diff changeset
   808
SYM_REF2(transition_condition_c, transition_condition_il, transition_condition_st)
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   809
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   810
/* step_name | '(' step_name_list ')' */
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   811
/* step_name      -> may be NULL ! */
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   812
/* step_name_list -> may be NULL ! */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   813
SYM_REF2(steps_c, step_name, step_name_list)
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   814
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   815
/* | step_name_list ',' step_name */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   816
SYM_LIST(step_name_list_c)
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   817
97
55ffcf693d6d adding comments.
mario
parents: 87
diff changeset
   818
/* ACTION action_name ':' function_block_body END_ACTION */
1
5d893a68be6e Changes made since Mario visit at LOLITECH. Thanks again !
etisserant
parents: 0
diff changeset
   819
SYM_REF2(action_c, action_name, function_block_body)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   820
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   821
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   822
/* 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
   823
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   824
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   825
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   826
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
   827
   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
   828
   (resource_declaration_list | 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
   829
   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
   830
   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
   831
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
   832
*/
738
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   833
/* enumvalue_symtable is filled in by enum_declaration_check_c, during stage3 semantic verification, with a list of all enumerated constants declared inside this POU */
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   834
SYM_REF5(configuration_declaration_c, configuration_name, global_var_declarations, resource_declarations, access_declarations, instance_specific_initializations, enumvalue_symtable_t enumvalue_symtable;)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   835
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   836
/* 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
   837
SYM_LIST(resource_declaration_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
   838
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   839
/*
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   840
RESOURCE resource_name ON 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
   841
   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
   842
   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
   843
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
   844
*/
738
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   845
/* enumvalue_symtable is filled in by enum_declaration_check_c, during stage3 semantic verification, with a list of all enumerated constants declared inside this POU */
e47cc8c954db Start to move enumeration declaration checking to its own class.
Mario de Sousa <msousa@fe.up.pt>
parents: 690
diff changeset
   846
SYM_REF4(resource_declaration_c, resource_name, resource_type_name, global_var_declarations, resource_declaration, enumvalue_symtable_t enumvalue_symtable;)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   847
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   848
/* task_configuration_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
   849
SYM_REF2(single_resource_declaration_c, task_configuration_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
   850
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   851
/* helper symbol for 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
   852
SYM_LIST(task_configuration_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
   853
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   854
/* helper symbol for 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
   855
SYM_LIST(program_configuration_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
   856
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   857
/* helper symbol for
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   858
 *  - 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
   859
 *  - 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
   860
 */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   861
SYM_LIST(any_fb_name_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
   862
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   863
/*  [resource_name '.'] global_var_name ['.' structure_element_name] */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   864
SYM_REF3(global_var_reference_c, resource_name, global_var_name, structure_element_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
   865
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   866
/*  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
   867
SYM_REF2(program_output_reference_c, 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
   868
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   869
/*  TASK task_name 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
   870
SYM_REF2(task_configuration_c, task_name, 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
   871
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   872
/*  '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   873
SYM_REF3(task_initialization_c, single_data_source, interval_data_source, priority_data_source)
0
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
/*  PROGRAM [RETAIN | NON_RETAIN] program_name [WITH task_name] ':' program_type_name ['(' prog_conf_elements ')'] */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   876
SYM_REF5(program_configuration_c, retain_option, program_name, task_name, program_type_name, prog_conf_elements)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   877
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   878
/* 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
   879
SYM_LIST(prog_conf_elements_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   880
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   881
/*  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
   882
SYM_REF2(fb_task_c, fb_name, 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
   883
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   884
/*  any_symbolic_variable ASSIGN 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
   885
SYM_REF2(prog_cnxn_assign_c, symbolic_variable, 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
   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
/* any_symbolic_variable SENDTO data_sink */
28
5b170c9ce134 Multi-file configuration and resource generation finished
lbessard
parents: 17
diff changeset
   888
SYM_REF2(prog_cnxn_sendto_c, symbolic_variable, data_sink)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   889
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   890
/* VAR_CONFIG instance_specific_init_list END_VAR */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   891
SYM_REF1(instance_specific_initializations_c, instance_specific_init_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
   892
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   893
/* 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
   894
SYM_LIST(instance_specific_init_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
   895
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   896
/* 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
   897
    ((variable_name [location] ':' located_var_spec_init) | (fb_name ':' 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
   898
*/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   899
SYM_REF6(instance_specific_init_c, resource_name, program_name, any_fb_name_list, variable_name, location, initialization)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   900
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 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
   902
/* 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
   903
SYM_REF2(fb_initialization_c, 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
   904
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   905
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   906
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   907
/****************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   908
/* B.2 - Language IL (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
   909
/****************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   910
/***********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   911
/* 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
   912
/***********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   913
/*| 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
   914
SYM_LIST(instruction_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
   915
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   916
/* | label ':' [il_incomplete_instruction] eol_list */
672
dee28c5bdc73 Use doubly linked connections for flow control graph (will be used later).
Mario de Sousa <msousa@fe.up.pt>
parents: 619
diff changeset
   917
/* NOTE: The parameters 'prev_il_instruction'/'next_il_instruction' are used to point to all previous/next il instructions that may be executed imedaitely before/after this instruction.
dee28c5bdc73 Use doubly linked connections for flow control graph (will be used later).
Mario de Sousa <msousa@fe.up.pt>
parents: 619
diff changeset
   918
 *       In case of an il instruction preceded by a label, the previous_il_instruction will include all IL instructions that jump to this label!
443
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 439
diff changeset
   919
 *       It is filled in by the flow_control_analysis_c during stage 3.
685
5b19e376cc94 Fix flow control analysis of IL simple instructions (i.e. IL instructions inside parenthises!)
Mario de Sousa <msousa@fe.up.pt>
parents: 672
diff changeset
   920
 *       This will essentially be a doubly linked list of il_instruction_c and il_simple_instruction_c objects!!
443
ff4d26b7e51d Narrow IL code backwords, so as to correctly handle invocations to overloaded functions from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents: 439
diff changeset
   921
 */
672
dee28c5bdc73 Use doubly linked connections for flow control graph (will be used later).
Mario de Sousa <msousa@fe.up.pt>
parents: 619
diff changeset
   922
SYM_REF2(il_instruction_c, label, il_instruction, std::vector <symbol_c *> prev_il_instruction, next_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
   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
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   925
/* | il_simple_operator [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
   926
SYM_REF2(il_simple_operation_c, il_simple_operator, 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
   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
/* | function_name [il_operand_list] */
438
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 424
diff changeset
   929
/* NOTE: The parameter 'called_function_declaration', 'extensible_param_count' and 'candidate_functions' are used to pass data between the stage 3 and stage 4.
399
55b074ea7255 Fix bug with functions like LEN and TRUNC that have overloaded return type for same inputs type
laurent
parents: 350
diff changeset
   930
 *       data between the stage 3 and stage 4.
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   931
 *       See the comment above function_invocation_c for more details 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
   932
 */
438
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 424
diff changeset
   933
SYM_REF2(il_function_call_c, function_name, il_operand_list, symbol_c *called_function_declaration; int extensible_param_count; std::vector <symbol_c *> candidate_functions;)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   934
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   935
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   936
/* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */
690
6156ee2b4e32 Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents: 685
diff changeset
   937
/* WARNING
6156ee2b4e32 Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents: 685
diff changeset
   938
 *   The semantics of the il_expression_c.il_operand member is NOT what you may expect!
6156ee2b4e32 Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents: 685
diff changeset
   939
 *   In order to simplify processing of the IL code, stage2 will prepend an artifical (and equivalent) 'LD <il_operand>' IL instruction into the simple_instr_list
6156ee2b4e32 Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents: 685
diff changeset
   940
 *   The il_expression_c.il_operand is maintained, in case we really need to handle it as a special case!
6156ee2b4e32 Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents: 685
diff changeset
   941
 *   See the comments in iec_bison.yy for details and an example.
6156ee2b4e32 Correctly generate C code for IL expressions, i.e. IL instructions inside parenthesis.
Mario de Sousa <msousa@fe.up.pt>
parents: 685
diff changeset
   942
 */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   943
SYM_REF3(il_expression_c, il_expr_operator, il_operand, simple_instr_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
   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
/*  il_jump_operator label */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   946
SYM_REF2(il_jump_operation_c, il_jump_operator, label)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   947
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   948
/*   il_call_operator 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
   949
 * | il_call_operator 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
   950
 * | il_call_operator prev_declared_fb_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
   951
 * | il_call_operator prev_declared_fb_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
   952
 * | il_call_operator prev_declared_fb_name '(' eol_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
   953
 */
439
cf7d6862033d Add semantic verification of FB calls in IL (not yet complete - missing printing of errors!)
Mario de Sousa <msousa@fe.up.pt>
parents: 438
diff changeset
   954
/* NOTE: The parameter 'called_fb_declaration'is used to pass data between stage 3 and stage4 (although currently it is not used in stage 4 */
cf7d6862033d Add semantic verification of FB calls in IL (not yet complete - missing printing of errors!)
Mario de Sousa <msousa@fe.up.pt>
parents: 438
diff changeset
   955
SYM_REF4(il_fb_call_c, il_call_operator, fb_name, il_operand_list, il_param_list, symbol_c *called_fb_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
   956
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   957
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   958
/* | function_name '(' eol_list [il_param_list] ')' */
438
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 424
diff changeset
   959
/* NOTE: The parameter 'called_function_declaration', 'extensible_param_count' and 'candidate_functions' are used to pass data between the stage 3 and stage 4.
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 424
diff changeset
   960
 *       See the comment above function_invocation_c for more details. 
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 424
diff changeset
   961
 */
744b125d911e Add support for semantic verification of function calls in IL.
Mario de Sousa <msousa@fe.up.pt>
parents: 424
diff changeset
   962
SYM_REF2(il_formal_funct_call_c, function_name, il_param_list, symbol_c *called_function_declaration; int extensible_param_count; std::vector <symbol_c *> candidate_functions;)
0
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
/* | il_operand_list ',' 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
   965
SYM_LIST(il_operand_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
   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
/* | 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
   968
SYM_LIST(simple_instr_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
   969
453
4733f662362a More changes for support of semantic verification of il_expressions
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   970
4733f662362a More changes for support of semantic verification of il_expressions
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   971
/* il_simple_instruction:
4733f662362a More changes for support of semantic verification of il_expressions
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   972
 *   il_simple_operation eol_list
4733f662362a More changes for support of semantic verification of il_expressions
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   973
 * | il_expression eol_list
4733f662362a More changes for support of semantic verification of il_expressions
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   974
 * | il_formal_funct_call eol_list
4733f662362a More changes for support of semantic verification of il_expressions
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   975
 */
685
5b19e376cc94 Fix flow control analysis of IL simple instructions (i.e. IL instructions inside parenthises!)
Mario de Sousa <msousa@fe.up.pt>
parents: 672
diff changeset
   976
/* NOTE: The parameters 'prev_il_instruction'/'next_il_instruction' are used to point to all previous/next il instructions that may be executed imedaitely before/after this instruction.
5b19e376cc94 Fix flow control analysis of IL simple instructions (i.e. IL instructions inside parenthises!)
Mario de Sousa <msousa@fe.up.pt>
parents: 672
diff changeset
   977
 *       In case of an il instruction preceded by a label, the previous_il_instruction will include all IL instructions that jump to this label!
5b19e376cc94 Fix flow control analysis of IL simple instructions (i.e. IL instructions inside parenthises!)
Mario de Sousa <msousa@fe.up.pt>
parents: 672
diff changeset
   978
 *       It is filled in by the flow_control_analysis_c during stage 3.
5b19e376cc94 Fix flow control analysis of IL simple instructions (i.e. IL instructions inside parenthises!)
Mario de Sousa <msousa@fe.up.pt>
parents: 672
diff changeset
   979
 *       This will essentially be a doubly linked list of il_instruction_c and il_simple_instruction_c objects!!
5b19e376cc94 Fix flow control analysis of IL simple instructions (i.e. IL instructions inside parenthises!)
Mario de Sousa <msousa@fe.up.pt>
parents: 672
diff changeset
   980
 */
5b19e376cc94 Fix flow control analysis of IL simple instructions (i.e. IL instructions inside parenthises!)
Mario de Sousa <msousa@fe.up.pt>
parents: 672
diff changeset
   981
SYM_REF1(il_simple_instruction_c, il_simple_instruction, std::vector <symbol_c *> prev_il_instruction, next_il_instruction;)
453
4733f662362a More changes for support of semantic verification of il_expressions
Mario de Sousa <msousa@fe.up.pt>
parents: 447
diff changeset
   982
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   983
/* | il_initial_param_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
   984
SYM_LIST(il_param_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
   985
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   986
/*  il_assign_operator 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
   987
 * | il_assign_operator '(' eol_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
   988
 */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
   989
SYM_REF3(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_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
   990
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   991
/*  il_assign_out_operator variable */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   992
SYM_REF2(il_param_out_assignment_c, il_assign_out_operator, variable)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   993
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   994
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   995
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   996
/*******************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
   997
/* 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
   998
/*******************/
476
38d85e9a0507 Add check widening status for IL operator.
Manuele Conti <conti.ma@alice.it>
parents: 471
diff changeset
   999
/* NOTE: The parameter 'called_fb_declaration' is used to pass data between stage 3 and stage4 (although currently it is not used in stage 4 */
477
c0c6ff7357b7 Clarify some details in the comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 476
diff changeset
  1000
/* NOTE: The parameter 'deprecated_operation' indicates that the operation, with the specific data types being used, is currently defined
478
b13feab3b918 Change setting of deprecated_operation from fill to narrow_candidate_datatypes_c.
Mario de Sousa <msousa@fe.up.pt>
parents: 477
diff changeset
  1001
 *       in the standard as being deprecated. This variable is filled in with the correct value in stage 3 (narrow_candidate_datatypes_c) 
477
c0c6ff7357b7 Clarify some details in the comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 476
diff changeset
  1002
 *       and currently only used in stage 3 (print_datatypes_error_c).
c0c6ff7357b7 Clarify some details in the comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 476
diff changeset
  1003
 */ 
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1004
SYM_REF0(LD_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1005
SYM_REF0(LDN_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1006
SYM_REF0(ST_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1007
SYM_REF0(STN_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1008
SYM_REF0(NOT_operator_c)
447
aad0f3e5df33 Start of support for semantic verification of FB calls in IL using special IL instructions.
Mario de Sousa <msousa@fe.up.pt>
parents: 443
diff changeset
  1009
SYM_REF0(S_operator_c, symbol_c *called_fb_declaration;)
aad0f3e5df33 Start of support for semantic verification of FB calls in IL using special IL instructions.
Mario de Sousa <msousa@fe.up.pt>
parents: 443
diff changeset
  1010
SYM_REF0(R_operator_c, symbol_c *called_fb_declaration;)
aad0f3e5df33 Start of support for semantic verification of FB calls in IL using special IL instructions.
Mario de Sousa <msousa@fe.up.pt>
parents: 443
diff changeset
  1011
SYM_REF0(S1_operator_c, symbol_c *called_fb_declaration;)
aad0f3e5df33 Start of support for semantic verification of FB calls in IL using special IL instructions.
Mario de Sousa <msousa@fe.up.pt>
parents: 443
diff changeset
  1012
SYM_REF0(R1_operator_c, symbol_c *called_fb_declaration;)
aad0f3e5df33 Start of support for semantic verification of FB calls in IL using special IL instructions.
Mario de Sousa <msousa@fe.up.pt>
parents: 443
diff changeset
  1013
SYM_REF0(CLK_operator_c, symbol_c *called_fb_declaration;)
aad0f3e5df33 Start of support for semantic verification of FB calls in IL using special IL instructions.
Mario de Sousa <msousa@fe.up.pt>
parents: 443
diff changeset
  1014
SYM_REF0(CU_operator_c, symbol_c *called_fb_declaration;)
aad0f3e5df33 Start of support for semantic verification of FB calls in IL using special IL instructions.
Mario de Sousa <msousa@fe.up.pt>
parents: 443
diff changeset
  1015
SYM_REF0(CD_operator_c, symbol_c *called_fb_declaration;)
aad0f3e5df33 Start of support for semantic verification of FB calls in IL using special IL instructions.
Mario de Sousa <msousa@fe.up.pt>
parents: 443
diff changeset
  1016
SYM_REF0(PV_operator_c, symbol_c *called_fb_declaration;)
aad0f3e5df33 Start of support for semantic verification of FB calls in IL using special IL instructions.
Mario de Sousa <msousa@fe.up.pt>
parents: 443
diff changeset
  1017
SYM_REF0(IN_operator_c, symbol_c *called_fb_declaration;)
aad0f3e5df33 Start of support for semantic verification of FB calls in IL using special IL instructions.
Mario de Sousa <msousa@fe.up.pt>
parents: 443
diff changeset
  1018
SYM_REF0(PT_operator_c, symbol_c *called_fb_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
  1019
SYM_REF0(AND_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1020
SYM_REF0(OR_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1021
SYM_REF0(XOR_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1022
SYM_REF0(ANDN_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1023
SYM_REF0(ORN_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1024
SYM_REF0(XORN_operator_c)
476
38d85e9a0507 Add check widening status for IL operator.
Manuele Conti <conti.ma@alice.it>
parents: 471
diff changeset
  1025
SYM_REF0(ADD_operator_c, bool deprecated_operation;)
38d85e9a0507 Add check widening status for IL operator.
Manuele Conti <conti.ma@alice.it>
parents: 471
diff changeset
  1026
SYM_REF0(SUB_operator_c, bool deprecated_operation;)
38d85e9a0507 Add check widening status for IL operator.
Manuele Conti <conti.ma@alice.it>
parents: 471
diff changeset
  1027
SYM_REF0(MUL_operator_c, bool deprecated_operation;)
38d85e9a0507 Add check widening status for IL operator.
Manuele Conti <conti.ma@alice.it>
parents: 471
diff changeset
  1028
SYM_REF0(DIV_operator_c, bool deprecated_operation;)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1029
SYM_REF0(MOD_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1030
SYM_REF0(GT_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1031
SYM_REF0(GE_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1032
SYM_REF0(EQ_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1033
SYM_REF0(LT_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1034
SYM_REF0(LE_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1035
SYM_REF0(NE_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1036
SYM_REF0(CAL_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1037
SYM_REF0(CALC_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1038
SYM_REF0(CALCN_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1039
SYM_REF0(RET_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1040
SYM_REF0(RETC_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1041
SYM_REF0(RETCN_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1042
SYM_REF0(JMP_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1043
SYM_REF0(JMPC_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1044
SYM_REF0(JMPCN_operator_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1045
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 118
diff changeset
  1046
/*  any_identifier ASSIGN */
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 118
diff changeset
  1047
SYM_REF1(il_assign_operator_c, variable_name)
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 118
diff changeset
  1048
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1049
/*| [NOT] 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
  1050
SYM_REF2(il_assign_out_operator_c, option, 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
  1051
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1052
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1053
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1054
/***************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1055
/* B.3 - Language ST (Structured Text) */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1056
/***************************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1057
/***********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1058
/* 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
  1059
/***********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1060
SYM_REF2(or_expression_c, l_exp, r_exp)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1061
SYM_REF2(xor_expression_c, l_exp, r_exp)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1062
SYM_REF2(and_expression_c, l_exp, r_exp)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1063
SYM_REF2(equ_expression_c, l_exp, r_exp)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1064
SYM_REF2(notequ_expression_c, l_exp, r_exp)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1065
SYM_REF2(lt_expression_c, l_exp, r_exp)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1066
SYM_REF2(gt_expression_c, l_exp, r_exp)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1067
SYM_REF2(le_expression_c, l_exp, r_exp)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1068
SYM_REF2(ge_expression_c, l_exp, r_exp)
476
38d85e9a0507 Add check widening status for IL operator.
Manuele Conti <conti.ma@alice.it>
parents: 471
diff changeset
  1069
SYM_REF2(add_expression_c, l_exp, r_exp, bool deprecated_operation;)
38d85e9a0507 Add check widening status for IL operator.
Manuele Conti <conti.ma@alice.it>
parents: 471
diff changeset
  1070
SYM_REF2(sub_expression_c, l_exp, r_exp, bool deprecated_operation;)
38d85e9a0507 Add check widening status for IL operator.
Manuele Conti <conti.ma@alice.it>
parents: 471
diff changeset
  1071
SYM_REF2(mul_expression_c, l_exp, r_exp, bool deprecated_operation;)
38d85e9a0507 Add check widening status for IL operator.
Manuele Conti <conti.ma@alice.it>
parents: 471
diff changeset
  1072
SYM_REF2(div_expression_c, l_exp, r_exp, bool deprecated_operation;)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1073
SYM_REF2(mod_expression_c, l_exp, r_exp)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1074
SYM_REF2(power_expression_c, l_exp, r_exp)
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
  1075
SYM_REF1(neg_expression_c, exp)
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
  1076
SYM_REF1(not_expression_c, exp)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1077
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
  1078
/*    formal_param_list -> may be NULL ! */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
  1079
/* nonformal_param_list -> may be NULL ! */
420
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1080
/* NOTES:
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1081
 *    The parameter 'called_function_declaration'... 
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1082
 *       ...is used to pass data between the stage 3 and stage 4.
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  1083
 *       The IEC 61131-3 standard allows for overloaded standard functions. This means that some
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
  1084
 *       function calls are not completely defined by the name of the function being called,
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  1085
 *       and need to be disambiguated with using the data types of the parameters being passed.
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
  1086
 *       Stage 3 does this to verify semantic correctness.
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  1087
 *       Stage 4 also needs to do this in order to determine which function to call.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  1088
 *       It does not make sense to determine the exact function being called twice (once in stage 3,
417
d48f53715f77 Re-write of stage3 code (done by Manuele and I), re-write of search_varfb_instance_type_c (done by myself), and several other bug fixes.
Mario de Sousa <msousa@fe.up.pt>
parents: 350
diff changeset
  1089
 *       and again in stage 4), so stage 3 will store this info in the parameter called_function_declaration
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
  1090
 *       for stage 4 to use it later on.
420
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1091
 *    The parameter 'candidate_functions'... 
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1092
 *       ...is used to pass data between two passes within stage 3
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1093
 *       (actually between fill_candidate_datatypes_c and narrow_candidate_datatypes_c).
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1094
 *       It is used to store all the functions that may be legally called with the current parameters
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1095
 *       being used in this function invocation. Note that the standard includes some standard functions
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1096
 *       that have the exact same input parameter types, but return different data types.
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1097
 *       In order to determine which of these functions should be called, we first create a list
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1098
 *       of all possible functions, and then narrow down the list (hopefully down to 1 function)
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1099
 *       once we know the data type that the function invocation must return (this will take into 
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1100
 *       account the expression in which the function invocation is inserted/occurs).
421
840cb1e1e177 Add support in stage 3 for checking function invocations in ST.
Mario de Sousa <msousa@fe.up.pt>
parents: 420
diff changeset
  1101
 *       The 'called_function_declaration' will eventually be set (in stage 3) to one of
840cb1e1e177 Add support in stage 3 for checking function invocations in ST.
Mario de Sousa <msousa@fe.up.pt>
parents: 420
diff changeset
  1102
 *       the functions in the 'candidate_functions' list!
420
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1103
 *    The parameter 'extensible_param_count'... 
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1104
 *       ...is used to pass data between the stage 3 and stage 4.
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1105
 *       The IEC 61131-3 standard allows for extensible standard functions. This means that some
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1106
 *       standard functions may be called with a variable number of paramters. Stage 3 will store
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1107
 *       in extensible_param_count the number of parameters being passed to the extensible parameter.
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1108
 */
866eb35e4e14 Fix search_varfb_instance_decl to be able to find variables and FB when only given an identifier.
Mario de Sousa <msousa@fe.up.pt>
parents: 417
diff changeset
  1109
SYM_REF3(function_invocation_c, function_name, formal_param_list, nonformal_param_list, symbol_c *called_function_declaration; int extensible_param_count; std::vector <symbol_c *> candidate_functions;)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1110
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1111
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1112
/********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1113
/* 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
  1114
/********************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1115
SYM_LIST(statement_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
  1116
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1117
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1118
/*********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1119
/* 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
  1120
/*********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1121
SYM_REF2(assignment_statement_c, l_exp, r_exp)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1122
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1123
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
/* 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
  1126
/*****************************************/
143
73372bdeeffb Adding support for EN/ENO parameters in bison rules
lbessard
parents: 118
diff changeset
  1127
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1128
/*  RETURN */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1129
SYM_REF0(return_statement_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1130
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1131
/* fb_name '(' [param_assignment_list] ')' */
202
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
  1132
/*    formal_param_list -> may be NULL ! */
da1a8186f86f Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents: 194
diff changeset
  1133
/* nonformal_param_list -> may be NULL ! */
439
cf7d6862033d Add semantic verification of FB calls in IL (not yet complete - missing printing of errors!)
Mario de Sousa <msousa@fe.up.pt>
parents: 438
diff changeset
  1134
/* NOTE: The parameter 'called_fb_declaration'is used to pass data between stage 3 and stage4 (although currently it is not used in stage 4 */
424
43d73e28eca8 Continue checking data type compatibility inside expressions used to pass paramters to invalid function/FB calls
Mario de Sousa <msousa@fe.up.pt>
parents: 421
diff changeset
  1135
SYM_REF3(fb_invocation_c, fb_name, formal_param_list, nonformal_param_list, symbol_c *called_fb_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
  1136
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1137
/* helper symbol for 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
  1138
/* param_assignment_list ',' 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
  1139
SYM_LIST(param_assignment_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
  1140
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1141
/*  variable_name ASSIGN expression */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1142
SYM_REF2(input_variable_param_assignment_c, variable_name, expression)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1143
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1144
/* [NOT] variable_name '=>' variable */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
  1145
SYM_REF3(output_variable_param_assignment_c, not_param, variable_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
  1146
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1147
/* helper CLASS for output_variable_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
  1148
SYM_REF0(not_paramassign_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1149
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1150
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1151
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1152
/* 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
  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
/* IF expression THEN statement_list elseif_statement_list ELSE statement_list 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
  1155
SYM_REF4(if_statement_c, expression, statement_list, elseif_statement_list, else_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
  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
/* 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
  1158
SYM_LIST(elseif_statement_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
  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
/* 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
  1161
/* ELSIF expression THEN 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
  1162
SYM_REF2(elseif_statement_c, expression, 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
  1163
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1164
/* CASE expression OF case_element_list ELSE statement_list END_CASE */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
  1165
SYM_REF3(case_statement_c, expression, case_element_list, statement_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
  1166
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1167
/* 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
  1168
SYM_LIST(case_element_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
  1169
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1170
/*  case_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
  1171
SYM_REF2(case_element_c, case_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
  1172
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1173
SYM_LIST(case_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
  1174
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1175
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1176
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1177
/* 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
  1178
/********************************/
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1179
/*  FOR control_variable ASSIGN expression TO expression [BY expression] DO statement_list END_FOR */
69
41cb5b80416e Adding basic error checking.
mario
parents: 32
diff changeset
  1180
SYM_REF5(for_statement_c, control_variable, beg_expression, end_expression, by_expression, statement_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
  1181
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1182
/*  WHILE expression DO statement_list 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
  1183
SYM_REF2(while_statement_c, expression, 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
  1184
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1185
/*  REPEAT statement_list UNTIL expression 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
  1186
SYM_REF2(repeat_statement_c, statement_list, expression)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1187
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1188
/*  EXIT */
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1189
SYM_REF0(exit_statement_c)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1190
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
  1191