This document captures the implemented work for the RPAL interpreter, plus build, run, and test instructions.
- Confirm current scanner/parser/AST baseline from existing code and docs.
- Implement AST standardization rules and expose a reusable standardizer API.
- Implement evaluator runtime: environments, closures, application, tuples, operators, and builtins.
- Add a unified CLI entrypoint supporting scanner/parser/ast/st/eval modes.
- Wire build system to compile all modules.
- Update README and capture complete change/build/run notes in this file.
- Build and run provided RPAL test programs; fix gaps found.
Status:
- Steps 1-7: Completed.
Files:
src/standardizer.hsrc/standardizer.cpp
Implements AST to ST conversion rules:
letwherewithinandrecfcn_form@- tuple-form lambda parameters are preserved for tuple pattern binding
Files:
src/evaluator.hsrc/evaluator.cpp
Implements:
- Environment chain
- Closures (
lambda) - Function application (
gamma) - Tuple values and tuple indexing by application
- Tuple construction (
tau) andaug - Arithmetic (
+,-,*,/,**,neg) - Comparisons (
gr,ge,ls,le,eq,ne) - Boolean ops (
or,&,not, conditional->) - Builtins:
PrintOrderConcStemSternItoSIsintegerIstruthvalueIsstringIstupleIsfunctionIsdummyNull
- Recursive definitions through standardized
Y*
File:
src/main.cpp
Modes:
--scan--parse--ast--st--eval- default mode: evaluate
Root Makefile is provided for the lab-required flow:
make
./rpal20 file_nameCMakeLists.txt is also available for local development.
From repository root:
makeThis produces:
./rpal20Alternative CMake build:
mkdir build
cd build
cmake ..
cmake --build .Output executable:
- Makefile:
./rpal20 - Linux/macOS CMake:
build/rpal20 - Windows Visual Studio CMake:
build/Release/rpal20.exe
From repository root:
./rpal20 rpal_test_programs/rpal_01Mode-specific examples:
./rpal20 --scan rpal_test_programs/rpal_01
./rpal20 --ast rpal_test_programs/rpal_01
./rpal20 --st rpal_test_programs/rpal_01
./rpal20 --eval rpal_test_programs/rpal_01On Windows CMD/PowerShell with the CMake build:
.\build\Release\rpal20.exe rpal_test_programs\rpal_01Core tests follow the lab naming style:
rpal_test_programs/rpal_01
rpal_test_programs/output01.test
Manual lab-style run:
./rpal20 rpal_test_programs/rpal_01 > output.01
diff output.01 rpal_test_programs/output01.testRun all tests:
python3 scripts/run_tests.pyAll tests now use the same lab-style layout:
- Programs:
rpal_test_programs/rpal_01throughrpal_97 - Expected outputs:
rpal_test_programs/output01.testthroughoutput97.test
If output mismatches expected RPAL behavior, inspect AST and ST:
./rpal20 --ast rpal_test_programs/rpal_01
./rpal20 --st rpal_test_programs/rpal_01The implementation is structured so commits can be grouped by:
- Runtime pipeline (
standardizer,evaluator,main) - Build integration (
Makefile,CMakeLists.txt) - Tests and docs (
rpal_test_programs,scripts,README.md,CHANGES_AND_BUILD.md)
Verified in this branch:
- CMake/Visual Studio build completes and produces
build/Release/rpal20.exe. - GCC C++11 compile with
-Wall -Wextra -pedanticcompletes. - Tests
rpal_01throughrpal_97pass againstoutput01.testthroughoutput97.test. - Additional checks cover recursion, tuple-parameter functions, curried functions, string/type builtins, comments, and tuple equality.
The local Windows shell does not have GNU make installed, so the Makefile was syntax-reviewed and its exact GCC compile command was verified manually.