This repository has been archived on 2024-04-05. You can view files and clone it, but cannot push or open issues/pull-requests.
really-bad-compiler-in-haskell/README.md

47 lines
1.9 KiB
Markdown
Raw Normal View History

2023-09-07 20:57:58 +00:00
# Really Bad Compiler in Haskell
2023-09-07 20:46:17 +00:00
A compiler written in Haskell which can currently perform basic arithmetic. Currently using the megaparsec and llvm-hs libraries, but I plan to reimplement parsing and llvm generation myself. Built for the Introduction to Compiler Design class at The University of Texas at Dallas.
2023-09-07 20:57:58 +00:00
2023-09-07 22:15:02 +00:00
Main repo: https://git.sudoer.ch/me/really-bad-compiler-in-haskell
2023-09-07 20:57:58 +00:00
## Build Instructions
2023-09-15 06:57:17 +00:00
- Install `ghcup` (for managing Haskell tools) and `nix` (for managing external dependencies).
2023-09-08 03:57:12 +00:00
- Clone the repo.
- Use `ghcup` to install `stack 2.9.3`, `HLS 2.2.0.0`, `GHC 9.2.8`, and `cabal 3.6.2.0`.
2023-09-15 06:57:17 +00:00
- Use `stack run <file>` to run the program (for example, `stack run example/1`).
2023-09-07 20:57:58 +00:00
## Known bugs
### Building
- If llvm_16 is in the nix store, stack will use it for some reason and the build will fail. Currently, you may need to run `nix-store --delete /nix/store/<llvm16devdirectory>` to build it.
2023-09-11 17:05:44 +00:00
## File structure
- `app` - contains the compiler program
- `example` - contains example programs that can be compiled
2023-09-07 20:57:58 +00:00
## Credits
2023-09-08 03:57:12 +00:00
### Learning Resources Used
2023-09-07 22:15:02 +00:00
2023-09-07 20:57:58 +00:00
- Introduction to Compiler Design class at The University of Texas at Dallas, taught by Charles Averill
2023-09-08 03:57:12 +00:00
- learnyouahaskell.com (for learning Haskell basics)
- https://akashagrawal.me/2017/01/19/beginners-guide-to-megaparsec.html
- https://markkarpov.com/tutorial/megaparsec.html (for help writing a Haskell equation parser)
- https://www.forth.com/starting-forth/1-forth-stacks-dictionary/ (for learning Forth)
- https://blog.josephmorag.com/posts/mcc0/ (Haskell compiler tutorial with megaparsec, llvm-hs, and nix)
- https://gh.sudoer.ch/llvm-hs/llvm-hs-examples (for help writing an llvm code generator)
2023-09-07 22:15:02 +00:00
### Tools
- Language: Haskell
2023-09-08 03:57:12 +00:00
- Haskell tools: GHCup, Stack, Cabal
- Libraries: megaparsec, parser-combinators, text, llvm-hs-pure
2023-09-15 06:57:17 +00:00
- Dependencies: llvm, clang
2023-09-07 22:15:02 +00:00
- IDE: VSCodium
2023-09-08 03:57:12 +00:00
- Git platform: Forgejo
- AI: Phind (GPT-4), ollama (codellama)
2023-09-08 05:53:11 +00:00
- Search: Kagi, Stack Overflow