Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dundalek committed Oct 9, 2018
1 parent abc3245 commit 57294a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/cookbook.md
@@ -1,7 +1,7 @@

## Autojump

To enable [Autojump](https://github.com/wting/autojump) refer to following [.closhrc](https://github.com/dundalek/dotfiles/blob/master/closh/.closh.cljs#L56) configuration.
To enable [Autojump](https://github.com/wting/autojump) refer to a following [configuration](https://github.com/dundalek/dotfiles/blob/master/closh/.closh_autojump.cljc).

## NVM integration

Expand Down
12 changes: 12 additions & 0 deletions doc/tech.md
Expand Up @@ -3,3 +3,15 @@
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.

## 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.
- **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.
- **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 57294a1

Please sign in to comment.