This is the user manual for the Aqua programming language created as part of Programming Languages and Concepts. Visit the project on Github.
Aqua is a C-like imperative language, for manipulating infinite streams. Statements are somewhat optionally terminated with semicolons, and supports both block
( /* ... */) and line comments
( // ...).Curly brackets are used optionally to extend scope. Example code can be found in the Appendices.
Before continuing, it’s helpful to familiarise yourself with Extended BNF. Special sequences are used to escape.
Once the interpreter has been compiled using the
make command, you can choose to run an interactive REPL or a stored program. Executing
./mysplinterpreterwith no arguments will start in an interactive REPL . You should save your program files as
<filename>.spl and pass the location as the first argument to
./mysqlinterpreter. As data is read from standard in, you can pipe files in using the
< operator, or pipe programs in using the
| operator, allowing you to create programs that manipulate infinite streams.
- Starting the interactive REPL:
- Executing a saved program:
./mysplinterpreter <file> [ < <input> ]
- Using infinite streams:
<program> | ./mysplinterpreter <file>
Programs are executed in multiple stages:
- Entire program is loaded into a string (Unix line endings required)
- Program is lexed into Tokens
- Tokens are parsed into an Abstract Syntax Tree (Left associative with the exception of lambdas)
- Types are checked to ensure logical behaviour
- Finally the Abstract Syntax Tree is executed