A Tree-sitter parser for the Appeon PowerBuilder 2022 R3 scripting language.
This project provides a parser grammar for PowerBuilder scripting language (Appeon PowerBuilder 2022 R3) based on Tree-sitter. The motivation behind this work is to enable better tooling support for PowerBuilder scripts — such as syntax highlighting, code navigation, and static analysis — by providing a reliable and formal grammar specification. PowerBuilder remains widely used in legacy enterprise applications, and modernizing its development experience is critical for maintainability and productivity.
The parser grammar is designed to be lightweight and extensible, focusing on the core syntax elements that appear most commonly in real-world PowerBuilder scripts.
-
Basic Types
Support for PowerBuilder primitive types:integer,string,boolean,blob,decimal,long,any,date,datetime, and more. -
Variables
Declaration with optional modifiers (public,private,global), support for arrays with dimensions, and optional initializers. -
Expressions
- Literals: numbers, strings (with escape sequences), booleans (
true,false), andnull - Identifiers and member access (
object.property) - Binary expressions with common operators (
+,-,*,/, comparison operators,and,or) - Function calls with argument lists and nested expressions
- Parenthesized expressions and array literals
- Literals: numbers, strings (with escape sequences), booleans (
-
Statements
- Label and
gotostatements - Expression statements
- Conditional statements:
if...then...elseif...else...end if - Looping constructs:
for...to...step...next/end for,do...while/until...loop returnandthrowstatementstry...catch...finally...end tryerror handling- Object lifecycle:
create,destroy haltstatement with optionalclosechoose casestatements withcaseandcase elsecallstatement to invoke ancestor scripts and controls
- Label and
The following features and improvements are planned for future releases:
-
Enhanced Expression Support
- More complex expression parsing (ternary operators, unary operators, typecasting)
- Support for function definitions and nested functions
-
More Complete Syntax Coverage
- Full support for PowerBuilder events and window/control-specific syntax
- Advanced control structures and scripting constructs
-
Semantic Analysis
- Type checking and symbol resolution for better error detection
- Ancestor object hierarchy resolution for
callstatements
-
Integration
- Integration with popular editors and IDEs for syntax highlighting and autocomplete
- Tooling support for refactoring and code navigation
-
Testing and Validation
- Extensive test suite with real-world PowerBuilder scripts
- Performance optimizations and bug fixes
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to contribute or raise issues to help improve this parser!
Author: Mortimer Gibbons
Contact: [email protected]
Repository: https://github.com/lmortimerl/tree-sitter-powerscript