https://github.com/darinm223/lambcalc-smalltalk
https://github.com/darinm223/lambcalc-smalltalk
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/darinm223/lambcalc-smalltalk
- Owner: DarinM223
- Created: 2022-04-30T18:38:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-19T17:19:44.000Z (almost 4 years ago)
- Last Synced: 2025-05-17T17:11:20.408Z (about 1 year ago)
- Language: Smalltalk
- Homepage:
- Size: 130 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Lambcalc-Smalltalk
==================
Implementation of Lambcalc in Pharo Smalltalk, in order to compare with the Haskell version.
To install, run this in a playground:
```smalltalk
Metacello new
baseline: 'Lambcalc';
repository: 'github://DarinM223/lambcalc-smalltalk:master/src';
load.
```
Usage
-----
Showing the compilation output in the Transcript:
```smalltalk
LcCompiler compile: '(fn x => (fn y => x + y)) 2 3' on: Transcript.
Transcript flush
```
Creating a string of the compilation output:
```smalltalk
String streamContents: [ :out |
LcCompiler
compile: '(fn x => (fn y => x + y)) 2 3'
on: out ]
```
Creating a LLVM file that can be compiled to an executable with `llc`:
```smalltalk
" Creates a file called 'addition.ll' in your Smalltalk image directory. "
LcCompiler compile: '(fn x => (fn y => x + y)) 2 3' toFilename: 'addition.ll'
```