This project is talked about on my youtube channel JBrosDevelopment and my blog.
This Project is to follow the evolution of the Computers from opcode to programming languages. First is to learn the opcodes and how to run programs in web assembly binary. After I do this, I will create my own Assembly language for the web assembly binary. Once I have that, I can create my own C type programming language that will compile into my Assembly language and then into the web assembly binary.
- Full assembler and assembly language (
wal: Web Assembly Language) - Full Compiler that compiles a C type programming language (
cweb: C Web Assembly) intowaland then into web assembly binary. - For
cwebto be able to be compiled by thegcccompiler into an executable as well as by this project into web assembly binary. (Makecweba superset of C but with less features) - A linker that can link multiple
walandcwebfiles into a single web assembly binary, allowing for easier programming with modularity and multiple files. - A build system written in
cwebthat compiles into a library usinggccthat ports to other languages for use in other projects. This is to eventually make other programming languages that compile using mycwebbuild system. (Basically my own custom LLVM)
I will update the DEVLOG as I progress through the project. Treat this almost as a blog of my progress.
I also do have a youtube channel and a blog, where I will be posting progress videos and blog posts about this project.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Please feel free to clone and fork this project! Any pull requests are welcome and will be looked at and may be merged if it alilgns with the goals of this project. It also may be included in the next video.
After cloning this repository, to run the assembler you will need the following:
Using Node.js, you can run the assembler using the following command:
node Assembler/assemble.js <version (ie. 0.7)> <input file (wal)> <output file (wasm)>Note when running the assembler with Node.js, versions 1.0+ of the assembler use WASI functions so Node.js will not work and Wasmtime is required.
Using Wasmtime, you can run the assembler using the following command:
wasmtime run --dir . Assembler/bin/assembler.<version (ie. 1.2)>.wal.wasm <input file (wal)> <output file (wasm)>Note when running the assembler with Wasmtime, versions 1.0+ of the assembler use WASI functions so Wasmtime is required and Node.js will not work.
Once you have a wasm file, follow these steps to run it
With Node.js, you can run the wasm file using the following command:
node Assembler/run.js <input file (wasm)>Note when running a wasm file with Node.js, any import functions defined in the WAL file will need to be defined in the JavaScript file used to run the wasm file. If you want to use specific WASI functions, you can import the
@wasmer/wasipackage and use it to run the wasm file, or you can use Wasmtime if you're not using any custom import functions.
With Wasmtime, you can run the wasm file using the following command:
wasmtime run <input file (wasm)>Note when running a wasm file with Wasmtime, any import functions will need to be specific WASI functions. If you want to use your own import functions, you will need to use Node.js to run the wasm file.
Open up the example directory after cloning this repository. The fibonacci.wal file is a simple program that calculates the fibonacci sequence. It uses Assembler.1.2. You can assemble it and run it with the following commands:
wasmtime run --dir . Assembler/bin/assembler.1.2.wal.wasm Example/fibonacci.wal fibonacci.wasm
node Example/run-fibonacci.jsThis program uses the console.log function to print the fibonacci sequence to the console. You can change the input number in the run-fibonacci.js file to calculate a different fibonacci number.