/* stb.c -- Implementation File (module.c template V1.0)
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Contributed by James Craig Burley.
This file is part of GNU Fortran.
GNU Fortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Fortran is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Fortran; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
Related Modules:
st.c
Description:
Parses the proper form for statements, builds up expression trees for
them, but does not actually implement them. Uses ffebad (primarily via
ffesta_ffebad_start) to indicate errors in form. In many cases, an invalid
statement form indicates another possible statement needs to be looked at
by ffest. In a few cases, a valid statement form might not completely
determine the nature of the statement, as in REALFUNCTIONA(B), which is
a valid form for either the first statement of a function named A taking
an argument named B or for the declaration of a real array named FUNCTIONA
with an adjustable size of B. A similar (though somewhat easier) choice
must be made for the statement-function-def vs. assignment forms, as in
the case of FOO(A) = A+2.0.
A given parser consists of one or more state handlers, the first of which
is the initial state, and the last of which (for any given input) returns
control to a final state handler (ffesta_zero or ffesta_two, explained
below). The functions handling the states for a given parser usually have
the same names, differing only in the final number, as in ffestb_foo_
(handles the initial state), ffestb_foo_1_, ffestb_foo_2_ (handle
subsequent states), although liberties sometimes are taken with the "foo"
part either when keywords are clarified into given statements or are
transferred into other possible areas. (For example, the type-name
states can hop over to _dummy_ functions when the FUNCTION or RECURSIVE
keywords are seen, though this kind of thing is kept to a minimum.) Only
the names without numbers are exported to the rest of ffest; the others
are local (static).
Each initial state is provided with the first token in ffesta_tokens[0],
which will be killed upon return to the final state (ffesta_zero or
ffelex_swallow_tokens passed through to ffesta_zero), so while it may
be changed to another token, a valid token must be left there to be
killed. Also, a "convenient" array of tokens are left in
ffesta_tokens[1..FFESTA_tokensMAX]. The initial state of this set of
elements is undefined, thus, if tokens are stored here, they must be
killed before returning to the final state. Any parser may also use
cross-state local variables by sticking a structure containing storage
for those variables in the local union ffestb_local_ (unless the union
goes on strike). Furthermore, parsers that handle more than one first or
second tokens (like _varlist_, which handles EXTERNAL, INTENT, INTRINSIC,
OPTIONAL,
PUBLIC, or PRIVATE, and _endxyz_, which handles ENDBLOCK, ENDBLOCKDATA,
ENDDO, ENDIF, and so on) may expect arguments from ffest in the
ffest-wide union ffest_args_, the substructure specific to the parser.
A parser's responsibility is: to call either ffesta_confirmed or
ffest_ffebad_start before returning to the final state; to be the only
parser that can possibly call ffesta_confirmed for a given statement;
to call ffest_ffebad_start immediately upon recognizing a bad token
(specifically one that another statement parser might confirm upon);
to call ffestc functions only after calling ffesta_confirmed and only
when ffesta_is_inhibited returns FALSE; and to call ffesta_is_inhibited
only after calling ffesta_confirmed. Confirm as early as reasonably
possible, even when only one ffestc function is called for the statement
later on, because early confirmation can enhance the error-reporting
capabilities if a subsequent error is detected and this parser isn't
the first possibility for the statement.
To assist the parser, functions like ffesta_ffebad_1t and _1p_ have
been provided to make use of ffest_ffebad_start fairly easy.
Modifications:
*/
/* Include files. */
#include "proj.h"
#include "stb.h"
#include "bad.h"
#include "expr.h"
#include "lex.h"
#include "malloc.h"
#include "src.h"
#include "sta.h"
#include "stc.h"
#include "stp.h"
#include "str.h"
/* Externals defined here. */
struct _ffestb_args_ ffestb_args;
/* Simple definitions and enumerations. */
#define FFESTB_KILL_EASY_ 1 /* 1 for only one _subr_kill_xyz_ fn. */
/* Internal typedefs. */
union ffestb_subrargs_u_
{
struct
{
ffesttTokenList labels; /* Input arg, must not be NULL. */
ffelexHandler handler; /* Input arg, call me when done. */
bool ok; /* Output arg, TRUE if list ended in
CLOSE_PAREN. */
}
label_list;
struct
{
ffesttDimList dims; /* Input arg, must not be NULL. */
ffelexHandler handler; /* Input arg, call me when done. */
mallocPool pool; /* Pool to allocate into. */
bool ok; /* Output arg, TRUE if list ended in
CLOSE_PAREN. */
ffeexprContext ctx; /* DIMLIST or DIMLISTCOMMON. */
#ifdef FFECOM_dimensionsMAX
int ndims; /* For backends that really can't have
infinite dims. */
#endif
}
dim_list;
struct
{
ffesttTokenList args; /* Input arg, must not be NULL. */
ffelexHandler handler; /* Input arg, call me when done. */
ffelexToken close_paren;/* Output arg if ok, CLOSE_PAREN token. */
bool is_subr; /* Input arg, TRUE if list in subr-def
context. */
bool ok; /* Output arg, TRUE if list ended in
CLOSE_PAREN. */
bool names; /* Do ffelex_set_names(TRUE) before return. */
}
name_list;
};
union ffestb_local_u_
{
struct
{
ffebld expr;
}
call_stmt;
struct
{
ffebld expr;
}
go_to;
struct
{
ffebld dest;
bool vxtparam; /* If assignment might really be VXT
PARAMETER stmt. */
}
let;
struct
{
ffebld expr;
}
if_stmt;
struct
{
ffebld expr;
}
else_stmt;
struct
{
ffebld expr;
}
dowhile;
struct
{
ffebld var;
ffebld start;
ffebld end;
}
do_stmt;
struct
{
bool is_cblock;
}
R522;
struct
{
ffebld expr;
bool started;
}
parameter;
struct
{
ffesttExprList exprs;
bool started;
}
equivalence;
struct
{
ffebld expr;
bool started;
}
data;
struct
{
ffestrOther kw;
}
varlist;
#if FFESTR_F90
struct
{
ffestrOther kw;
}
type;
#endif
struct
{
ffelexHandler next;
}
construct;
struct
{
ffesttFormatList f;
ffestpFormatType current; /* What we're currently working on. */
ffelexToken t; /* Token of what we're currently working on. */
ffesttFormatValue pre;
ffesttFormatValue post;
ffesttFormatValue dot;
ffesttFormatValue exp;
bool sign; /* _3_, pos/neg; elsewhere, signed/unsigned. */
bool complained; /* If run-time expr seen in nonexec context. */
}
format;
#if FFESTR_F90
struct
{
bool started;
}
moduleprocedure;
#endif
struct
{
ffebld expr;
}
selectcase;
struct
没有合适的资源?快使用搜索试试~ 我知道了~
gcc-2.95.3.tar.gz
4星 · 超过85%的资源 需积分: 10 58 下载量 16 浏览量
2010-12-25
01:37:28
上传
评论
收藏 12.31MB GZ 举报
温馨提示
共2000个文件
h:869个
c:859个
in:85个
gcc-2.95.3.tar.gz交叉工具链
资源推荐
资源详情
资源评论
收起资源包目录
gcc-2.95.3.tar.gz (2000个子文件)
ChangeLog.0 462KB
ChangeLog.0 173KB
ChangeLog.1 340KB
gcc.1 107KB
g++.1 18KB
cccp.1 15KB
g77.1 9KB
dbz.1 5KB
info.1 5KB
cpp.1 16B
FSFChangeLog.10 381KB
FSFChangeLog.11 550KB
dbz.3z 12KB
ABOUT-GCC-NLS 18KB
ABOUT-NLS 11KB
ABOUT-NLS 11KB
README.ACORN 738B
f2ch.add 6KB
f2ch.add 6KB
algorithm 1KB
altbytes 176B
README.ALTOS 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 761B
Makefile.am 684B
Makefile.am 491B
Makefile.am 446B
Makefile.am 384B
README.APOLLO 3KB
lb1sf68.asm 94KB
lib1funcs.asm 27KB
lib1funcs.asm 25KB
lib1funcs.asm 21KB
eabi.asm 18KB
lb1spc.asm 16KB
lib1thumb.asm 16KB
lib1funcs.asm 15KB
lib1funcs.asm 13KB
lib1funcs.asm 11KB
lib1funcs.asm 7KB
ee_fp.asm 6KB
ee.asm 6KB
sol2-gc1.asm 5KB
sol2-c1.asm 5KB
lib1funcs.asm 5KB
crtbegin.asm 4KB
lb1spl.asm 4KB
tramp.asm 3KB
eabi-ci.asm 3KB
sol2-c1.asm 3KB
crtend.asm 3KB
sol-ci.asm 3KB
eabi-cn.asm 3KB
sol2-g1.asm 3KB
sol-cn.asm 3KB
lib2funcs.asm 3KB
osf1-ci.asm 2KB
sol2-ci.asm 2KB
sol2-cn.asm 2KB
sol2-ci.asm 2KB
nt-ci.asm 2KB
nt-cn.asm 2KB
osf1-cn.asm 2KB
sol2-cn.asm 2KB
ntstack.asm 955B
cygwin.asm 735B
uwin.asm 733B
aux-crt2.asm 673B
aux-crtn.asm 298B
vms-tramp.asm 292B
AUTHORS 109B
config-nt.bat 2KB
configur.bat 2KB
configure.bat 440B
configure.bat 293B
BINARIES 2KB
bitset 33KB
.brik 107KB
chill.brochure 7KB
BUGS 8KB
BUGS 1KB
BUILD 4KB
build-make 1KB
stb.c 704KB
expr.c 553KB
parse.c 486KB
com.c 470KB
decl.c 462KB
combine.c 402KB
parse.c 376KB
expr.c 367KB
stc.c 348KB
reload1.c 333KB
dwarf2out.c 305KB
loop.c 303KB
cccp.c 298KB
pt.c 286KB
cse.c 281KB
haifa-sched.c 253KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
sea10509
- 粉丝: 20
- 资源: 76
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页