Skip to content

Commit

Permalink
Merge pull request dundalek#177 from SSYH/patch-1
Browse files Browse the repository at this point in the history
Some minor wording suggestions
  • Loading branch information
dundalek authored Jan 23, 2021
2 parents dec68b4 + bdb707e commit 80735a4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/tech.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

Closh runs ClojureSript on node.js via [lumo](https://github.com/anmonteiro/lumo/) REPL. In order to be somewhat bashward compatible there is a command mode which transforms top-level forms in a macro-like way.

Thanks to Clojure's syntax for symbols supporting almost all characters we don't need to roll out a custom parser to support convenient unquoted notation for filenames and switches. Only customization done to a built-in reader is the support multiple slashes in a symbol, which is required for nested directories.
Thanks to Clojure's syntax for symbols supporting almost all characters we don't need to roll out a custom parser to support convenient unquoted notation for filenames and switches. The only customization done to the built-in reader is the support for multiple slashes in a symbol, which is required for nested directories.

## Architecture

To get an idea of the scope of an implementation, here is a basic overview of closh components:
- **reader** - Since most shell operators can be just read as symbols writing custom reader could be avoided so reading is done with `tools.reader`. It needed minor tweaks to read things like IP addresses (e.g. `8.8.8.8` which would be an invalid number) or paths (e.g. `/a/path/to/file` which would be an invalid symbol). Thanks to `tools.reader` being written in Clojure the customizations were fairly simple.
- **reader** - Since most shell operators can be just read as symbols, writing a custom reader can be avoided so reading is done with `tools.reader`. It needed minor tweaks to read things like IP addresses (e.g. `8.8.8.8` which would be an invalid number) or paths (e.g. `/a/path/to/file` which would be an invalid symbol). Thanks to `tools.reader` being written in Clojure the customizations were fairly simple.
- **parser** - `clojure.spec` is used for parsing, specs look like a grammar for parser generators. Doing conform transforms the input into AST.
- **compiler** - This is just a data transformation using plain clojure functions. Generated code uses the `pipeline`.
- **pipeline** - Functionality to run sequence of processes and pipe data.
- **platform** - Abstracted functions to spawn processes and redirect IO. Abstractions for JVM and node.js provide almost identical API which the pipeline utilizes.
- **platform** - Abstracted functions to spawn processes and redirect IO. Abstractions for JVM and node.js provide an almost identical API which the pipeline utilizes.
- **frontend** - This provides the repl for interactive use. For CLJS version we use internal node.js `readline` module. The CLJ version runs on `clojure.main/repl` with `rebel-readline`.

The **reader** customization, **platform** and **frontends** have separate implementations for CLJ and CLJS versions. The code for **parser**, **compiler** and **pipeline** is shared (using common CLJC files).

0 comments on commit 80735a4

Please sign in to comment.