pascalinterpreter.analysis
Class Compiler

java.lang.Object
  extended bypascalinterpreter.analysis.Compiler

public class Compiler
extends java.lang.Object


Field Summary
private  Analyser analyser
           
private  int BEGIN
           
private  int CONST
           
private  int DISPOSE
           
private  int DO
           
private  int ELSE
           
private  int END
           
private  int FOR
           
private  int IF
           
(package private)  boolean isLineNext
           
private  java.lang.String line
           
private  int NEW
           
private  Program program
           
private  int PROGRAM
           
private  int READ
           
private  int READLN
           
(package private)  int section
           
private  int THEN
           
private  int TO
           
private  java.util.StringTokenizer tokens
           
private  int VAR
           
private  int WHILE
           
private  int WRITE
           
private  int WRITELN
           
 
Constructor Summary
Compiler(java.lang.String code)
           
 
Method Summary
private  DataType checkType(java.lang.String value)
           
private  void createAnalyseException(AnalyseException exc)
           
private  BinaryOperation createBinaryOperation(java.lang.String opL, java.lang.String oper, java.lang.String opR)
           
private  Block createBlock()
           
private  Command[] createCommands()
           
private  Constant createConst(java.lang.String value)
           
private  For createFor()
           
private  IfElse createIfElse()
           
private  IoOperation createIoOperation(java.lang.String operation, java.lang.String io)
           
private  UnaryOperation createUnaryOperation(java.lang.String op, java.lang.String operator)
           
private  While createWhile()
           
private  java.lang.String getKeyword(int keyword)
           
private  Operator getOperator(java.lang.String name)
           
private  DataType getType(java.lang.String typeDescr)
           
private  Variable getVariable(java.lang.String name)
           
private  boolean isVal(java.lang.String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokens

private java.util.StringTokenizer tokens

line

private java.lang.String line

section

int section

isLineNext

boolean isLineNext

PROGRAM

private final int PROGRAM
See Also:
Constant Field Values

CONST

private final int CONST
See Also:
Constant Field Values

VAR

private final int VAR
See Also:
Constant Field Values

BEGIN

private final int BEGIN
See Also:
Constant Field Values

END

private final int END
See Also:
Constant Field Values

IF

private final int IF
See Also:
Constant Field Values

THEN

private final int THEN
See Also:
Constant Field Values

ELSE

private final int ELSE
See Also:
Constant Field Values

WHILE

private final int WHILE
See Also:
Constant Field Values

DO

private final int DO
See Also:
Constant Field Values

FOR

private final int FOR
See Also:
Constant Field Values

TO

private final int TO
See Also:
Constant Field Values

NEW

private final int NEW
See Also:
Constant Field Values

DISPOSE

private final int DISPOSE
See Also:
Constant Field Values

READLN

private final int READLN
See Also:
Constant Field Values

READ

private final int READ
See Also:
Constant Field Values

WRITELN

private final int WRITELN
See Also:
Constant Field Values

WRITE

private final int WRITE
See Also:
Constant Field Values

program

private Program program

analyser

private Analyser analyser
Constructor Detail

Compiler

public Compiler(java.lang.String code)
         throws AnalyseException,
                InternalException
Method Detail

createAnalyseException

private void createAnalyseException(AnalyseException exc)
                             throws AnalyseException
Throws:
AnalyseException

getKeyword

private java.lang.String getKeyword(int keyword)

isVal

private boolean isVal(java.lang.String text)

createBinaryOperation

private BinaryOperation createBinaryOperation(java.lang.String opL,
                                              java.lang.String oper,
                                              java.lang.String opR)
                                       throws AnalyseException,
                                              InternalException
Throws:
AnalyseException
InternalException

createUnaryOperation

private UnaryOperation createUnaryOperation(java.lang.String op,
                                            java.lang.String operator)
                                     throws AnalyseException,
                                            InternalException
Throws:
AnalyseException
InternalException

createConst

private Constant createConst(java.lang.String value)
                      throws InternalException
Throws:
InternalException

checkType

private DataType checkType(java.lang.String value)
                    throws InternalException
Throws:
InternalException

getType

private DataType getType(java.lang.String typeDescr)
                  throws InternalException
Throws:
InternalException

getVariable

private Variable getVariable(java.lang.String name)
                      throws AnalyseException
Throws:
AnalyseException

getOperator

private Operator getOperator(java.lang.String name)
                      throws InternalException
Throws:
InternalException

createIfElse

private IfElse createIfElse()
                     throws AnalyseException,
                            InternalException
Throws:
AnalyseException
InternalException

createWhile

private While createWhile()
                   throws AnalyseException,
                          InternalException
Throws:
AnalyseException
InternalException

createFor

private For createFor()
               throws AnalyseException,
                      InternalException
Throws:
AnalyseException
InternalException

createIoOperation

private IoOperation createIoOperation(java.lang.String operation,
                                      java.lang.String io)
                               throws InternalException,
                                      AnalyseException
Throws:
InternalException
AnalyseException

createBlock

private Block createBlock()
                   throws AnalyseException,
                          InternalException
Throws:
AnalyseException
InternalException

createCommands

private Command[] createCommands()
                          throws AnalyseException,
                                 InternalException
Throws:
AnalyseException
InternalException