OW
cd ..~/projects/rpal-interpreter

case study 06 / Programming languages

RPAL Interpreter

A Java interpreter that tokenises RPAL, builds and standardises an abstract syntax tree, then evaluates it with a Control-Stack-Environment machine.

status
Completed
ownership
Team of 2
stages
06
stack
06
  • Java
  • Lexical analysis
  • Recursive-descent parsing
  • AST
  • Functional programming
  • CSE machine

Project overview

01

the problem

Executing RPAL requires transforming source text through lexical, syntactic, structural, and runtime representations.

02

my contribution

Co-developed as a two-person Programming Languages project. The repository and report verify the complete pipeline but do not allocate individual components, so the work is presented as team-owned.

03

key decision

Standardise high-level syntax into a smaller set of core tree forms before evaluation, keeping the CSE machine focused on a compact runtime model.

visual evidence pending

No repository screenshot is published for this project. A real application capture should replace this clearly marked placeholder.

04 / how it works

System flow

implemented — verified against source5
  1. Regex-backed lexical scanner for identifiers, integers, strings, operators, punctuation, and comments.

  2. Recursive-descent parser following the RPAL grammar and producing a child-sibling AST.

  3. Tree-standardisation rules for constructs including let, where, within, functions, simultaneous definitions, and recursion.

  4. CSE evaluation with control and value stacks, environments, closures, tuples, conditionals, operators, and built-ins.

  5. A collection of RPAL programs and expected AST or output fixtures for manual verification.

What is implemented and what is not

known limitations3
  • The included report names two group members but does not map implementation areas to either person.

  • The repository is a single squashed commit, so Git history cannot provide finer attribution.

  • Test programs are fixtures rather than an automated test harness.

hardest part

Maintaining correct tree relationships and lexical environments through standardisation, closures, recursion, tuples, and conditional evaluation.

what I learned

Interpreters become easier to reason about when parsing, representation transformation, and evaluation are separate stages.