FORM  4.1
Data Structures | Macros | Typedefs | Functions | Variables
compiler.c File Reference
#include "form3.h"

Go to the source code of this file.

Data Structures

struct  SuBbUf
 

Macros

#define OPTION0   1
 
#define OPTION1   2
 
#define OPTION2   3
 
#define REDUCESUBEXPBUFFERS
 

Typedefs

typedef struct SuBbUf SUBBUF
 

Functions

VOID inictable ()
 
KEYWORDfindcommand (UBYTE *in)
 
int ParenthesesTest (UBYTE *sin)
 
UBYTE * SkipAName (UBYTE *s)
 
UBYTE * IsRHS (UBYTE *s, UBYTE c)
 
int IsIdStatement (UBYTE *s)
 
int CompileAlgebra (UBYTE *s, int leftright, WORD *prototype)
 
int CompileStatement (UBYTE *in)
 
int TestTables ()
 
int CompileSubExpressions (SBYTE *tokens)
 
int CodeGenerator (SBYTE *tokens)
 
int CompleteTerm (WORD *term, UWORD *numer, UWORD *denom, WORD nnum, WORD nden, int sign)
 
int CodeFactors (SBYTE *tokens)
 
WORD GenerateFactors (WORD n, WORD inc)
 

Variables

int alfatable1 [27]
 
SUBBUFsubexpbuffers = 0
 
SUBBUFtopsubexpbuffers = 0
 
LONG insubexpbuffers = 0
 

Detailed Description

The heart of the compiler. It contains the tables of statements. It finds the statements in the tables and calls the proper routines. For algebraic expressions it runs the compilation by first calling the tokenizer, splitting things into subexpressions and generating the code. There is a system for recognizing already existing subexpressions. This economizes on the length of the output.

Note: the compiler of FORM doesn't attempt to normalize the input. Hence x+1 and 1+x are different objects during compilation. Similarly (a+b-b) will not be simplified to (a).

Definition in file compiler.c.

Macro Definition Documentation

#define REDUCESUBEXPBUFFERS
Value:
{ if ( (topsubexpbuffers-subexpbuffers) > 256 ) {\
M_free(subexpbuffers,"subexpbuffers");\
subexpbuffers = (SUBBUF *)Malloc1(256*sizeof(SUBBUF),"subexpbuffers");\
topsubexpbuffers = subexpbuffers+256; } insubexpbuffers = 0; }

Definition at line 235 of file compiler.c.