mrakgr / The-Spiral-Language

Functional language with intensional polymorphism and first-class staging.
Mozilla Public License 2.0
919 stars 27 forks source link

Instructions for building on other platforms #2

Closed ararslan closed 3 years ago

ararslan commented 6 years ago

Hi there! Does Spiral currently support platforms other than Windows? If so, could you add some documentation on how to build the compiler and everything? If not, are there plans to support them, perhaps via Mono?

mrakgr commented 6 years ago

I haven't tested the Spiral compiler on anything apart from Windows + VS. Since it uses very standard F# features if FParsec works on those other platforms, I'd assume the compiler should work properly as well. You'll have to try it yourself as I am interested more in building up the deep learning library for the language.

It should not be hard. The Spiral Language project has only 6 .fs files directly owned by the compiler, and only 4 (~4.3k LOC) of those are needed to build it. The last two .fs files are the standard library and the unit tests. Just copying those 4 files into the folder and adding FParsec which is its only dependency at the moment should be enough to build it.

If you are interested in whether Spiral supports compiling to platforms other than Windows, then the answer would be yes with the caveat that the standard library has not been tested on anything but Windows. Spiral uses macros for language interop which makes it easy to pay as you go with respect to interfacing with other languages, but does make true cross platform portability difficult. Some modules are free of that, but others - especially the ones in the Learning project make heavy use of those due to needing to interface with the Cuda API.

mrakgr commented 6 years ago

Let me make a short add to just say that supporting other platforms and compilation targets than the ones that are currently here are not a priority for me. Spiral was created so I could create a ML library which was too difficult to do in F# or any other language. I could imagine ditching Cuda for something else when Intel's neural processors or some other architecture lands on the scene and pushes GPUs out, but apart from that Spiral's development will be driven by my own interests.

If somebody wants to extend the project so it supports other platforms I do intend to support that effort on my end in the form of answering questions, reviewing pull requests, fixing compiler bugs and in some cases extending the language to make such process easier.

If you manage to make Spiral work on Mono and want to add that to the documentation, do send a pull request. Tell me how it went if you try.

rhencke commented 6 years ago

For what it's worth, I've successfully compiled on macOS using Mono. I had to make some slight modifications to Testing/run.fs to use forward slashes for paths, and to use bin/Debug over bin/Release.

I honestly do not remember my exact set of steps, but it was something like:

nuget restore
msbuild
# Change Testing/run.fs to use forward slashes, bin/Debug
fsharpi --use Testing/run.fs # or maybe it was --load, I forget

I did not get much further than this - apologies for the vague instructions. But, yes, it is possible, and it is not too much work.

mrakgr commented 6 years ago

I wonder why in Release mode it did not work? I really do prefer Release much more than Debug unless I am debugging as it results in a much faster compiler. Not to mention the tail call optimizations are needed to compile larger than small programs without running into stack overflow.

rhencke commented 6 years ago

Honestly, it may have been something as simple as the default solution configuration was set to Debug. I'll see if I can look deeper tonight.

mrakgr commented 3 years ago

I'll close this as v0.09 is history. v0.2 alpha will be out on the VS Code marketplace today or tomorrow. Feel free to reopen this issue for v0.2.