ACT Library
Loading...
Searching...
No Matches
typecheck.h
Go to the documentation of this file.
1/*************************************************************************
2 *
3 * Copyright (c) 2023 Rajit Manohar
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 **************************************************************************
21 */
22#ifndef __ACT_CHECK_H__
23#define __ACT_CHECK_H__
24
39#define T_ERR -1
41
42#define T_ARRAYOF 0x20
43
44#define T_STRICT 0x40
48
49#define T_PARAM 0x80
50
51#define T_INT 0x1
52#define T_REAL 0x2
53#define T_BOOL 0x4
54#define T_PROC 0x5
55#define T_CHAN 0x6
56#define T_DATA_INT 0x7
57#define T_DATA_BOOL 0x8
58#define T_SELF 0x9
59#define T_DATA 0xa
60#define T_DATA_ENUM 0xb
61#define T_PTYPE 0x10
62
63#define T_MASK 0x1f
64
69#define T_FIXBASETYPE(x) ((((x) & T_MASK) == T_DATA_BOOL) ? T_BOOL : ((((x) & T_MASK) == T_DATA_INT) ? T_INT : ((x) & T_MASK)))
70
74#define T_BASETYPE(x) ((x) & T_MASK)
75
80#define T_BASETYPE_ISNUM(x) (T_FIXBASETYPE (x) == T_INT || T_BASETYPE (x) == T_REAL)
81
85#define T_BASETYPE_INT(x) (T_FIXBASETYPE(x) == T_INT)
86
90#define T_BASETYPE_BOOL(x) (T_FIXBASETYPE(x) == T_BOOL)
91
96#define T_BASETYPE_ISINTBOOL(x) (T_BASETYPE_INT(x) || T_BASETYPE_BOOL(x))
97
98
120int act_type_expr (Scope *s, Expr *e, int *width, int only_chan = 0);
121
122
132int act_type_var (Scope *s, ActId *id, InstType **xit);
133
152int act_type_chan (Scope *sc, Chan *ch, int is_send, Expr *e, ActId *id,
153 int override_id);
154
161
168
169
191int type_connectivity_check (InstType *lhs, InstType *rhs, int skip_last_array = 0);
192
202
216InstType *act_expr_insttype (Scope *s, Expr *e, int *islocal, int only_chan);
217
227InstType *act_actual_insttype (Scope *s, ActId *id, int *islocal);
228
236void type_set_position (int l, int c, char *n);
237
243const char *act_type_errmsg (void);
244
251void typecheck_err (const char *s, ...);
252
253#endif /* __ACT_CHECK_H__ */
Array expressions.
Definition: act_array.h:529
This class is used to store Act identifiers that correspond to instances. Identifiers have an optiona...
Definition: act_id.h:56
Used to represent the built-in ACT Paramterized chan(foo) type or chan(foo,foo) bi-directional/exchan...
Definition: types.h:237
An instance type.
Definition: inst.h:92
This is the data structure that holds all instances and their associated types within a scope....
Definition: namespaces.h:77
Definition: expr.h:79
void typecheck_err(const char *s,...)
void type_set_position(int l, int c, char *n)
int act_type_chan(Scope *sc, Chan *ch, int is_send, Expr *e, ActId *id, int override_id)
InstType * act_expr_insttype(Scope *s, Expr *e, int *islocal, int only_chan)
const char * act_type_errmsg(void)
int act_type_var(Scope *s, ActId *id, InstType **xit)
InstType * act_actual_insttype(Scope *s, ActId *id, int *islocal)
int act_type_expr(Scope *s, Expr *e, int *width, int only_chan=0)
int act_type_conn(Scope *, ActId *, AExpr *)
int type_chp_check_assignable(InstType *lhs, InstType *rhs)
int type_connectivity_check(InstType *lhs, InstType *rhs, int skip_last_array=0)