diff --git a/Installation.md b/Installation.md new file mode 100644 index 0000000..fedbf26 --- /dev/null +++ b/Installation.md @@ -0,0 +1,20 @@ +# Perga +Perga is a Haskell project built using cabal, so should fairly easy to build and install if you are familiar with Haskell. I plan on nixifying the repo at some point, which would make installation significantly easier as well as reproducible, but for now, you can follow the following steps: +1. Install Haskell (I would highly recommend using [ghcup](https://www.haskell.org/ghcup/)), specifically GHC 9.8.2. +2. Install cabal, any recent version will do (I'm using the latest version, 3.12.1, at the time of writing). +3. Clone this repo `$ git clone https://forgejo.ballcloud.cc/wball/perga`. +4. Run the command `cabal install` from within the `perga` directory. This will compile `perga` and all of its dependencies and place the executable in `$HOME/.cabal/bin`. +5. Add `$HOME/.cabal/bin` to your `$PATH`. +Now you should have the command `perga` available. Run with no arguments, it should drop you into a REPL whose prompt is simply `> `. + +# Neovim plugin +Any text editor will do for editing `perga` files, though support is most available through the [perga.nvim](https://forgejo.ballcloud.cc/wball/perga.nvim) plugin, which provides syntax highlighting through treesitter, among other things. It can be installed just like any other neovim plugin. Here is an example [lazy.nvim](https://github.com/folke/lazy.nvim) plugin spec. +```lua +{ + "https://forgejo.ballcloud.cc/wball/perga.nvim", + config = true, +}, +``` +Upon installing the plugin, you will have to run `:TSInstall perga` in order to install the treesitter grammar. At this point, any file with the `.pg` file extension should have wonderful syntax highlighting. I would also recommend the plugin [rainbow-delimiters.nvim](https://github.com/HiPhish/rainbow-delimiters.nvim), which `perga.nvim` supports, which colors matching delimiters (e.g. parentheses) the same color. It is useful when working with any language with many nested delimiters (e.g. lisps), and that absolutely includes perga, at least for the moment. + +As a word of warning, if you use fancy treesitter plugins, they may not handle some perga syntax well, particularly any expressions involving binary operators. Perga features custom binary operators (similar to Haskell, though I would like to extend it to be more like Agda in the future), which does not play well with treesitter. As such, the treesitter parser just assumes all operators have the same precedence and are left associative. This completely produces the wrong syntax tree, but produces correct syntax highlighting. \ No newline at end of file