You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-12Lines changed: 13 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,43 +106,44 @@ To run an [asm file](vm/examples) with UVM:
106
106
cargo run examples/fizzbuzz.asm
107
107
```
108
108
109
-
There is also a toy C compilerin the `ncc` directory, along with many [example C programs](ncc/examples) that run on UVM:
109
+
There is also a C compiler, [uvclang](uvclang/README.md), in the `uvclang` directory, along with many [example C programs](uvclang/examples) that run on UVM:
110
110
```sh
111
-
cdncc
111
+
cduvclang
112
112
./build_and_run.sh examples/snake.c
113
113
```
114
+
uvclang uses clang as a front end, so it needs a working clang/LLVM installation. See the [uvclang README](uvclang/README.md) for details.
114
115
115
116
### Running the Test Suite
116
117
117
-
Run `cargo test` from the `vm`, and `ncc` directories.
118
+
Run `cargo test` from the `vm` and `uvclang` directories. uvclang also has shell-based end-to-end test harnesses; see the [uvclang README](uvclang/README.md).
118
119
119
120
## Codebase Organization
120
121
121
122
The repository is organized into a 3 different subprojects, each of which is a Rust codebase which can be compiled with `cargo`:
122
123
123
124
-`/vm` : The implementation of the UVM virtual machine itself
124
125
-[`/vm/examples/*`](vm/examples): Example assembly programs that can be run by UVM
125
-
-`/ncc`: An implementation of a toy C compiler that outputs UVM assembly
126
-
-[`/ncc/README.md`](ncc/README.md): documentation for the NCC compiler.
127
-
-[`/ncc/examples/*`](ncc/examples): Example C source files that can be compiled by NCC
126
+
-`/uvclang`: A C/C++ compiler that outputs UVM assembly, using clang as a front end
127
+
-[`/uvclang/README.md`](uvclang/README.md): documentation for the uvclang compiler
128
+
-[`/uvclang/examples/*`](uvclang/examples): Example C source files that can be compiled by uvclang
128
129
-`/spec`: A system to document and automatically export bindings for UVM system calls and constants.
129
130
-`/spec/syscalls.json`: Declarative list of system calls exposed by UVM.
130
131
-`/docs`: Markdown documentation for UVM
131
132
-[`/docs/syscalls.md`](docs/syscalls.md): List of system calls and constants accessible to UVM programs
132
133
133
-
The `ncc` compiler is, at the time of this writing, incomplete in that it lacks some C features and the error messages need improvement. This compiler
134
-
was implemented to serve as an example of how to write a compiler that targets UVM, and to write some library code to be used by other programs. Over
135
-
time, the `ncc` compiler will be improved. Despite its limitations, it is still usable to write small programs. Contributions to it are welcome.
134
+
The `uvclang` compiler drives clang to lower C/C++ to LLVM IR and then compiles that IR to UVM assembly. Because clang handles parsing, it supports the
135
+
full C/C++ language; the work in progress is in the LLVM IR to UVM back end, which does not yet cover every construct clang can emit. It is already usable
136
+
to write real programs, and ships with a set of UVM bindings and standard-library headers. Contributions are welcome.
136
137
137
138
The `spec` directory contains JSON files that represent a declarative list of system calls, constants and the permission system that UVM exposes
138
139
to programs running on it. This is helpful for documentation purposes, or if you want to build a compiler that targets UVM. The directory also contains
139
-
code that automatically generates [markdown documentation](docs/syscalls.md), Rust constants and [C definitions](ncc/include/uvm/syscalls.h) for system calls.
140
+
code that automatically generates [markdown documentation](docs/syscalls.md), Rust constants and [C definitions](uvclang/include/uvm/syscalls.h) for system calls.
140
141
141
142
## Open Source License
142
143
143
-
The code for UVM, NCC and associated tools is shared under the [Apache-2.0 license](https://github.com/maximecb/uvm/blob/main/LICENSE).
144
+
The code for UVM, uvclang and associated tools is shared under the [Apache-2.0 license](https://github.com/maximecb/uvm/blob/main/LICENSE).
144
145
145
-
The examples under the `vm/examples` and `ncc/examples` directories are shared under the [Creative Commons CC0](https://creativecommons.org/publicdomain/zero/1.0/) license.
146
+
The examples under the `vm/examples` and `uvclang/examples` directories are shared under the [Creative Commons CC0](https://creativecommons.org/publicdomain/zero/1.0/) license.
0 commit comments