Java Parser (Front End)

The Java parser (front end) enables the construction of Java custom compilers, analysis tools, or source transformation tools. It is a member of SD's family of language front ends, based on first-class infrastructure (DMS) for implementing such custom tools. The Java front end includes:

  • Lexical analysis including parsing sources in ASCII, ISO8859-1 and UNICODE
    • Conversion of literal values (numbers, escaped strings) into native values to enable easy computation over literal values
    • String literals represented internally in UNICODE to support 16-bit characters
  • Explicit grammar directly implements Java 1.3-1.6 and Java 7 dialects
    • Full Java Parser
    • Supports RealTime Java definition
  • Automatic construction of complete abstract syntax tree
    • Capture of comments and formats (shape) of literal values
    • Ability to parse large systems files into same workspace, enabling interprocedural and cross-file analysis/transformation
    • Ability to parse different languages into same workspace, enabling cross-language analysis/transformation
  • Facilities to process syntax trees
    • Complete procedural API to visit/query/update/construct/print syntax trees
    • Source regeneration by prettyprinting and/or fidelity printing of syntax trees with comments and lexical formats
    • Automatically generated source-to-source transformation system
    • Ability to define custom attribute-grammar-based analyzers
  • Name and Type resolution (Java 1.3-1.6)
    • Type representation system for all Java types defined
    • All identifiers resolved to their Java-defined type and stored in symbol tables
      • Reads .class files (1.3-1.4) as needed to obtain definitions
      • Reads/parses/name resolves other Java source files as needed to obtain definitions
      • Parsing/Name resolution carried out in parallel
    • Ability to condition transforms on identifier type
    • Ability to visit/query/update symbol tables
    • Rename identifier and update corresponding tree nodes
  • Control flow graph extraction for each source file (Java 1.3, 1.4; 1.5, 1.6 being completed)
    • Constructed for each method definition
    • Ties control flow nodes to ASTs
    • Computes Post-dominators
    • Computes Control Dependences (Sample control flow graph)
  • Call graph extraction for entire application (Java 1.3, 1.4; 1.5, 1.6 being completed)
  • Data Flow Analysis support
    • Forward and Backward Iterative Flow analyzers
    • Reaching definitions for scalar values, class members, arrays, objects, and parameters (Sample reaching definitions graph)
    • Use-definition chains
    • Definition-use chains
    • Reachable-uses analysis
  • Available as source code to enable complete customization
    • Means to manage multiple language dialects with highly shared common core
  • Robustness due to careful testing and application across many customers

Many of these facilities come as a consistent consequence of the front end being built to top of DMS.

Here are some sample tools (many offered by SD as products) built using the Java front end:

Your organization may use DMS with the Java front end to implement and deploy your own custom tools. The sample tools can be obtained in source form as part of the Java front end for customization. Semantic Designs is also willing to build custom tools under contract.

For more information:    Follow us at Twitter: @SemanticDesigns

Java Parser
Front End