Skip to content

Commit 5b9387f

Browse files
authored
Merge pull request #265 from gren-lang/update-readme
Update documentation for how to build compiler
2 parents a604353 + 1678178 commit 5b9387f

7 files changed

+79
-64
lines changed

CONTRIBUTING.md

-6
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ To do so:
3535
All PRs will be considered, but going through the above process significantly
3636
improves your chances of a merge!
3737

38-
## Local development commands
39-
40-
- build: `cabal build -f dev`
41-
- run tests: `cabal test -f dev`
42-
- format files: `ormolu --mode inplace $(git ls-files '*.hs')`
43-
4438
## Back-up / Historic Archives
4539

4640
There's also a [Zulip](https://gren.zulipchat.com) with older

README.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,23 @@ There are easier ways to install the compiler than compiling the source, you mig
66

77
## Build from source
88

9-
The Gren compiler is written in Haskell, so to build from source you need to have GHC 9.4 (Haskell compiler) and Cabal 3.8 (haskell build tool) installed on your system.
9+
This project uses [devbox](https://www.jetify.com/devbox) for managing dependencies required to build the project. If you don't want to use devbox,
10+
you can find a list of the requried dependencies and the commands for building the compiler in `devbox.json`.
1011

11-
You can install these using [ghcup](https://www.haskell.org/ghcup/). By default, ghcup will install an older version of Haskell and Cabal, so you can install and set the required versions using `ghcup tui`.
12+
Since Gren 0.4 the compiler is implemented in two parts. The Gren-part of the compiler lives in `src`, and once built it acts
13+
as a frontend to the Haskell-part of the compiler.
1214

13-
Compiling and installing the project should just be a matter of `cabal install`, after which you should be able to run the `gren` command from your command line.
15+
The end goal is for the entire compiler to be written in Gren.
1416

15-
Read the `CONTRIBUTING.md` file for some helpful commands for working on the compiler itself.
17+
To build the compiler:
18+
19+
1. Use `devbox run prepare-deps` to setup the required dependencies. The first time you run this it might take a while.
20+
2. Build the compiler with `devbox run build`. This will create a `cli.js` file and a `gren` executable in the project root directory.
21+
22+
You can now execute the Gren-part of the compiler with `node ./cli.js` or just `./cli.js`. This either requires `node` to be installed,
23+
or that you've entered the development shell by using `devbox shell`. The Gren-part of the compiler will by default download a pre-built
24+
binary of the Haskell-part from Github. If you want to run the compiler with the Haskell-part you've just built, set the path
25+
to the Haskell-binary in a `GREN_BIN` environment variable, like: `GREN_BIN=$PWD/gren node ./cli.js`.
26+
27+
You might also want to study the scripts defined in `devbox.json`. You can execute one of these scripts by running
28+
`devbox run <script_name>`.

ROADMAP.md

+2-13
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,5 @@ Also, keep in mind that this only focuses on the big picture. Major features lik
88

99
## Releases
1010

11-
- December 2023 - Parametric modules, or OCaml functors, to enable defining things like equality, comparisons etc. for your own types and use them in data structures like Dict. This release also removes the "magic" type classes currently in the language, like `number` and `comparable`.
12-
13-
- June 2024 - Stabelization period. Mostly bugfixes and code gen improvements. While we prepare for the next big thing.
14-
15-
- December 2024 - Re-evaluating how concurrency works in the language. More specifically, we'll re-evaluate how `Task`, `Cmd`, `Process` and effect modules work.
16-
17-
- June 2025 - Re-evaluate records and custom types.
18-
19-
- December 2025 - Re-evaluate interop: ports and kernel code.
20-
21-
- June 2026 - Compile to Web Assembly instead of JS. This will give us proper integers, big integers, hopefully smaller asset size and possibly enable future optimizations in codegen.
22-
23-
- December 2026 - The language is considered complete. Both the compiler and core packages will commit to maintaining backwards compatability from here on out.
11+
- June 2025 - Rewrite dependency management in Gren
12+
- December 2025 - Rewrite parser in Gren. Parametric modules. Operators as syntax sugar.

devbox.json

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.4/.schema/devbox.schema.json",
2+
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.5/.schema/devbox.schema.json",
33
"packages": [
44
"nodejs@20",
55
"ghc@9.4.8",
@@ -11,20 +11,27 @@
1111
"echo 'Welcome to devbox!' > /dev/null"
1212
],
1313
"scripts": {
14+
"prepare-deps": [
15+
"cabal update",
16+
"npm ci"
17+
],
18+
"build": [
19+
"npm run prepublishOnly",
20+
"./build_dev_bin.sh"
21+
],
22+
"test": [
23+
"cabal test"
24+
],
25+
"compiler": [
26+
"GREN_BIN=$PWD/gren node cli.js"
27+
],
1428
"format": [
1529
"ormolu --mode inplace $(git ls-files '*.hs')",
1630
"npm run prettier"
1731
],
1832
"format:check": [
1933
"ormolu --check-idempotence --mode check $(git ls-files '*.hs')",
2034
"npm run prettier:check"
21-
],
22-
"build": [
23-
"./build_dev_bin.sh",
24-
"npm run prepublishOnly"
25-
],
26-
"test": [
27-
"cabal test"
2835
]
2936
}
3037
}

devbox.lock

+28-28
Original file line numberDiff line numberDiff line change
@@ -115,131 +115,131 @@
115115
}
116116
},
117117
"nodejs@20": {
118-
"last_modified": "2024-09-10T15:01:03Z",
118+
"last_modified": "2024-10-13T23:44:06Z",
119119
"plugin_version": "0.0.2",
120-
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#nodejs_20",
120+
"resolved": "github:NixOS/nixpkgs/d4f247e89f6e10120f911e2e2d2254a050d0f732#nodejs_20",
121121
"source": "devbox-search",
122122
"version": "20.17.0",
123123
"systems": {
124124
"aarch64-darwin": {
125125
"outputs": [
126126
{
127127
"name": "out",
128-
"path": "/nix/store/hxl1k8qgmrm1vfq5f419iv4wybz9szqq-nodejs-20.17.0",
128+
"path": "/nix/store/fkapwdcjn9fm1n071jv7a75cw66x4wq7-nodejs-20.17.0",
129129
"default": true
130130
},
131131
{
132132
"name": "libv8",
133-
"path": "/nix/store/baf3p9zf8dn2arp6wjkdi3v0g2xgfd6y-nodejs-20.17.0-libv8"
133+
"path": "/nix/store/17gly8aw2qa535bw1014xbc264v496g1-nodejs-20.17.0-libv8"
134134
}
135135
],
136-
"store_path": "/nix/store/hxl1k8qgmrm1vfq5f419iv4wybz9szqq-nodejs-20.17.0"
136+
"store_path": "/nix/store/fkapwdcjn9fm1n071jv7a75cw66x4wq7-nodejs-20.17.0"
137137
},
138138
"aarch64-linux": {
139139
"outputs": [
140140
{
141141
"name": "out",
142-
"path": "/nix/store/vc64zpxndmp3xh9699yb2vpbl81pxbk0-nodejs-20.17.0",
142+
"path": "/nix/store/icf1zdxjpik986hqwa9vj33zk9ir5r7h-nodejs-20.17.0",
143143
"default": true
144144
},
145145
{
146146
"name": "libv8",
147-
"path": "/nix/store/0c57mzp5bqf0pp4a0pdj8wynphsgi92c-nodejs-20.17.0-libv8"
147+
"path": "/nix/store/yqira4250smxxpnxg3jc7r1csrsdz9yx-nodejs-20.17.0-libv8"
148148
}
149149
],
150-
"store_path": "/nix/store/vc64zpxndmp3xh9699yb2vpbl81pxbk0-nodejs-20.17.0"
150+
"store_path": "/nix/store/icf1zdxjpik986hqwa9vj33zk9ir5r7h-nodejs-20.17.0"
151151
},
152152
"x86_64-darwin": {
153153
"outputs": [
154154
{
155155
"name": "out",
156-
"path": "/nix/store/lgyrki1i0205nwh51c1h22bhl95x0nyd-nodejs-20.17.0",
156+
"path": "/nix/store/pfg4yz6c5kvk8wp29kvp56dl0yjahwgn-nodejs-20.17.0",
157157
"default": true
158158
},
159159
{
160160
"name": "libv8",
161-
"path": "/nix/store/n4xvswmgb3ql2440bkl8xk4i3b11w46x-nodejs-20.17.0-libv8"
161+
"path": "/nix/store/qm9202yha093jx33jkgxv2ra6yzgw6d2-nodejs-20.17.0-libv8"
162162
}
163163
],
164-
"store_path": "/nix/store/lgyrki1i0205nwh51c1h22bhl95x0nyd-nodejs-20.17.0"
164+
"store_path": "/nix/store/pfg4yz6c5kvk8wp29kvp56dl0yjahwgn-nodejs-20.17.0"
165165
},
166166
"x86_64-linux": {
167167
"outputs": [
168168
{
169169
"name": "out",
170-
"path": "/nix/store/w78sh036dyn14f29w8za9ni9syrmwm3q-nodejs-20.17.0",
170+
"path": "/nix/store/dcdc33kdjdhjnzg6rkmd0cx4kpwl8cac-nodejs-20.17.0",
171171
"default": true
172172
},
173173
{
174174
"name": "libv8",
175-
"path": "/nix/store/bsqha32xvv1j20bwkhr2wsnclk4qsi3a-nodejs-20.17.0-libv8"
175+
"path": "/nix/store/bv92rqliq5vnpwa2pwsdiphz48j87l47-nodejs-20.17.0-libv8"
176176
}
177177
],
178-
"store_path": "/nix/store/w78sh036dyn14f29w8za9ni9syrmwm3q-nodejs-20.17.0"
178+
"store_path": "/nix/store/dcdc33kdjdhjnzg6rkmd0cx4kpwl8cac-nodejs-20.17.0"
179179
}
180180
}
181181
},
182182
"ormolu@0.7": {
183-
"last_modified": "2024-10-06T02:39:15Z",
184-
"resolved": "github:NixOS/nixpkgs/7d49afd36b5590f023ec56809c02e05d8164fbc4#ormolu",
183+
"last_modified": "2024-10-13T23:44:06Z",
184+
"resolved": "github:NixOS/nixpkgs/d4f247e89f6e10120f911e2e2d2254a050d0f732#ormolu",
185185
"source": "devbox-search",
186186
"version": "0.7.2.0",
187187
"systems": {
188188
"aarch64-darwin": {
189189
"outputs": [
190190
{
191191
"name": "bin",
192-
"path": "/nix/store/m628xcmly4v168zrijnlvqd2vm64cs78-ormolu-0.7.2.0-bin",
192+
"path": "/nix/store/6ldik7pz7ivf2krr706rhb40zi1921xg-ormolu-0.7.2.0-bin",
193193
"default": true
194194
},
195195
{
196196
"name": "out",
197-
"path": "/nix/store/lgjigpsgmqi54pmpmrzbpzxp8swh3dmc-ormolu-0.7.2.0"
197+
"path": "/nix/store/gan5i2l229qp3mwyhsxvzsynjj3jl7vh-ormolu-0.7.2.0"
198198
}
199199
],
200-
"store_path": "/nix/store/m628xcmly4v168zrijnlvqd2vm64cs78-ormolu-0.7.2.0-bin"
200+
"store_path": "/nix/store/6ldik7pz7ivf2krr706rhb40zi1921xg-ormolu-0.7.2.0-bin"
201201
},
202202
"aarch64-linux": {
203203
"outputs": [
204204
{
205205
"name": "bin",
206-
"path": "/nix/store/clvpg96xy2wg0hn6z1vylfkbha6rvsqf-ormolu-0.7.2.0-bin",
206+
"path": "/nix/store/37vh0cnlj4lk58m3c0nna5azf8l9lyxw-ormolu-0.7.2.0-bin",
207207
"default": true
208208
},
209209
{
210210
"name": "out",
211-
"path": "/nix/store/3jjl8awy6g0l3158szvlil6siy9ijp35-ormolu-0.7.2.0"
211+
"path": "/nix/store/nm6sr2zmk1j8hrkrrzs6kr2igsa6vqsi-ormolu-0.7.2.0"
212212
}
213213
],
214-
"store_path": "/nix/store/clvpg96xy2wg0hn6z1vylfkbha6rvsqf-ormolu-0.7.2.0-bin"
214+
"store_path": "/nix/store/37vh0cnlj4lk58m3c0nna5azf8l9lyxw-ormolu-0.7.2.0-bin"
215215
},
216216
"x86_64-darwin": {
217217
"outputs": [
218218
{
219219
"name": "bin",
220-
"path": "/nix/store/xjnq2hb0wza1msy3pq1avqf5h8gj48hz-ormolu-0.7.2.0-bin",
220+
"path": "/nix/store/6zvrcw031fl96zj1579gakszxhng92vc-ormolu-0.7.2.0-bin",
221221
"default": true
222222
},
223223
{
224224
"name": "out",
225-
"path": "/nix/store/vp7q2lyar4wvkcyf89a7b8f6grjmmciz-ormolu-0.7.2.0"
225+
"path": "/nix/store/wjn200gcgbxlh5l9pnn9g2pqz3rl2mmd-ormolu-0.7.2.0"
226226
}
227227
],
228-
"store_path": "/nix/store/xjnq2hb0wza1msy3pq1avqf5h8gj48hz-ormolu-0.7.2.0-bin"
228+
"store_path": "/nix/store/6zvrcw031fl96zj1579gakszxhng92vc-ormolu-0.7.2.0-bin"
229229
},
230230
"x86_64-linux": {
231231
"outputs": [
232232
{
233233
"name": "bin",
234-
"path": "/nix/store/vlp9vbp2yibfcwpax8xp3yqfvagwm8sb-ormolu-0.7.2.0-bin",
234+
"path": "/nix/store/31wjfy7cwhma9q2rkyp3w7hlw5szpj02-ormolu-0.7.2.0-bin",
235235
"default": true
236236
},
237237
{
238238
"name": "out",
239-
"path": "/nix/store/pnyfjx2mv5x5c7ic75694f9n6fks4mnk-ormolu-0.7.2.0"
239+
"path": "/nix/store/v3n11ji64ibvggji9m8hq1cr6pl90b5k-ormolu-0.7.2.0"
240240
}
241241
],
242-
"store_path": "/nix/store/vlp9vbp2yibfcwpax8xp3yqfvagwm8sb-ormolu-0.7.2.0-bin"
242+
"store_path": "/nix/store/31wjfy7cwhma9q2rkyp3w7hlw5szpj02-ormolu-0.7.2.0-bin"
243243
}
244244
}
245245
}

package-lock.json

+13-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "gren-lang",
3-
"version": "0.4.5",
3+
"version": "0.4.6",
44
"description": "Compiler for the Gren programming language",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",
7-
"prepublishOnly": "gren make src/Main.gren --optimize --output=compiler.js",
7+
"prepublishOnly": "npx --package=gren-lang@0.4.5 -- gren make src/Main.gren --optimize --output=compiler.js",
88
"prettier": "prettier -w \"!**/*.json\" .",
99
"prettier:check": "prettier -c \"!**/*.json\" ."
1010
},
@@ -39,6 +39,7 @@
3939
"postject": "^1.0.0-alpha.6"
4040
},
4141
"devDependencies": {
42-
"prettier": "3.3.3"
42+
"prettier": "3.3.3",
43+
"gren-lang": "0.4.5"
4344
}
4445
}

0 commit comments

Comments
 (0)