/***   Algol.c   ***/ /** ERRORS: 224 */

#include <stdio.h>
#include <stdlib.h>
#include "algol.h"
#include "clauses.h"
#include "init.h"

/*----------------------------------------------------------------------*/
/* standard variables */
int PX;	   /* end of program text in X[] */
int P;	   /* points to the next program symbol in X[] */
int J;	   /* last used element of LIND[] -- VIND[] */
int JGLOB; /* beginning of the actual dynamic range in LIND[] -- VIND[] */
int Z;	   /* stores the value of the elaborated object (index to A[]) */
int FS;    /* first in the chain of free elements in A[] -- D[] */
bool MORF; /* indicates whether should be deprocedured or not */
int PLAB;  /* to store the position of the label */
int dummy;
bool bummy;/* dummy variables */

/*----------------------------------------------------------------------*/
/* F, G, H */

int F= -10; int G = -11; int H = -12;

/*----------------------------------------------------------------------*/

short int *LIND, *VIND, *A, *D; int *B, *C; int init_A;
int max_PX, max_X; short int *X; int max_DN, *DN;

/*----------------------------------------------------------------------*/
#ifdef __TURBOC__
#define CDECL cdecl
#else
#define CDECL
#endif

int CDECL main(argc,argv) int argc; char *argv[];
{bool syntax_error; int Q;
	syntax_error=deal_arguments(argc,argv);
	if(program_printing(syntax_error)){/* syntax error */
#if DEBUG
	    create_IA(); create_X(); read_program(); PX=max_PX; dump(0);
#endif
	    exit(0);
	}
	create_IA(); /* makes memory for LIND,VIND, A,B,C,D */
	create_X();  /* makes memory for X (program) and DN (denotations) */
	read_program(); /* reads X and DN */
	Q=G; PX=max_PX; P=1; JGLOB=J;
	set_signals();
#if DEBUG
	O=argc<6?NULL:fopen(argv[5],"wb");
	if(O==NULL)O=stderr;
#endif
        must(enclosed_clause(&Q),224);
	reset_signals();
        printf("\n*****\n");
#if DEBUG
	dump(0); fclose(O);
#endif
	return(0);
}

