Version: 22.0.0 Platform: ESP32-S3 (Arduino Framework) License: Dual-licensed (sfranzyshen.com Source-Available License 1.0 / GNU AGPLv3)
-
Locate your Arduino libraries folder:
- Windows:
Documents\Arduino\libraries\ - macOS:
~/Documents/Arduino/libraries/ - Linux:
~/Arduino/libraries/
- Windows:
-
Copy the entire
ArduinoASTInterpreterfolder into the libraries directory -
Restart Arduino IDE 2
-
Verify installation:
- Go to
File > Examples > ArduinoASTInterpreter - You should see
BasicInterpreterandAnalogReadExample
- Go to
-
Compress the
ArduinoASTInterpreterfolder to ZIP -
In Arduino IDE 2:
- Go to
Sketch > Include Library > Add .ZIP Library... - Select the ZIP file
- Restart Arduino IDE
- Go to
- FQBN:
esp32:esp32:nano_nora - Flash: 8MB
- PSRAM: 8MB
- Firmware Size: ~900KB (28% flash usage)
- Upload: Use Arduino IDE 2's built-in upload (handles DFU automatically)
- FQBN:
esp32:esp32:esp32s3 - Flash: 8MB (configurable)
- PSRAM: 8MB PSRAM (configurable)
- Firmware Size: ~856KB-900KB depending on configuration
The library supports two build modes:
RTTI-free (default - smaller binary):
- File:
examples/BasicInterpreter/build_opt.h - Contents:
-DAST_NO_RTTI -fno-rtti - Binary size: ~868KB
- No action required - Just compile and upload
RTTI mode (opt-in - runtime safety):
- Rename or delete
build_opt.h - Or copy
build_opt_rtti.h.exampletobuild_opt.h - Binary size: ~896KB (+28KB)
File > Examples > ArduinoASTInterpreter > BasicInterpreter
For Arduino Nano ESP32:
Tools > Board > esp32 > Arduino Nano ESP32
For Generic ESP32-S3:
Tools > Board > esp32 > ESP32S3 Dev Module
Tools > USB Mode > Hardware CDC and JTAG
Tools > USB CDC On Boot > Enabled
Tools > PSRAM > OPI PSRAM
Tools > Partition Scheme > Default 4MB with spiffs
Sketch > Upload
Arduino IDE 2 will automatically handle:
- Compilation
- Board detection
- Upload (including DFU mode for Nano ESP32)
- Serial monitor
Simple demonstration showing how to:
- Load a CompactAST binary program
- Execute Arduino code from AST
- Use synchronous data provider for hardware simulation
Advanced example demonstrating:
- Analog sensor reading
- Real-time data processing
- Hardware integration
ArduinoASTInterpreter/
├── library.properties # Library metadata
├── keywords.txt # Syntax highlighting
├── src/
│ ├── ArduinoASTInterpreter.h # Main include file
│ ├── CompactAST.cpp # Binary AST library
│ ├── CompactAST.hpp
│ └── cpp/ # C++ implementation files
│ ├── ASTInterpreter.cpp
│ ├── ASTInterpreter.hpp
│ ├── ASTNodes.cpp
│ ├── ASTNodes.hpp
│ └── ... (other implementation files)
└── examples/
├── BasicInterpreter/
└── AnalogReadExample/
#include <ArduinoASTInterpreter.h>
// Your CompactAST binary program
const uint8_t PROGMEM astBinary[] = { /* ... */ };
class MyDataProvider : public SyncDataProvider {
int32_t getAnalogReadValue(int32_t pin) override {
return analogRead(pin == 14 ? 36 : pin);
}
// Implement other methods...
};
MyDataProvider provider;
void setup() {
Serial.begin(115200);
InterpreterOptions opts;
opts.syncMode = true;
auto* interpreter = new ASTInterpreter(
astBinary,
sizeof(astBinary),
opts
);
interpreter->setSyncDataProvider(&provider);
interpreter->start();
}
void loop() {
// Your code here
}Error: "CompactAST.hpp: No such file or directory"
- Solution: Make sure all files from
src/folder are present - Verify: Check that
CompactAST.cppandCompactAST.hppexist insrc/
Error: "undefined reference to CompactASTReader"
- Solution: This means CompactAST.cpp wasn't compiled
- Fix: Restart Arduino IDE and clean build (
Sketch > Verify/Compile)
DFU mode not working:
- Arduino IDE 2 handles DFU automatically - just click Upload
- If manual bootloader needed: Double-tap RESET button before upload
- Board LED should show steady or pulsing pattern when in bootloader mode
Port not found:
- Check USB cable connection
- Try a different USB port
- Ensure ESP32 board support is installed (
Tools > Board > Boards Manager > esp32)
No output appearing:
- Verify baud rate is set to
115200 - Check that
Serial.begin(115200)is in your sketch - Press RESET button on board after upload
Flash (Program Storage):
- Basic interpreter: ~900KB
- Available for code: ~7.1MB (8MB total)
RAM (Dynamic Memory):
- Basic usage: ~26KB
- Available: ~302KB (328KB total)
- PSRAM available: 8MB for large data structures
- Arduino IDE: Version 2.0.0 or later
- ESP32 Board Support: Version 3.0.0 or later
- Install via:
Tools > Board > Boards Manager > esp32 - URL:
https://espressif.github.io/arduino-esp32/package_esp32_index.json
- Install via:
- Full Documentation: See main repository README.md
- ESP32 Deployment Guide:
docs/ESP32_DEPLOYMENT_GUIDE.md - API Reference:
src/ArduinoASTInterpreter.h
- GitHub: https://github.com/sfranzyshen/ASTInterpreter
- Issues: https://github.com/sfranzyshen/ASTInterpreter/issues
- License: See LICENSE file in repository
v21.2.1 (October 14, 2025)
- WASM playground production ready
- Memory optimization (256MB heap)
- Bulk memory transfer optimization
- Browser deployment tested
v21.2.0 (October 14, 2025)
- ESP32 RTTI-free default for embedded deployment
- Platform-specific defaults optimization
- Three RTTI opt-in paths documented
v21.0.0 (October 13, 2025)
- Complete RTTI removal for ESP32 Arduino support
- 113 dynamic_cast → static_cast replacements
- Perfect cross-platform parity (135/135 tests)