Skip to content

This project is an implementation of an interpreter for the Lox programming language written in C++. Lox is a simple dynamically-typed language designed by Bob Nystrom, and this interpreter is being developed as part of the process outlined in the book "Crafting Interpreters." The goal of this project is to provide a fully functional interpreter

Notifications You must be signed in to change notification settings

Ah0nA/crafting-interpreters-cpp

Repository files navigation

About

This project is an implementation of an interpreter for the Lox programming language written in C++. Lox is a simple dynamically-typed language designed by Bob Nystrom, and this interpreter is being developed as part of the process outlined in the book "Crafting Interpreters."

The goal of this project is to provide a fully functional interpreter for the Lox language, capable of parsing Lox source code, executing it, and producing the correct output. This interpreter will serve as a learning tool for understanding language design and implementation concepts, as well as providing a platform for experimenting with language features and extensions.

Features implemented

  • Lexical analysis (tokenization) of Lox source code.

Features to implement

  • Parsing of Lox expressions and statements using a recursive descent parser.
  • Interpretation of parsed expressions and statements, including support for variables, control flow structures, and basic data types (numbers, strings, and booleans).
  • Error handling and reporting for syntax errors and runtime errors.
  • Basic REPL (Read-Eval-Print Loop) for interactive testing of Lox code.

Future Enhancements

  • Bytecode compilation and execution for improved performance.
  • Support for additional language features such as functions, classes, and modules.
  • Integration with external libraries and tools for extending Lox functionality.
  • Optimizations for performance and memory usage.

Usage

To build and run the Lox interpreter, follow these steps:

  1. Clone the repository to your local machine:

    git clone https://github.com/your_username/lox-interpreter.git
    
  2. Navigate to the project directory:

    cd lox-interpreter
    
  3. Build the interpreter using your preferred build system (e.g., CMake):

    mkdir build
    cd build
    cmake ..
    make
    
  4. Run the interpreter with a Lox script file:

    ./lox ../path/to/lox_script.lox
    

Alternatively, you can run the interpreter in REPL mode to interactively execute Lox code:

./lox

Contributing

Contributions to this project are welcome! If you have any ideas for improvements, bug fixes, or new features, feel free to open an issue or submit a pull request. Please adhere to the project's coding style and guidelines, and ensure that all changes are thoroughly tested.

License

This project is licensed under the MIT License. See the LICENSE file for details.


About

This project is an implementation of an interpreter for the Lox programming language written in C++. Lox is a simple dynamically-typed language designed by Bob Nystrom, and this interpreter is being developed as part of the process outlined in the book "Crafting Interpreters." The goal of this project is to provide a fully functional interpreter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published