From 264c71e3a7666bc234a5dd62b1bcc36c89d1949d Mon Sep 17 00:00:00 2001 From: Shagun Agrawal Date: Thu, 25 Jul 2024 01:04:22 +0530 Subject: update readme with build/run instructions --- README.md | 98 +++++++++++++++++++++++++-------------------------------------- 1 file changed, 38 insertions(+), 60 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 6b9bee4..012f4a1 100644 --- a/README.md +++ b/README.md @@ -1,78 +1,56 @@ -# cljcc/cljcc +# cljcc -FIXME: my new application. +A toy C Compiler implementation in Clojure. -## Installation +Follows the book [Writing a C Compiler by Nora Sandler](https://nostarch.com/writing-c-compiler). -Download from https://github.com/cljcc/cljcc +## Prerequisites -## Usage +* [Clojure](https://clojure.org) +* [GraalVM](https://www.graalvm.org) for building native binary +* [babashka](https://github.com/babashka/babashka#installation) + +Only Linux and Mac OS is supported. For Windows, run through WSL. + +## Tasks -FIXME: explanation +To see all available tasks in the project, run `bb tasks`: -Run the project directly, via `:exec-fn`: +``` sh +bb tasks +The following tasks are available: - $ clojure -X:run-x - Hello, Clojure! +clean Removes target folder. +run-main Run main +build-uberjar Builds uberjar +run-uberjar Run uberjar +build-native Builds native image -Run the project, overriding the name to be greeted: +``` - $ clojure -X:run-x :name '"Someone"' - Hello, Someone! +## Build -Run the project directly, via `:main-opts` (`-m cljcc.cljcc`): +To build native image, run: - $ clojure -M:run-m - Hello, World! +``` sh +bb build-native +``` -Run the project, overriding the name to be greeted: +This produces a binary `cljcc` at `/target/cljcc`. Pass the path to the C file. - $ clojure -M:run-m Via-Main - Hello, Via-Main! +``` sh +./target/cljcc/cljcc "path/to/file.c" +``` -Run the project's tests (they'll fail until you edit them): +## Run - $ clojure -T:build test +``` sh +bb run-main "path/to/file.c" +``` -Run the project's CI pipeline and build an uberjar (this will fail until you edit the tests to pass): +## References - $ clojure -T:build ci +Some talks / projects which helped in implementation. -This will produce an updated `pom.xml` file with synchronized dependencies inside the `META-INF` -directory inside `target/classes` and the uberjar in `target`. You can update the version (and SCM tag) -information in generated `pom.xml` by updating `build.clj`. - -If you don't want the `pom.xml` file in your project, you can remove it. The `ci` task will -still generate a minimal `pom.xml` as part of the `uber` task, unless you remove `version` -from `build.clj`. - -Run that uberjar: - - $ java -jar target/net.clojars.cljcc/cljcc-0.1.0-SNAPSHOT.jar - -## Options - -FIXME: listing of options this app accepts. - -## Examples - -... - -### Bugs - -... - -### Any Other Sections -### That You Think -### Might be Useful - -## License - -Copyright © 2024 Shagunagrawal - -_EPLv1.0 is just the default for projects generated by `deps-new`: you are not_ -_required to open source this project, nor are you required to use EPLv1.0!_ -_Feel free to remove or change the `LICENSE` file and remove or update this_ -_section of the `README.md` file!_ - -Distributed under the Eclipse Public License version 1.0. +* [What's So Hard About Writing A Compiler, Anyway? Oh - Ramsey Nasser](https://www.youtube.com/watch?v=_7sncBhluXI) + -- cgit v1.2.3