Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 047c57b

Browse files
cknittcristianoc
authored andcommitted
Update README.md
1 parent 975a8ef commit 047c57b

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

README.md

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,54 +22,63 @@ J. Blow.
2222
### Setup & Usage (For Repo Devs Only)
2323

2424
Required:
25-
- [NodeJS](https://nodejs.org/)
26-
- Ocaml 4.06.1
27-
- OS: Mac
25+
26+
- OCaml 4.06.1
27+
- Dune
28+
- Reanalyze
29+
- OS: macOS, Linux or Windows (tests will currently run on macOS only)
2830

2931
```sh
30-
opam switch create 4.06.1 && eval $(opam env)
32+
opam switch create 4.06.1 # Note: on macOS ARM, do "arch -x86_64 zsh" first
33+
eval $(opam env)
34+
opam install dune reanalyze
3135
git clone https://github.com/rescript-lang/syntax.git
3236
cd syntax
33-
npm install
34-
make # or: make -j9 for faster build
37+
make # or "dune build"
3538
```
3639

37-
This will produce the final binary `lib/rescript.exe` used for testing.
40+
This will produce the three binaries `rescript`, `tests` and `bench` (with `.exe` extension on Windows).
3841

39-
We only build production binary, even in dev mode. No need for a separate dev binary when the build is fast enough. Plus, this encourages proper benchmarking of the (production) binary each diff.
42+
We only build production binaries, even in dev mode. No need for a separate dev binary when the build is fast enough. Plus, this encourages proper benchmarking of the (production) binary each diff.
4043

4144
After you make a change:
45+
4246
```sh
4347
make
4448
```
4549

4650
Run the core tests:
51+
4752
```sh
4853
make test
4954
```
5055

5156
Run the extended tests:
57+
5258
```sh
5359
make roundtrip-test
5460
```
5561

5662
Those will tell you whether you've got a test output difference. If it's intentional, check them in.
5763

5864
Debug a file:
65+
5966
```sh
6067
# write code in test.res
61-
./lib/rescript.exe test.res # test printer
62-
./lib/rescript.exe -print ast test.res # print ast
63-
./lib/rescript.exe -print ml test.res # show ocaml code
64-
./lib/rescript.exe -print res -width 80 test.res # test printer and change default print width
68+
dune exec -- rescript test.res # test printer
69+
dune exec -- rescript -print ast test.res # print ast
70+
dune exec -- rescript -print ml test.res # show ocaml code
71+
dune exec -- rescript -print res -width 80 test.res # test printer and change default print width
6572
```
6673

6774
Benchmark:
75+
6876
```sh
6977
make bench
7078
```
7179

7280
Enable stack trace:
81+
7382
```sh
7483
# Before you run the binary
7584
export OCAMLRUNPARAM="b"
@@ -79,7 +88,10 @@ This is likely a known knowledge: add the above line into your shell rc file so
7988

8089
### Development Docs
8190

82-
`src/syntax` contains all the source code. Don't change folder structure without notice; ReScript uses this repo as a submodule and assumes `src/syntax`.
91+
#### Folder Structure
92+
93+
- `src` contains all the parser/printer source code. Don't change folder structure without notice; The [rescript-compiler](https://github.com/rescript-lang/rescript-compiler) repo uses this repo as a submodule and assumes `src`.
94+
- `benchmarks`, `cli` and `tests` contain the source code for the executables used for testing/benchmarking. These are not used by the [rescript-compiler](https://github.com/rescript-lang/rescript-compiler) repo.
8395

8496
#### Error Reporting Logic
8597

@@ -97,8 +109,8 @@ Right now, ReScript's compiler's error reporting mechanism, for architectural re
97109
In a random project of yours:
98110

99111
```sh
100-
node_modules/.bin/bsrefmt --print=binary myFile.re | your/path/to/rescript.exe -parse reasonBinary -print ns > myFile.res
101-
node_modules/.bin/bsrefmt --print=binary --interface=true myFile.rei | your/path/to/rescript.exe -parse reasonBinary -print ns -interface > myFile.resi
112+
node_modules/.bin/bsrefmt --print=binary myFile.re | your/path/to/rescript -parse reasonBinary -print ns > myFile.res
113+
node_modules/.bin/bsrefmt --print=binary --interface=true myFile.rei | your/path/to/rescript -parse reasonBinary -print ns -interface > myFile.resi
102114
mv myFile.re myFile.re.backup # random backup name. Could be anything
103115
```
104116

0 commit comments

Comments
 (0)