@@ -1,71 +1,41 @@
1[](http://purescript.org)
1[](http://purescript.org)
3−This is an experimental [Go](https://golang.org) compiler backend for [PureScript](https://github.com/purescript/purescript). It attempts to generate "sane", debuggable, and portable Go code as an intermediate language, which is then compiled to a native executable binary. This enables easy interoperability with existing Go frameworks and libraries on a number of platforms.
3+This is a platform-native compiler backend for [PureScript](https://github.com/purescript/purescript). It attempts to generate "sane", debuggable, and portable [C++11](https://isocpp.org/wiki/faq/cpp11) (or later) or [Go](https://golang.org/) code as an intermediate language, which is then compiled to a native executable binary. This also enables easy interoperability with existing C/C++ or Go frameworks and libraries on a number of platforms.
5−#### Platforms
5+There are two utilities in the purescript-native "suite": `pscpp` and `psgo`. The source code in this branch is for `pscpp`, the purescript-to-C++ transpiler. For the source code of the `psgo` purescript-to-Go transpiler / build tool, please see the [golang branch](https://github.com/andyarvanitis/purescript-native/tree/golang).
6−* Generated Go code and resulting binary executables tested (to at least some extent) on:
7− * macOS Mojave 10.14.5 (full test suite)
8− * Windows 10 x64 (full test suite)
9− * Linux Debian 10 amd64 (full test suite)
10− * ~~Raspberry Pi 3 B+ Raspbian official build (ARM)~~ (pending)
14−* No runtime system beyond some support types and functions
15−* Uses PureScript's normal tail call optimization techniques for generated Go code
17−#### Differences from PureScript:
19−* Foreign imports/exports are Go instead of JavaScript – see [standard library foreign implementations](https://github.com/andyarvanitis/purescript-native-go-ffi)
24−* The provided `Any` type is just an alias for `interface{}`
25−* PureScript types are represented in Go with:
27− | PureScript | Go |
7+#### Platforms
28− |------------|----|
8+* Although purescript-native should work on any platform supporting PureScript and modern C++ or Go, the generated code and resulting binary executables have been tested on:
29− |`Array` | `[]Any`|
9+ * macOS Mojave 10.14.5 – full test suite
30− |`String` | `string`|
10+ * For C++, Xcode 10.2.1's `clang` was used
31− |`Number` | `float64`|
11+ * For Go, `go` version 1.12.7 was used
32− |`Int` | `int`|
12+ * Windows 10 x64 – full test suite
33− |`Char` | `string` (single UTF-8 entity)|
13+ * C++: Visual Studio 2017 and `clang`
34− |`Boolean` | `bool`|
14+ * Go: `go` version 1.12.7
35− |Records | `map[string]Any`|
15+ * Linux Debian 9.5 amd64 – full test suite (C++)
36−
16+ * Default versions of `clang` and `gcc`
37−#### Future ideas:
17+ * Linux Debian 10 amd64 – full test suite (Go)
18+ * Default version of `go`
19+ * Raspberry Pi 3 B+ Raspbian official build (ARM), default versions of `clang` and `gcc`
39−* Nice facilities (modules) for concurrency/parallelism, using goroutines
41−#### Requirements for building the compiler itself
22+#### Requirements for building `pscpp` and `psgo`
43−* [Haskell Stack](https://docs.haskellstack.org/en/stable/README/) (if you're running macOS 10.13+, you can use pre-built binaries from [here](https://github.com/andyarvanitis/purescript-native/releases/))
24+* [Haskell Stack](https://docs.haskellstack.org/en/stable/README/) (if you're running macOS 10.14.5+, you can use pre-built binaries from [here](https://github.com/andyarvanitis/purescript-native/releases/))
45−#### Requirements for using it
26+#### Requirements for using PureScript + purescript-native
47* A recent version (0.13+) of [purescript](https://github.com/purescript/purescript/releases).
28* A recent version (0.13+) of [purescript](https://github.com/purescript/purescript/releases).
30+* For `pscpp`, a C++11-capable toolchain, e.g. recent versions of clang, gcc, Microsoft Visual Studio
31+ * GNU Make + `psc-package` is the default supported build tool, but you should be able to use your favorite package manager, C++ build system, tools, debuggers, etc.
49−* The [Go toolchain](https://golang.org) for your system.
32+* For `psgo`, the [Go toolchain](https://golang.org) for your system
51−* Your favorite PureScript package manager and build tools – but for simplicity these instructions will use [`spago`](https://github.com/spacchetti/spago).
33+ * You can use your favorite PureScript package manager and build tools – but for simplicity, [`spago`](https://github.com/spacchetti/spago) is recommended.
54−This assumes you are running macOS (OS X) or a Unix-like system (Linux, *BSD, etc.).
56−1. Choose a working directory wherever you like. Then create a `src` subdirectory under it, which will be where you will place your own PureScript source files.
58−2. Under your working directory, clone or copy [purescript-native-go-ffi](https://github.com/andyarvanitis/purescript-native-go-ffi). Place any of your own foreign implementations into subdirectories of your working directory. Make sure your Go package directories are all under a `src` directory (standard Go practice).
60−3. Initialize your project with `spago init`, and install any dependencies with `spago install` (please see their instructions if you haven't used it before).
62−4. You should now be ready to build a PureScript program:
36+#### For more information and a Getting Started guide, please see
63− * As stated above, place your source file(s) in the working directory's `src` subdirectory and execute
37+* [`pscpp`](https://github.com/andyarvanitis/purescript-native/blob/master/README-cpp.md)
64−
38+* [`psgo`](https://github.com/andyarvanitis/purescript-native/blob/golang/README-go.md)
66− spago build -- -g corefn && psgo
69− * This will generate the Go source tree for your program and then build an executable binary. The resulting executable will be in your working directory and will be named `Main`. The generated source files will be under `output/src/`.