Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mkchoi212/LBAC-Swift
Learn how to build a compiler by interacting with Let's Build a Compiler by Jack Crenshaw in Swift Playgrounds
https://github.com/mkchoi212/LBAC-Swift
compiler compiler-construction compiler-principles swift swift-playgrounds
Last synced: 3 months ago
JSON representation
Learn how to build a compiler by interacting with Let's Build a Compiler by Jack Crenshaw in Swift Playgrounds
- Host: GitHub
- URL: https://github.com/mkchoi212/LBAC-Swift
- Owner: mkchoi212
- Created: 2017-08-01T02:29:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-06T03:10:05.000Z (almost 7 years ago)
- Last Synced: 2024-04-24T08:29:15.909Z (6 months ago)
- Topics: compiler, compiler-construction, compiler-principles, swift, swift-playgrounds
- Language: Swift
- Homepage:
- Size: 384 KB
- Stars: 162
- Watchers: 9
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- Awesome-Swift-Playgrounds - Let's build a compiler in Swift - Let's Build a Compiler by Jack Crenshaw translated to Swift Playgrounds. π (Theoretical Computer Science / Languages)
README
LBAC Swift
"Let's Build a Compiler" translated to Swift Playgrounds
This repo is an attempt to learn how compilers work by translating Jack W. Crenshaw's [Let's Build a Compiler](http://www.compilers.iecc.com/crenshaw/) book into Swift Playgrounds.
## πΊοΈ How to Navigate
The original book is divided into 16 chapters and if you haven't noticed already, there are also 16 Playground files in this repo.**Each Playground file represents a chapter in the book**. However, because fitting an entire chapter into a single Playground file would be impractical, each chapter has been divided into several "Parts".
### .playground Structure
A `.playground` file is actually composed of *three* directories.
1. `Parts` - individual parts of a book resides in
2. `Sources` - `Cradle.swift`, which contains all the boilerplate code used throughout the book is contained here
3. `Resource` - the original LBaC text file `tutor(n).txt` , is contained here> If you can't seem to find these directories after opening your `.playground` file, press `β + 0` to show the Navigator (left panel).
## β οΈ Notes
- The original Let's Build a Compiler (LBaC) was written in Turbo Pascal, a very popular language at the time. Pascal is very different from Swift and because of this, "literally" converting Pascal code into Swift is quite unnatural.
- To make the code as "Swifty" as possible, I have taken the liberty to make some changes in the code. Please feel free to offer suggestions on making the code even "Swifty-er"
- This has turned out to be more time consuming than I have imagined in the beginning. Therefore, **out of the 16 chapters, 10 have been completed so far**; feel free to continue on from where I have left off πββοΈ## β Contributing
This is an open source project so feel free to contribute by
- Opening an [issue](https://github.com/mkchoi212/LBAC-Swift/issues/new)
- Sending me feedback via [email](mailto://[email protected])
- Or [tweet](https://twitter.com/Bananamlkshake2) at me!