This project includes a stack-based interpreter for a simple OCaml-like language. The interpreter was developed using the OCaml programming language and includes a variety of mathematical, logical operations, and control structures.
Basic mathematical operations: Addition, Subtraction, Multiplication, Division. Logical operations: AND, OR, NOT, Equal, Less than or equal to. Control structures: Local, Global, Lookup, BeginEnd, IfElse. Functions: Function definition and function call.
The language used in this interpreter includes the following components:
Constants: Integer, Boolean, Unit, String, Name Commands: Push, Pop, Add, Sub, Mul, Div, Trace, And, Or, Not, Equal, Lte, Local, Global, Lookup, BeginEnd, IfElse, Fun, Call Environments: local and global environments are supported
This interpreter is fully functional, but there's always room for improvement. Here are a few things to consider:
Expand the range of recognized commands and expressions. Better error handling: provide more specific error messages to guide the user. Performance optimization: optimize the current commands and functions. More complex functions: allow for the declaration of more complex functions. Additional control structures: include more control structures, such as For and While loops.