PPJ Manual
HomeCurrent IssuesDownloads
  • Welcome
  • Releases
    • PPJ 2023
  • PPJ 2023
  • PPJ Web API
  • PPJ Desktop API
  • Wisej.NET Documentation
  • General
    • Framework
      • Features
        • SAL and SQL Functions
        • Constants and Variables
        • SalContext
        • Visual Toolchest
        • XSal2
        • Reporting Support
        • LINQ Support
        • SalCompileAndEvaluate
        • Unicode Support
        • Startup Arguments
        • App.config
      • Data Types
        • Automatic Casts
        • Dynamic Arrays
      • Controls
        • ToolBar
        • TabControl
        • TableWindow
        • QuickObject
        • Ribbon Bar
        • NavigationBar
      • SQL Support
        • Configuration
        • ADO.NET Drivers
        • Bind and Into Variables
        • DBP Parameters
        • SqlContext
      • Extensions
        • Table Window
        • Unicode Support
        • Bug Fixes
        • Object Oriented Types
        • Custom Parsers
        • Named Properties
        • Microsoft Charts
        • Tabbed MDI
        • Watermark
        • HTML Rendering
      • Skins and Themes
        • Skin Files
        • Theme Files
        • Configuration
        • Skin Editor
        • Theme Builder
      • Tracing
        • Trace Viewer
        • Default Listeners
        • Tracing the Application
      • Spell Checker
        • Dictionaries
    • Ported Application
      • Project Structure
        • Late Bind Calls
        • Visual Styles
        • Unqualified References
        • Message Actions
        • When SQLError
        • Classes
      • Global Items
      • Forms
      • COM/ActiveX
      • Multiple Inheritance
      • Configuration Tool
      • Issues & Workarounds
    • Ported Reports
      • General
      • Crystal Reports
        • Structure
        • Unsupported Features
      • List & Label
        • Report Conversion
        • Structure
        • Document
        • Input Items
        • Passing Data
        • Unsupported Features
      • Reporting Services
        • Features
      • Stimulsoft
        • Break Groups
        • Fields
        • Formulas
        • Cache Mode
Powered by GitBook
On this page

Was this helpful?

  1. General
  2. Framework
  3. Extensions

Custom Parsers

A very powerful feature of the Porting Project is the built-in interpreter that is used to support SalCompileAndEvaluate and to resolve bind/into expressions in sql statements. The interpreter executes a code tree expressed as a structured collection of code objects. The code tree can be generated in any way. Usually it's generated by a parser that parses the source code language into a code tree.

The built-in parser supports C# syntax only. However it is possible to plug-in a custom parser that is responsible only for the parsing of the source code. A custom parser class needs only to implement the PPJ.Runtime.Scripting.IScriptParser interface which defines only one method:

public interface IScriptParser
{
 ASTNode Parse(string script);
}

The custom parser should only parse the source code text into an Abstract Statement Tree (AST).

To register the custom parser to be used only with SalCompileAndEvaluate use:

Sal.Interpreter.Parser = new MyParser();

To register the custom parser to be used only with XSalScript, use:

XSalScript.Interpreter.Parser = new MyParser();

To register the custom parser to be the default parser for everything, including bind/into expressions evaluations, use:

PPJ.Runtime.Scriping.ScriptEngine.DefaultParserType = typeof(MyParser);

All AST classes are derived from ASTNode and are available in the PPJ.Runtime.Scripting namespace. There is no public reference manual about the AST classes and if you need to write your parser we can provide sample code for your reference and professional support upon request.

PreviousObject Oriented TypesNextNamed Properties

Last updated 2 years ago

Was this helpful?