All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----epp.EppCore
EppCore.java file defines methods of the EPP preprocessor
that define the framework of the EPP preprocessor.
Note: This class is provided for the sake of creating javadocs. It does not exist in the actual EPP source code.
The EPP preprocessor comprises of four passes, which are the parsing pass,
macro expansion pass, type checking pass, and code emitting pass.
Each pass passes the abstract syntax tree using a variable (an instance variable
of an LD-2 class) named self!tree.
Each pass has the following structure so that a plug-in can add new passes before and after each pass.
    void doTypeCheckingPass() {
      beforeTypeCheckingPass();// hook for adding a pass
      ...;			// pre-processing
      typeCheckingPass();	// main processing
      ...;			// post-processing
      afterTypeCheckingPass();	// hook for adding a pass
    }
The other three passes, parsingPass,
macroExpansionPass, and codeEmittingPass
also are similar in structure.
A plug-in can add new passes before and after each pass by extending
the methods afterXxxPass and beforeXxxPass.
The added passes can process global conversion that local conversions
of objects such as the macro expansion object cannot handle.
Methods that define the pass's "main portion" (typeCheckingPass
method for example), can be used to create an environment for dynamic
variables while executing a pass.
Example:
SystemMixin bindTypeCheckingEnv {
  class Epp {
    extend void typeCheckingPass(){
      Dynamic.bind(:foo, val);
      try{
	original();
      } finally {
	Dynamic.unbind();
      }
    }
  }
}
 
 EppCore()
	EppCore()
   
 afterCodeEmittingPass()
	afterCodeEmittingPass()
   afterMacroExpansionPass()
	afterMacroExpansionPass()
   afterParsingPass()
	afterParsingPass()
   backtrack(int)
	backtrack(int)
  EppInputStream
in argument p, reads one token, and updates the
"look ahead token".
   beforeCodeEmittingPass()
	beforeCodeEmittingPass()
   beforeMacroExpansionPass()
	beforeMacroExpansionPass()
   beforeParsingPass()
	beforeParsingPass()
   codeEmittingPass()
	codeEmittingPass()
   defineEmitter(Symbol, Emitter)
	defineEmitter(Symbol, Emitter)
   defineInvokeStyleMacro(Symbol, InvokeStyleMacro)
	defineInvokeStyleMacro(Symbol, InvokeStyleMacro)
  InvokeStyleMacro to the table.
   defineMacro(Symbol, Macro)
	defineMacro(Symbol, Macro)
   doCodeEmittingPass()
	doCodeEmittingPass()
   doMacroExpansionPass()
	doMacroExpansionPass()
   doParsingPass()
	doParsingPass()
   doTypeCheckingPass()
	doTypeCheckingPass()
   emit1(String, Tree)
	emit1(String, Tree)
  tree as a string to outputFileName.
   emitAdditionalHeader(OutputStream)
	emitAdditionalHeader(OutputStream)
   Epp(String, String)
	Epp(String, String)
   eppSourceVersion()
	eppSourceVersion()
   eppVersion()
	eppVersion()
   error(String)
	error(String)
  EppUserError class.
   extendMacro(Symbol, Macro)
	extendMacro(Symbol, Macro)
   initEmitterTable()
	initEmitterTable()
  Emitter.
   initializationPass()
	initializationPass()
   initInvokeStyleMacroTable()
	initInvokeStyleMacroTable()
  InvokeStyleMacro.
   initMacroTable()
	initMacroTable()
  Macro.macroTable.
   inputPointer()
	inputPointer()
  EppInputStream).
   lookahead()
	lookahead()
   macroExpansionPass()
	macroExpansionPass()
   match(Token)
	match(Token)
   matchAny()
	matchAny()
   openEppInputStream(String)
	openEppInputStream(String)
  EppInputStream stream that
reads characters from an input file.
   parsingPass()
	parsingPass()
   readToken(EppInputStream)
	readToken(EppInputStream)
  readTokenStar method, and
returns one token.
   redefineEmitter(Symbol, Emitter)
	redefineEmitter(Symbol, Emitter)
   redefineInvokeStyleMacro(Symbol, InvokeStyleMacro)
	redefineInvokeStyleMacro(Symbol, InvokeStyleMacro)
  InvokeStyleMacro registerd with the table.
   start()
	start()
   
 EppCore
EppCore
public EppCore()
 
 Epp
Epp
 public void Epp(String inputFileName,
                 String outputFileName)
Epp.
This method is called from the EPP main routine
(a Java class name Epp).
 initializationPass
initializationPass
public void initializationPass()
 doParsingPass
doParsingPass
public void doParsingPass()
 doMacroExpansionPass
doMacroExpansionPass
public void doMacroExpansionPass()
 doTypeCheckingPass
doTypeCheckingPass
public void doTypeCheckingPass()
 doCodeEmittingPass
doCodeEmittingPass
public void doCodeEmittingPass()
 error
error
public Error error(String str)
EppUserError class.
Call this method when end user level errors such as input program
syntax errors occur.
A typical usage of this method is shown below.
   throw error("message");
If a fatal error occured, use Epp.fatal instead of this method.	    @see epp.EppUserError
 lookahead
lookahead
public Token lookahead()
 match
match
public Token match(Token token)
error method is called with a
comprehensible message.
 matchAny
matchAny
public Token matchAny()
 start
start
public Tree start()
 readToken
readToken
public Token readToken(EppInputStream in)
readTokenStar method, and
returns one token.
This method is called from the matchAny() method.
Do not call this method directly from
from the parsing routine.
 openEppInputStream
openEppInputStream
public EppInputStream openEppInputStream(String inputFileName)
EppInputStream stream that
reads characters from an input file.
Plug-ins may extend the behaviour of an iput stream by
redefining this method and making it return a subclass of
EppInputStream.
(A Factory method of Design pattern.)
 beforeParsingPass
beforeParsingPass
public void beforeParsingPass()
 parsingPass
parsingPass
public void parsingPass()
 afterParsingPass
afterParsingPass
public void afterParsingPass()
 inputPointer
inputPointer
public int inputPointer()
EppInputStream).
The return value is used as an argument to the
backtrack method.
 backtrack
backtrack
public void backtrack(int p)
EppInputStream
in argument p, reads one token, and updates the
"look ahead token".
The next time lookahead() is called, the token
beginning immediately after p will be returned.
The int value specified as the argument must be retrieved
using the inputPointer method before calling
this method.
 initMacroTable
initMacroTable
public void initMacroTable()
Macro.macroTable.
Plug-ins may extend this method to add/extend macro expansion objects
registered in the table, by calling defineMacro or
extendMacro.
 defineMacro
defineMacro
 public void defineMacro(Symbol tag,
                         Macro func)
tag is already registered, a fatal error occurs.
 extendMacro
extendMacro
 public void extendMacro(Symbol tag,
                         Macro func)
func through variable orig.
 beforeMacroExpansionPass
beforeMacroExpansionPass
public void beforeMacroExpansionPass()
 macroExpansionPass
macroExpansionPass
public void macroExpansionPass()
 afterMacroExpansionPass
afterMacroExpansionPass
public void afterMacroExpansionPass()
 defineInvokeStyleMacro
defineInvokeStyleMacro
 public void defineInvokeStyleMacro(Symbol tag,
                                    InvokeStyleMacro func)
InvokeStyleMacro to the table.
 redefineInvokeStyleMacro
redefineInvokeStyleMacro
 public void redefineInvokeStyleMacro(Symbol tag,
                                      InvokeStyleMacro func)
InvokeStyleMacro registerd with the table.
 initInvokeStyleMacroTable
initInvokeStyleMacroTable
public void initInvokeStyleMacroTable()
InvokeStyleMacro.
Plug-ins may extend this method to add/extend
InvokeStyleMacro objects registered in the table,
by calling defineInvokeStyleMacro or
redefineInvokeStyleMacro.
 initEmitterTable
initEmitterTable
public void initEmitterTable()
Emitter.
Plug-in prorammers normally should not extend this method.
 defineEmitter
defineEmitter
 public void defineEmitter(Symbol tag,
                           Emitter func)
 redefineEmitter
redefineEmitter
 public void redefineEmitter(Symbol tag,
                             Emitter func)
 beforeCodeEmittingPass
beforeCodeEmittingPass
public void beforeCodeEmittingPass()
 codeEmittingPass
codeEmittingPass
public void codeEmittingPass()
 afterCodeEmittingPass
afterCodeEmittingPass
public void afterCodeEmittingPass()
 emit1
emit1
 public void emit1(String outputFileName,
                   Tree tree)
tree as a string to outputFileName.
However, if outputFileName already exists and is not a
"file generated by EPP", an EppUserError is thrown.
 emitAdditionalHeader
emitAdditionalHeader
public void emitAdditionalHeader(OutputStream out)
emit1.
 eppVersion
eppVersion
public String eppVersion()
 eppSourceVersion
eppSourceVersion
public String eppSourceVersion()
All Packages Class Hierarchy This Package Previous Next Index