Skip to content

Commit c152683

Browse files
committed
Add README for ts folder. Update main README with Rust instructions.
1 parent 8775c2c commit c152683

2 files changed

Lines changed: 61 additions & 19 deletions

File tree

README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,37 +31,38 @@ Download the repo and
3131
3232
```bash
3333
cd learning-compilers
34-
npm install
35-
npm run build
36-
npm run test
34+
cargo build
35+
cargo test
3736
```
3837

3938
to configure, build, and run the tests.
4039

41-
Then you can run the compiler by executing `./dist/main.js`. See the help for up to date info:
40+
Then you can run the compiler by executing `cargo run - arg1 arg2` or executing the right binary in `target/`. See the help for up to date info:
4241

4342
```bash
44-
$./dist/main.js -h
43+
$ cargo run - -h
44+
Compiles /path/to/input-file.c creating an executable /path/to/input-file
4545

46-
Usage: notcc [flags] /path/to/input-file.c
46+
Usage: notcc [OPTIONS] <C_FILE>
4747

48-
Compiles input-file.c creating an executable /path/to/input-file using the system gcc
48+
Arguments:
49+
<C_FILE> Input C source file
4950

5051
Options:
51-
52-
--lex Run the lexer but stop before parsing
53-
--print-tokens Print out the tokens found by the lexer
54-
--parse Run the lexer and parser but stop before codegen
55-
--pretty-print Pretty print the output of the parser
56-
--tacky Run the lexer, parser, and TACKY IR generation stopping before assembly generation
57-
--pretty-print-tacky Pretty print TACKY IR after generation
58-
--codegen Run the lexer, parser, codegen but stop before assembly generation
59-
-S, --asm-only Emit assembly in input-file.s rather than linking an executable
60-
-h, --help Show the help
52+
--lex Run the lexer but stop before parsing
53+
--print-tokens Print out the tokens found by the lexer
54+
--parse Run the lexer and parser but stop before codegen
55+
--pretty-print Pretty print the output of the parser
56+
--pretty-print-semantics Pretty print the output of semantic analysis
57+
--validate Run up to the parser and semantic analysis
58+
--tacky Run the lexer, parser, and TACKY IR generation stopping before assembly generation
59+
--pretty-print-tacky Pretty print TACKY IR after generation
60+
--codegen Run the lexer, parser, codegen but stop before assembly generation
61+
-S, --asm-only Emit assembly in input-file.s rather than linking an executable
62+
-h, --help Print help (see more with '--help')
63+
-V, --version Print version
6164
```
6265

63-
Running `npm link` will let you refer to this with its name `notcc`.
64-
6566
## The four compiler passes
6667

6768
The general flow is `lexer -> parser -> assembly generation -> code emission`.

original_typescript/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Legacy TypeScript implementation
2+
3+
This directory contains the legacy TypeScript implementation of `notcc`. It's left here for my reference and posterity. All new development is done in Rust in the main [src](../src) folder.
4+
5+
## Installing and using this repo
6+
7+
Download the repo and
8+
9+
```bash
10+
cd learning-compilers
11+
npm install
12+
npm run build
13+
npm run test
14+
```
15+
16+
to configure, build, and run the tests.
17+
18+
Then you can run the compiler by executing `./dist/main.js`. See the help for up to date info:
19+
20+
```bash
21+
$./dist/main.js -h
22+
23+
Usage: notcc [flags] /path/to/input-file.c
24+
25+
Compiles input-file.c creating an executable /path/to/input-file using the system gcc
26+
27+
Options:
28+
29+
--lex Run the lexer but stop before parsing
30+
--print-tokens Print out the tokens found by the lexer
31+
--parse Run the lexer and parser but stop before codegen
32+
--pretty-print Pretty print the output of the parser
33+
--tacky Run the lexer, parser, and TACKY IR generation stopping before assembly generation
34+
--pretty-print-tacky Pretty print TACKY IR after generation
35+
--codegen Run the lexer, parser, codegen but stop before assembly generation
36+
-S, --asm-only Emit assembly in input-file.s rather than linking an executable
37+
-h, --help Show the help
38+
```
39+
40+
Running `npm link` will let you refer to this with its name `notcc`.
41+

0 commit comments

Comments
 (0)