https://github.com/bollu/musquared
Demand-agnostic managed language compiler using MLIR
https://github.com/bollu/musquared
Last synced: 4 days ago
JSON representation
Demand-agnostic managed language compiler using MLIR
- Host: GitHub
- URL: https://github.com/bollu/musquared
- Owner: bollu
- Created: 2020-01-21T12:46:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-16T03:31:30.000Z (over 5 years ago)
- Last Synced: 2025-05-14T04:19:14.106Z (5 months ago)
- Language: Haskell
- Homepage:
- Size: 705 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# λ ∈ MLIR | 
- [Lioville function](https://en.wikipedia.org/wiki/Liouville_function)### Good resources:
- [SPIR-V dialect spec](https://github.com/bollu/mlir/blob/master/orig_docs/Dialects/SPIR-V.md)
- [SPIR-V dialect base tablegen](https://github.com/bollu/mlir/blob/master/include/mlir/Dialect/SPIRV/SPIRVBase.td)
- [SPIR-V dialect header](https://github.com/bollu/mlir/blob/master/include/mlir/Dialect/SPIRV/SPIRVDialect.h)
- [SPIR-V dialect cpp](https://github.com/bollu/mlir/blob/master/lib/Dialect/SPIRV/SPIRVDialect.cpp)
- [SPIR-V types header](https://github.com/bollu/mlir/blob/master/include/mlir/Dialect/SPIRV/SPIRVTypes.h)
- [SPIR-V types cpp](https://github.com/bollu/mlir/blob/master/lib/Dialect/SPIRV/SPIRVTypes.cpp)### Round tripping
- What stops someone from defining a printer that is completely different
from what the parser wants?### GHC Core
- [`CoreSyn` data type in GHC](https://downloads.haskell.org/~ghc/8.8.3/docs/html/libraries/ghc-8.8.3/CoreSyn.html)
- [`CoreSyn` wiki commentary](https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/core-syn-type)
- [Stephen Diehl on targetting Core](https://www.stephendiehl.com/posts/ghc_03.html)```hs
data Expr b
= Var Id
| Lit Literal
| App (Expr b) (Arg b)
| Lam b (Expr b)
| Let (Bind b) (Expr b)
| Case (Expr b) b Type [Alt b] -- See #case_invariants#
| Cast (Expr b) Coercion
| Tick (Tickish Id) (Expr b)
| Type Type
| Coercion Coercion
deriving Datatype Arg b = Expr b
type Alt b = (AltCon, [b], Expr b)data AltCon = DataAlt DataCon | LitAlt Literal | DEFAULT
data Bind b = NonRec b (Expr b) | Rec [(b, (Expr b))]
```
### `hask-programs/`
To run these, first install the GHC plugin from `ghc-dump`. This installs
both the plugin that is loaded with `-fplugin GhcDump.Plugin` [The package `ghc-dump-core`]
as well as the utility tool for dumping these called `ghc-dump` [The package `ghc-dump-util`].```
# install tool and compiler plugin
$ cd ghc-dump && cabal install --lib all && cabal install all
```Then run the makefile:
```
# run the makefile, generate the dump, pretty print the dump
$ cd hask-programs && make && ghc-dump --show fib.pass-0000.cbor
```### TODO
- [ ] Parse `case x of { ... }` style input.
- [ ] Parse `let var = val in ...` input.
- [ ] Add `PrimInt` type.
- [ ] Get factorial up and running.
- [ ] Get a notion of explicit GC.