sphinx-lang

An intepreter for a simple dynamic language written in Rust (by mwerezak)

Sphinx-lang Alternatives

Similar projects and alternatives to sphinx-lang

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better sphinx-lang alternative or higher similarity.

sphinx-lang reviews and mentions

Posts with mentions or reviews of sphinx-lang. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-04-25.
  • Hacker News top posts: Apr 25, 2022
    2 projects | /r/hackerdigest | 25 Apr 2022
    Show HN: I'm making a dynamic language in Rust\ (27 comments)
  • I'm building a dynamic language in Rust
    2 projects | /r/rust | 24 Apr 2022
    Github: https://github.com/mwerezak/sphinx-lang
  • Show HN: I'm making a dynamic language in Rust
    8 projects | news.ycombinator.com | 24 Apr 2022
    https://github.com/mwerezak/sphinx-lang

    An implementation of a dynamic programming language in Rust. Includes: Parser/Compiler, REPL, Virtual Machine, Bytecode Disassembler

    This started out as a learning project to teach myself Rust. It has grown into a decently substantial piece of software and I've learned quite a bit in the process!

    Some neat things:

    + A garbage collector that can store dynamically sized types without any double-indirection (i.e. I have my own Box implementation with manual alloc/dealloc)

    + The smart pointer used to reference GCed data is a thin pointer. The ptr metadata needed for DSTs is stored in the GC allocation itself, so that the GC smart pointer is just a single usize wide. This allows me to keep the core value enum Variant down to 16 bytes (8 bytes for data, the enum discriminant, and some padding).

    + The GC also supports weak references!

    + Statically dispatched type object model using a newtype wrapper and Rust's declarative macros. Ok, what that means is that I have a MetaObject trait that I can use to easily add new data types and define the behavior for specific types. Similar idea to Python's PyTypeObject though very different in implementation. However, I don't resort to dynamic dispatch or trait objects despite working with dynamically type data. Instead, I have a newtype wrapper over the core value enum Variant that statically dispatches to each of the enum branches! And then a few macros that minimize the boilerplate required if I want to add a new branch to Variant or a new method to MetaObject (just a single line in each case).

    + Different string representations! This was inspired by the flexstr crate. Strings that are short enough to fit inside a Variant are "inlined" directly in the value. Longer strings are either GCed or interned in a thread-local string table. All identifiers are interned.

    + An efficient implementation of closures inspired by Lua's upvalues.

    The language is still pretty WIP. I'm planning to add an import system, a small standard library, and a few other things

    (Yes, the name might not be the best, being also used by a well-known ReST docs generator, I'll take suggestions. I do like the name though, both as a reference to the mythological creature and the cat :D)

    8 projects | news.ycombinator.com | 24 Apr 2022
  • A note from our sponsor - InfluxDB
    www.influxdata.com | 29 Mar 2024
    Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality. Learn more →

Stats

Basic sphinx-lang repo stats
11
287
1.8
almost 2 years ago

mwerezak/sphinx-lang is an open source project licensed under MIT License which is an OSI approved license.

The primary programming language of sphinx-lang is Rust.

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com