A newer version, safety commit

This commit is contained in:
ceriel
1986-03-26 15:11:02 +00:00
parent a5ba27fd3b
commit dc106691e0
28 changed files with 1034 additions and 222 deletions

View File

@@ -1,17 +1,43 @@
{
#include "idf.h"
#include "idlist.h"
#include "LLlex.h"
/* D E C L A R A T I O N S */
{
static char *RcsId = "$Header$";
#include <em_arith.h>
#include <em_label.h>
#include "idf.h"
#include "misc.h"
#include "LLlex.h"
#include "def.h"
#include "type.h"
#include "scope.h"
}
ProcedureDeclaration:
ProcedureHeading ';' block IDENT
ProcedureDeclaration
{
register struct def *df;
} :
/* ProcedureHeading(&df) */
PROCEDURE IDENT
{ df = define(dot.TOK_IDF, CurrentScope, D_PROCEDURE);
open_scope(OPENSCOPE, 0);
}
FormalParameters?
';' block IDENT
{ match_id(dot.TOK_IDF, df->df_idf);
close_scope();
}
;
ProcedureHeading:
PROCEDURE IDENT FormalParameters?
ProcedureHeading
{
register struct def *df;
} :
/* Only used for definition modules
*/
PROCEDURE IDENT
{ df = define(dot.TOK_IDF, CurrentScope, D_PROCHEAD); }
FormalParameters?
;
block:
@@ -32,22 +58,34 @@ declaration:
FormalParameters:
'(' [ FPSection [ ';' FPSection ]* ]? ')'
[ ':' qualident ]?
[ ':' qualident
]?
;
FPSection
{
struct id_list *FPList;
int VARflag = 0;
} :
VAR? IdentList(&FPList) ':' FormalType
[
VAR { VARflag = 1; }
]?
IdentList(&FPList) ':' FormalType
{
FreeIdList(FPList);
}
;
FormalType:
[ ARRAY OF ]? qualident
;
TypeDeclaration:
IDENT '=' type
TypeDeclaration
{
register struct def *df;
}:
IDENT { df = define(dot.TOK_IDF, CurrentScope, D_TYPE); }
'=' type
;
type:
@@ -169,8 +207,12 @@ FormalTypeList:
[ ':' qualident ]?
;
ConstantDeclaration:
IDENT '=' ConstExpression
ConstantDeclaration
{
register struct def *df;
}:
IDENT { df = define(dot.TOK_IDF, CurrentScope, D_CONST); }
'=' ConstExpression
;
VariableDeclaration