rust-gc
kaleidoscope
rust-gc | kaleidoscope | |
---|---|---|
10 | 9 | |
913 | 1,017 | |
- | - | |
3.9 | 0.0 | |
7 months ago | about 4 years ago | |
Rust | Haskell | |
Mozilla Public License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
rust-gc
-
loxcraft: a compiler, language server, and online playground for the Lox programming language
rust-langdev has a lot of libraries for building compilers in Rust. Perhaps you could use these to make your implementation easier, and revisit it later if you want to build things from scratch. I'd suggest logos for lexing, LALRPOP / chumsky for parsing, and rust-gc for garbage collection.
-
What would be your programming language of choice to implement a JIT compiler ?
There's nothing stopping you from doing that in Rust. See rust-gc for an example of a GC implemented in Rust. Another example is mozjs, which is Rust bindings to SpiderMonkey. The GC there is implemented in C++, but it shows how you'd structure wrapper types for GC'd pointers in Rust so that you can use them safely, even with all the "ugliness" of a browser-grade GC.
-
Spotting and Avoiding Heap Fragmentation in Rust Apps
One can have a GC as a library, https://github.com/Manishearth/rust-gc
-
Hey Rustaceans! Got a question? Ask here (7/2023)!
The ones I am aware of are gc and broom. None will be as simple to use as the one in old Rust as userland implementations don't have the benefit of first-class integrated compiler support.
-
Chris Lattner on garbage collection vs. Automatic Reference Counting (2017)
Rust has rust-gc, which is an attempt to add opt-in GC over Rust's more traditional automatic memory management. It's a neat project, but I'm not sure where it's actually being used.
-
I have programming skills! I am good at dealing with programs!
Inb4 "already exists": the question is about making it convenient, not just imlementing the behavior.
-
how hard is rust for a javascript programmer?
There is also a library implementation of garbage collection for Rust, made by someone from the Rust core team.
-
Is this the correct way to think about Rust? Correct me if I am wrong about anything.
Yep! And I'd actually fully agree those are garbage collection, there's also a crate by Manish which does """real""" garbage collection—https://github.com/Manishearth/rust-gc
-
Garbage Collection Question.
I don't know that I'd say it "works" - it's never a technique I've needed to use myself, but it's the approach taken by e.g. https://github.com/Manishearth/rust-gc
-
Microsoft Rust intro says "Rust is known to leak memory"
Anyway, I found something recent that implements "rc" but in terms of tracing: https://github.com/Manishearth/rust-gc/ . Maybe useful for projects involving graphs of objects.
kaleidoscope
- Implementing a JIT Compiled Language with Haskell and LLVM (2017)
-
Should I abandon using haskell for my compiler?
Comparing the haskell and cpp implementations of the LLVM tutorial lead me to believe it might be faster to learn haskell and implement the compiler in haskell than to implement it in cpp.
-
What would be your programming language of choice to implement a JIT compiler ?
I think for writing compilers Haskell deserves to make the list. It is really excellent at creating DSLs. https://www.stephendiehl.com/llvm/
-
Proposal to Merge Pyston with Cpython
I'm no expert, but you might be interested in: https://llvm.org/docs/tutorial/
There's also a Haskell version if you'd prefer: https://www.stephendiehl.com/llvm/
Idk how to do this in python as I'm not really good with it, but in C, to make your compiler a JIT, you would `mmap` a region as writeable, write the machine code to it that you already know how to generate, `mprotect` it as PROT_EXEC instead of PROC_WRITE, cast the pointer to the region to a function pointer, and then call it. These functions may be available in the python sys package but I don't really know.
I've implemented a "JIT" that takes machine code as hex and does this. Warning: it's complete garbage with no error checking but is a good proof of concept. https://gist.github.com/martinjacobd/3ee56f3c7b7ce621034ec3e...
- Why does Rust have parameters on impl?
-
Implementing a LLVM Micro C compiler in Haskell
This is amazing. I tried following Stephen Diehl's JIT compiler in LLVM tutorial[0] a few years ago but it was already outdated (the llvm-hs library changed quite a bit), and subsequent web searches didn't turn up much.
For those interested in tutorials like this, I'd also recommend a very literate Haskell compiler for the PCF language to C[1], which is essentially lambda calculus with some primitives.
[0] https://www.stephendiehl.com/llvm/
[1] https://github.com/jozefg/pcf/
- Resources for Amateur Compiler Writers
-
Need some help with monad transformers
I'm currently working with llvm-hs-pure and am struggling to properly emit code for a module. I basically followed https://www.stephendiehl.com/llvm/#chapter-3-code-generation and have types like:
-
Advanced books / tutorials about Haskell?
http://www.stephendiehl.com/llvm/ Implementing a JIT Compiled Language with Haskell and LLVM Nice tutorial. Requires knowledge of monads, applicatives, transformers. Deep enough and more or less 'real world'.
What are some alternatives?
rfcs - RFCs for changes to Rust
hyper-haskell-server - The strongly hyped Haskell interpreter.
unsafe-code-guidelines - Forum for discussion about what unsafe code can and can't do
dhall - Maintainable configuration files
tokio - A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
unbound - Replib: generic programming & Unbound: generic treatment of binders
its_rusty - learning rust
ajhc - A fork of jhc. And also a Haskell compiler.
Primes - Prime Number Projects in C#/C++/Python
pcf - A small compiler for PCF
ixy-languages - A high-speed network driver written in C, Rust, C++, Go, C#, Java, OCaml, Haskell, Swift, Javascript, and Python
egison - The Egison Programming Language