Giter Site home page Giter Site logo

cpp2lox's Introduction

cpp2lox

A casual attempt to reproduce Robert Nystrom's lox in Herb Sutter's C++ syntax 2 (that is targeting cppfront as the compiler).

Build

The current build is based on meson and requires at least version 0.55.0 (for support of the patch_directory feature in wrap files).

Build credit

I shamelessly stole the meson build support for cppfront from Jussi Pakkanen's cpp2meson repository, only I took advantage of patch_directory to maintain the build file in my repository instead of creating a cutout for cppfront. Thanks, Jussi!

Discussion

There are plenty of things that cppfront does not yet support, and that is going to affect how we write the code.

By design there is no support for owning raw pointers and unsafe allocation strategies like new. This means I have to decide between using mixed code to implement the garbage collector or simply using a cpp2 arena in the first place. The latter is more convenient but the former more in keeping with the pedagogical nature of Crafting Interpreters. I've already given up on explicit dynamic arrays in favor of std::vector but that is largely because I've long been conversant with dynamic arrays in C, so they don't offer me anything new.

The cppfront separate compilation scheme is not well explained in the docs. It seems to be a unity build, but either way, I got it working for now. In the long run cppfront is based on C++20 and beyond, so it will use modules. Alas module support is uneven and fragile on most tools chains right now and the build tool I adopted (meson) has no support at all right now.

Repository

I intend to tag version for places where the book and I both get to a working intermediate state.

cpp2lox's People

Contributors

dwmckee 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.