GithubHelp home page GithubHelp logo

saad-hussain31 / loxpp Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 46 KB

C++ implementation of lox, a dynamically-typed, interpreted programming language

CMake 2.13% C++ 97.87%
bytecode-interpreter compiler compilerdesign moderncpp

loxpp's Introduction

Loxpp Interpreter

The Loxpp interpreter is an implementation of the Lox programming language. Lox is a dynamically-typed, interpreted language designed for educational purposes and is described in the book "Crafting Interpreters" by Bob Nystrom.

Features

  • Ability to run Lox code from a file or interactively from the command line.
  • Lexical analysis (scanning) of Lox source code to generate tokens.
  • Error reporting with line numbers.
  • Basic token types, including single-character tokens, literals (identifiers, strings, numbers), and keywords.

Usage

  1. Clone the repository and navigate to the project directory.
git clone [email protected]:Saad-Hussain31/Loxpp.git
  1. Build the interpreter:
$ mkdir build
$ cd build
$ cmake ..
$ make
  1. Run the Loxpp interpreter:
  • Run a Lox script file:
$ ./loxpp path/to/script.lox
  • Start an interactive Lox prompt:
    $ ./loxpp
    
  1. Enter Lox code in the file or prompt and observe the output.

Code Structure

  • Lox.hpp and Lox.cpp: Contains the Lox class for running Lox code, error handling, and initialization.
  • Scanner.hpp and Scanner.cpp: Defines the Scanner class responsible for lexical analysis (scanning) of Lox source code.
  • Token.hpp and Token.cpp: Defines the Token class representing a token in Lox.
  • TokenType.hpp: Declares the TokenType enum class representing token types.

Dependencies

  • C++17 compatible compiler
  • CMake (version 3.10 or higher)

Contributions

Contributions are welcome! Feel free to open an issue or submit a pull request.

Acknowledgments

The Loxpp interpreter is based on the Lox programming language described in the book "Crafting Interpreters" by Bob Nystrom.

loxpp's People

Contributors

saad-hussain31 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.