langur

Linux installation

These are the general instructions for installing langur 0.5. If you're installing the current version of langur, click here.

Installation on macOS might be similar.

  1. Install the Go language. I've tested with go 1.10.

  2. Set the GOPATH environment variable. The following links may be helpful. Note that this might not be necessary since langur 0.10.2, which uses Go modules.

    • SettingGOPATH
    • Golang Installation, Setup, GOPATH, and Go Workspace
    • Understanding the GOPATH

      "Introduced in Go 1.11, Go Modules aim to replace Go Workspaces and the GOPATH. While it is recommended to start using modules, some environments, such as corporate environments, may not be ready to use modules.

      The GOPATH is one of the trickier aspects of setting up Go, but once it is set up, we can usually forget about it." – digitalocean.com ...

  3. Preferably, install an integrated development environment (IDE) to use with Go. I've been using LiteIDE.

  4. Copy the /src/ files from the download archive to the appropriate user Go source folder on your system (something like ~/go/src/).

  5. Note that the following might not be necessary since langur 0.10.2, which uses Go modules. It may be that the necessary dependencies will be downloaded for you automatically.

    Otherwise, the simplest way to install the needed packages may be to use go get from the command line (requires that you also have git installed, which you likely do if you're running Linux) ...

    go get github.com/rin01/decnum go get golang.org/x/text/language go get golang.org/x/text/unicode/norm

    Note that, as 0.8, you don't need the decnum library any more, as it uses a modified version of the shopspring/decimal library, included with the 0.8 download.

  6. Note that the following is not necessary with langur 0.9.3.
    With 0.9.2 or earlier, you'll need to copy the files from Go's regexp folder (something like /usr/lib/go-1.10/src/regexp) to the src/langur/regexp folder. This is to account for the missing replace-with-maximum-count method in Go's standard library, which is needed to make langur's regex methods complete for re2.

  7. Once you have these things in place, you can test langur through the REPL. And, if you build langur, you can execute script files, of course.

langur/regexp folder

langur/regexp folder before copying files
example langur/regexp folder before copying files

langur/regexp folder after copying files
example langur/regexp folder after copying files