AppleScript Syntax Gaps vs Current HyperScript

Purpose

This document tracks what Hyperphp still does not implement compared to AppleScript. It is based on behavior covered in parser/runtime tests and current code paths in src/Lexer, src/Parser, and src/Runtime. Last verified: February 26, 2026.

Implemented Now (High-Level)

The language currently supports: - set ... to ... - put ... into ... - use script "..." - if ... then ... else ... end if - try ... on error ... end try - error, error "message", error {message: "...", code: "..."} - repeat <n> times - repeat while ... - repeat until ... - bare repeat ... end repeat - exit repeat / next repeat - repeat with <var> in <expr> - classic handlers: on <handler>(...) ... end <handler> - advanced handlers in tell blocks: on <verb> <subject> ... end <verb> - return ... - tell application "..." ... end tell - nested tell ... end tell - every <kind> whose <predicate> - every <kind> of <expr> whose <predicate> - of chains (subject of first message of inbox) - possessive chains (event's sender's name, its subject, my cached_value) - object specifiers (first message, last message, message 2, message 1 thru 3) - multi-word property targets (set read status to true) - literals: number, string, boolean, list, record - coercion with as (integer, number, text, boolean, list, record) - operators: contains, begins with, ends with, is in / is not in, div, mod, & - implicit runtime values: - result (read-only) - pronouns: it, its, my, me - event context via direct keys and event

Missing Syntax and Semantics

1. Control Flow Coverage

  • No considering / ignoring blocks for comparison modifiers.
  • No loop syntax like repeat with i from 1 to 10 by 2.

2. Error Handling and Flow Commands

  • Not implemented:
  • with timeout ...
  • with transaction ...

3. Handler Signatures and Calling Forms

  • Missing AppleScript handler forms:
  • labeled parameters (on open location theURL)
  • optional/default parameter behavior
  • command-style handler invocation with labeled arguments

4. Operators and Comparison Forms

  • Core operators are implemented, but full AppleScript parity is not.
  • Comparison semantics are still simplified versus AppleScript edge-case behavior (locale/case/rich type nuances).

5. Data Types and Literals

  • Missing AppleScript-specific types and literal forms:
  • date literal support
  • alias, file, reference, and related coercions
  • broader AppleScript coercion matrix parity

6. Script/Object Declarations

  • Not implemented:
  • script ... end script
  • property, global, local declarations
  • script object inheritance / parent script patterns

7. Terminology/Dictionary Semantics

  • No Apple Event dictionary negotiation.
  • No terminology import (using terms from ...).
  • Command/property availability is model-defined, not dictionary-driven.

8. Behavioral Parity Gaps

  • Error binding shape is Hyperphp-specific (message, code, line, column, stack) rather than AppleScript-native error records.
  • Pronoun/result behavior is intentionally simplified and may differ in complex nested flows.

Priority Proposal

P0 (Most Impact for AppleScript Feel)

  • considering / ignoring modifiers.
  • labeled handler parameter forms and command-style labeled invocation.
  • script-level declarations (property/global/local).

P1

  • richer AppleScript edge-case semantics for comparisons/operators.
  • loop forms like repeat with i from ... to ... by ....
  • with timeout / with transaction.

P2

  • script objects (script ... end script).
  • richer AppleScript type system and coercion parity.
  • terminology import and dictionary-level compatibility.