Skip to content

Conversation

@paul-hammant
Copy link
Contributor

Implements a comprehensive REXX interpreter for ChrysaLisp with strong RexxJS grammar compatibility, featuring ARexx-style IPC via ADDRESS/PORTS and modern REXX language extensions.

Core Language Features:

  • Variable assignment (classic and LET keyword)
  • String interpolation with {variable} syntax
  • || string concatenation operator
  • HEREDOC multi-line strings (<<DELIMITER ... DELIMITER)
  • Escape sequences (\n, \t, \r, \, ")
  • Comments (// C-style and -- REXX-style)

Control Flow:

  • IF/THEN/ELSE (single-line and multi-line blocks)
  • SELECT/WHEN/OTHERWISE multi-way branching
  • DO loops (counted with TO/BY, WHILE, FOREVER, OVER)
  • LEAVE and ITERATE loop control
  • EXIT with return codes

Advanced Features:

  • CALL/RETURN subroutines with local scopes
  • SIGNAL for computed jumps
  • INTERPRET for dynamic code execution
  • PARSE (VAR, VALUE, ARG) for string parsing
  • Stem variables (REXX arrays with .0 count convention)

String Functions (40+):

  • UPPER, LOWER, LENGTH, SUBSTR, PROPER, TRIM
  • PAD_START, PAD_END, CENTER, SPACE
  • STARTS_WITH, ENDS_WITH, INCLUDES
  • IS_ALPHA, IS_NUMERIC, IS_ALPHANUMERIC
  • CHANGESTR, WORDPOS, DELWORD, SUBWORD, ABBREV
  • SLUG, REPEAT, INDEXOF, VERIFY, COMPARE, COPIES
  • C2X, X2C, X2D, D2X, X2B, B2X (conversion functions)

Math Functions:

  • ABS, SIGN, MAX, MIN
  • MATH_CEIL, MATH_FLOOR, MATH_ROUND, MATH_SQRT, MATH_POWER

Array Operations:

  • ARRAY, PUSH, POP, JOIN
  • DO OVER iteration (RexxJS extension)

JSON Support:

  • JSON_STRINGIFY, JSON_PARSE
  • CSV_TO_JSON, JSON_TO_CSV

IPC System (ARexx-style):

  • ADDRESS statement for target switching
  • PORT system for inter-process communication
  • SEND/RECEIVE mailbox operations
  • ADDRESS SYSTEM for ChrysaLisp native Lisp execution
  • Live IPC demo with ECHO service

Files Created:

  • apps/rexx/interpreter.inc (2000+ lines core interpreter)
  • apps/rexx/ports.inc (IPC implementation)
  • apps/rexx/app.lisp, actions.inc, widgets.inc (GUI)
  • apps/rexx/tests/test_suite.rex (59 automated tests)
  • apps/rexx/examples/ (20+ example programs)
  • apps/rexx/REXXJS_COMPATIBILITY.md (compatibility analysis)
  • apps/rexx/echo_service.lisp, system_port.lisp (IPC services)

RexxJS Compatibility:

  • ~80% core language compatibility
  • 100+ functions implemented
  • Focus on ChrysaLisp-appropriate features
  • Deferred: HTTP, REQUIRE, file I/O, DOM (environment-dependent)

Test Coverage:

  • 59/59 automated tests passing
  • Examples for all major features
  • Comprehensive test suite with live IPC demonstrations

Documentation:

  • README.md with feature overview
  • REXXJS_COMPATIBILITY.md with detailed analysis
  • Inline documentation throughout
  • Example programs demonstrating all features

This implementation enables REXX scripting within ChrysaLisp with modern RexxJS syntax extensions and native IPC integration.

Implements a comprehensive REXX interpreter for ChrysaLisp with strong
RexxJS grammar compatibility, featuring ARexx-style IPC via ADDRESS/PORTS
and modern REXX language extensions.

Core Language Features:
- Variable assignment (classic and LET keyword)
- String interpolation with {variable} syntax
- || string concatenation operator
- HEREDOC multi-line strings (<<DELIMITER ... DELIMITER)
- Escape sequences (\n, \t, \r, \\, \")
- Comments (// C-style and -- REXX-style)

Control Flow:
- IF/THEN/ELSE (single-line and multi-line blocks)
- SELECT/WHEN/OTHERWISE multi-way branching
- DO loops (counted with TO/BY, WHILE, FOREVER, OVER)
- LEAVE and ITERATE loop control
- EXIT with return codes

Advanced Features:
- CALL/RETURN subroutines with local scopes
- SIGNAL for computed jumps
- INTERPRET for dynamic code execution
- PARSE (VAR, VALUE, ARG) for string parsing
- Stem variables (REXX arrays with .0 count convention)

String Functions (40+):
- UPPER, LOWER, LENGTH, SUBSTR, PROPER, TRIM
- PAD_START, PAD_END, CENTER, SPACE
- STARTS_WITH, ENDS_WITH, INCLUDES
- IS_ALPHA, IS_NUMERIC, IS_ALPHANUMERIC
- CHANGESTR, WORDPOS, DELWORD, SUBWORD, ABBREV
- SLUG, REPEAT, INDEXOF, VERIFY, COMPARE, COPIES
- C2X, X2C, X2D, D2X, X2B, B2X (conversion functions)

Math Functions:
- ABS, SIGN, MAX, MIN
- MATH_CEIL, MATH_FLOOR, MATH_ROUND, MATH_SQRT, MATH_POWER

Array Operations:
- ARRAY, PUSH, POP, JOIN
- DO OVER iteration (RexxJS extension)

JSON Support:
- JSON_STRINGIFY, JSON_PARSE
- CSV_TO_JSON, JSON_TO_CSV

IPC System (ARexx-style):
- ADDRESS statement for target switching
- PORT system for inter-process communication
- SEND/RECEIVE mailbox operations
- ADDRESS SYSTEM for ChrysaLisp native Lisp execution
- Live IPC demo with ECHO service

Files Created:
- apps/rexx/interpreter.inc (2000+ lines core interpreter)
- apps/rexx/ports.inc (IPC implementation)
- apps/rexx/app.lisp, actions.inc, widgets.inc (GUI)
- apps/rexx/tests/test_suite.rex (59 automated tests)
- apps/rexx/examples/ (20+ example programs)
- apps/rexx/REXXJS_COMPATIBILITY.md (compatibility analysis)
- apps/rexx/echo_service.lisp, system_port.lisp (IPC services)

RexxJS Compatibility:
- ~80% core language compatibility
- 100+ functions implemented
- Focus on ChrysaLisp-appropriate features
- Deferred: HTTP, REQUIRE, file I/O, DOM (environment-dependent)

Test Coverage:
- 59/59 automated tests passing
- Examples for all major features
- Comprehensive test suite with live IPC demonstrations

Documentation:
- README.md with feature overview
- REXXJS_COMPATIBILITY.md with detailed analysis
- Inline documentation throughout
- Example programs demonstrating all features

This implementation enables REXX scripting within ChrysaLisp with
modern RexxJS syntax extensions and native IPC integration.
@paul-hammant
Copy link
Contributor Author

This was about ARexx's ADDRESS/PORTS and IPC, when I started it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants