stage3/stage3.cc
author laurent
Thu, 22 Apr 2010 00:29:30 +0200
changeset 239 b3063ca418c1
parent 204 8ffa211b7f9a
child 257 90782e241346
permissions -rw-r--r--
Bug when parsing standard function block call in IL
204
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
     1
/*
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
     2
 * (c) 20099 Catarina da Costa Boucinha
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
     3
 *
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
     4
 * Offered to the public under the terms of the GNU General Public License
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
     5
 * as published by the Free Software Foundation; either version 2 of the
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
     6
 * License, or (at your option) any later version.
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
     7
 *
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
     8
 * This program is distributed in the hope that it will be useful, but
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
     9
 * WITHOUT ANY WARRANTY; without even the implied warranty of
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    11
 * Public License for more details.
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    12
 *
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    13
 * This code is made available on the understanding that it will not be
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    14
 * used in safety-critical situations without a full and competent review.
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    15
 */
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    16
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    17
/*
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    18
 * An IEC 61131-3 IL and ST compiler.
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    19
 *
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    20
 * Based on the
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    21
 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2009-04-24)
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    22
 *
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    23
 */
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    24
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    25
#include "stage3.hh"
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    26
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    27
int type_safety(symbol_c *tree_root){
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    28
	visit_expression_type_c visit_expression_type(tree_root);
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    29
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    30
	(*tree_root).accept(visit_expression_type);
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    31
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    32
	return 0;
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    33
}
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    34
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    35
int stage3(symbol_c *tree_root){
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    36
	return type_safety(tree_root);
8ffa211b7f9a Adding missing Stage3 files.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff changeset
    37
}