pass recursive descent parser token literal AST (Abstract Syntax Tree) non-terminal bootstrapHowever, advanced expert knowledge should not be required.
Furthermore, the following concepts familiar to lisp programmers appear.
macro, immutable object, symbol, S-expression, backquote macro, dynamic variableI shall explain these concepts as much as I can, so that readers who are not experienced in lisp can understand them.
Of the five plug-ins, the SystemMixin plug-in is especially important. The SystemMixin plug-in implements a new object oriented language called Ld-2 on top of Java.
(Application Programs) |
---|
EPP Plug-ins |
EPP Core / Java Grammar definition |
Object-Oriented Language Ld-2 |
JavaVM |
The Ld-2 lanaguage has a special inheritance mechanism that is different from that of the Java language. With this mechanism, a single class can be divided into multiple "components" called "mixins" which can be described separately. A class is built up by merging the multiple mixins.
In the current implementation, Ld-2 classes created by merging mixins are not compatible with classes of the Java language, and are defined using a different syntax. The syntax for calling methods is also different.
jp.go.etl.epp.epp.EppThe EPP main routine builds an EPP preprocessor with different configurations for each file to be processed, and invokes those preprocessors.
An EPP preprocessor is an Ld-2 class created by merging multiple mixins. A preprocessor for a specific file is built by creating an Ld-2 class combining the mixin for the plug-in that was specified at the beginning of the file, and the "mixin that defines the standard preprocessor".
Plug-ins can only extend the behavior of EPP preprocessors. They cannot extend the behavior of the EPP main routine. However, by creating a subclass of the jp.go.etl.epp.epp.Epp Java class, you can create a customized EPP main routine.
EPP executes the translation process on a file-by-file basis by default. However, if you specify the -global option, EPP goes into Global Processing Mode and will process all files globally.
The parsing pass will call the lexical analyzer as required. The lexical analyzer will read character-by-character from EppInputStream, a class that is the input stream for the EPP.
Plug-ins can extend the EppInputStream, lexical analyzer, parsing pass, macro expanssion pass, type checking pass, and code emitting pass.
You can also add additional passes prior to, and after the four passes. For further information on adding passes, refer to EPP Preprocessor Core.
Tokens are data types that are returned by the lexical analyzer.
The abstract syntax tree is created by the parsing pass, and then translated by the type checking pass, passed to the code emitting pass for conversion to character strings and finally written to the output file.
The abstract syntax tree has nodes that have type information and those that do not. The type checking pass converts an abstract syntax tree without type information into an abstract syntax tree with type information.
The three data types mentioned above are all immutable objects. That is, you cannot modify their internal state from within a program.
Plug-ins cannot define subclasses of a class that describes tokens or abstract syntax trees. The data structure of tokens and abstract syntax trees are very versatile and new tokens and syntaxes can be expressed without adding new subclasses.
For further information please refer to the following paper:
??IDEAC>"高いモジュラリティと拡張性を持つ構文解析器"???IDEAC>
Epp.java EPP main routine definition EppCore.java EPP preprocessor main portion EppInputStream.java EPP input stream Lex.java lexical analyzer CompUnit.java Java program top level syntax definition TypeDecl.java class, interface, method, field syntax defintion Statement.java statement syntax definition ExpNonTerm.java non-terminal definition related to expressions Exp.java expression syntax definition TypeSystem.java definition of the Type class and definition of type semantics TypeCheck.java definition of the standard Java type checking object FileSig.java definition of class types and seperate compilation processing