Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thaliaarchi/nebula
Compiler for the stack-based Whitespace language with LLVM back end.
https://github.com/thaliaarchi/nebula
compiler go llvm llvm-ir programming-languages whitespace-language
Last synced: 2 months ago
JSON representation
Compiler for the stack-based Whitespace language with LLVM back end.
- Host: GitHub
- URL: https://github.com/thaliaarchi/nebula
- Owner: thaliaarchi
- License: mit
- Created: 2019-06-07T01:13:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-30T19:06:23.000Z (over 4 years ago)
- Last Synced: 2023-07-10T04:07:41.203Z (over 1 year ago)
- Topics: compiler, go, llvm, llvm-ir, programming-languages, whitespace-language
- Language: Go
- Homepage:
- Size: 432 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Nebula
Nebula is an optimizing compiler for stack-oriented programming
languages that targets LLVM IR.## Requirements
- Go 1.13 or later
- LLVM source
- Graphviz to render graphs## Project Goals
### Compilation
- Nebula IR
- Operations
- Arithmetic - add, sub, mul, div, mod
- Stack - push registers, pop length
- Heap - load, store
- I/O - read, print
- Control flow - jmp, conditional jmp, call, ret
- Assertions - zero divisor, stack underflow, ret underflow
- Memory
- Stack
- Heap - partitioned
- Call stack
- Static single assignment form
- [x] Stack access converted to indexed variables
- [x] Connected graph of basic blocks
- [x] Minimize stack pointer updates to once per block
- Interprocedural analysis
- [x] Constant stack folding and propagation
- [x] String concatenation
- [x] Dead code elimination
- [x] Call stack underflow detection
- [ ] Trap eliding
- [ ] Register allocation
- [ ] Reduction of arbitrary precision integers to fixed width
- [ ] Tail call optimization
- [ ] Heap access analysis
- [ ] Lifetime analysis
- [ ] Constant folding and propagation
- [ ] Contract assertions
- [ ] Using an SMT solver
- [ ] Abstract interpretation
- Targets
- [x] LLVM IR
- [ ] WebAssembly via Emscripten### Languages
- High level language
- Abstracted away from the WS stack and heap
- Compiles to WS instruction set
- Memory safe
- Assembly syntax language
- Very close to WS instruction set
- Assembly-like syntax
- Allows additional metadata for compiler
- Special compiler treatment of standard library functions
- Whitespace language
- Direct representation of WS instruction set
- Follows WS language spec syntax## License
The Nebula project is licensed under the [MIT License](LICENSE.md).
Subdirectories with code under differing licenses are marked with
separate license files.## Naming
Nebula's name is derived from the stellar gas clouds, nebulae. Nebulae
are incredibly diffuse, yet form some of the most beautiful astronomical
landscapes. Similarly, of all programming languages, Whitespace is the
least dense in visible characters and despite its simplicity, is Turing
complete. The name is also a call-out to the star-forming region
[IC 1396](https://nitarp.ipac.caltech.edu/system/media_files/binaries/191/original/johnson2017sci.pdf)
that contains many nebulae including the famous Elephant's Trunk Nebula.