compiler
eopl3
Our great sponsors
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.
compiler
-
A copy-and-patch JIT compiler for CPython
Wow! Thank you for your hard work. I use python for all experimental work so this would speed up my scripting work, such as processing data from API calls or filesystem.
I wrote a simple toy JIT for a Javascript-like language. It might be useful for others to learn from because it's so simply written and not complicated. I do lazy patching of callsites, I haven't got anywhere near as advanced as tracing or copy-and-patching. Much of the code I wrote for this JIT was written in Python and ported to C. The Java Virtual Machine has a template interpreter which is interesting to research.
I haven't got around to encoding amd64 x86_64 instructions as bitmasks yet, so I've hardcoded it.
-
Building a Programming Language in Twenty-Four Hours
https://github.com/samsquire/compiler
It's a toy and incomplete but I've worked on compiling MOV and ADD instructions.
-
Let's make a Teeny Tiny compiler
I used this page to work out the Mod/RM format for opcodes.
https://www.cs.uaf.edu/2016/fall/cs301/lecture/09_28_machine...
I have a barebones toy compiler here that compiles a simple mathematical expression to assembly:
https://replit.com/@Chronological/Compiler3
I have the beginnings of a toy JIT compiler here which generates some machine code for MOVs and function calls but I haven't implemented much else...
http://github.com/samsquire/compiler
For code how I generate an "add" instruction:
https://github.com/samsquire/compiler/blob/main/jitcompiler....
I use a case statement to match on the registers and literally insert opcode bytes into a malloced array.
On thing you can do it implement a JIT compiler.
Here's Martin Jacob's code to execute arbitrary memory:
https://gist.github.com/martinjacobd/3ee56f3c7b7ce621034ec3e...
Since your C program is already in memory, you have access to the C standard library and don't have to worry about linking or object formats :-) but you'll have to worry about parameter passing and FFI.
My JIT compiler based on this idea is here https://github.com/samsquire/compiler but it is incomplete.
- How to get started?
- Notes on my incomplete JIT compiler
-
Erlang: More Optimizations in the Compiler and JIT
This is interesting, thank you.
I really should learn from BEAM and the OTP and learn Erlang. I get the feeling it's super robust and reliable and low maintenance. I wrote a userspace multithreaded scheduler which distributes N lightweight threads to M kernel threads.
https://github.com/samsquire/preemptible-thread
I recently wrote a JIT compiler and got lazy compilation of machine code working and I'm nowhere near beginning optimisation
https://github.com/samsquire/compiler
How do you write robust software, that doesn't crash when something unexpected goes on?
I looked at sozo https://github.com/sozu-proxy/sozu
and I'm thinking how to create something that just stays up and running regardless.
- Is it possible to optimize this bytecode interpreter more?
- How do you create a correct AST with interaction between method call and function call?
- How do you parse function calls?
eopl3
-
How to get started?
I've been going through the book myself using Haskell and it's been a blast. I recently completed Chapter 5 and here's some of what I learned to implement along the way: a CPS (Continuation-passing style) interpreter, how to add support for continuations, trampolining, how to use CPS to add support for exceptions and threads. Here are the various interpreters: https://github.com/dwayne/eopl3/tree/master/solutions/05-ch5/interpreters/haskell.
What are some alternatives?
PicoBlaze_Simulator_in_JS - Simulator (more accurately: an assembler and an emulator) for Xilinx PicoBlaze, runnable in a browser.
epoll-server - C code for multithreaded multiplexing client socket connections across multiple threads (so its X connections per thread) uses epoll
preemptible-thread - How to preempt threads in user space
SVM - Simple stack-based bytecode VM implementations used in my class
racket-rash - The Reckless Racket Shell
rust - Empowering everyone to build reliable and efficient software.
typed-racket - Typed Racket
multiversion-concurrency-control - Implementation of multiversion concurrency control, Raft, Left Right concurrency Hashmaps and a multi consumer multi producer Ringbuffer, concurrent and parallel load-balanced loops, parallel actors implementation in Main.java, Actor2.java and a parallel interpreter
frog - Frog is a static blog generator implemented in Racket, targeting Bootstrap and able to use Pygments.
racketscript - Racket to JavaScript Compiler
assembler - amd64 assembler
erikeidt