Files
wren/doc/site/getting-started.markdown

90 lines
3.6 KiB
Markdown
Raw Permalink Normal View History

2014-04-09 07:53:30 -07:00
^title Getting Started
## Trying out the language
2015-08-30 22:38:40 -07:00
If you'd like to try Wren, you have a few options.
2015-08-30 22:38:40 -07:00
* **In your browser.** You can try Wren **[right here](./try/)**!
* **On your computer.** The [Wren CLI](cli) project is a downloadable executable
to run scripts with access to file io and more. See the [Wren CLI docs](cli).
* **Embedded in your code.** See how to [build and embed Wren](#embed-the-vm) below.
And then read the [embedding guide](embedding)!
2014-04-09 07:53:30 -07:00
Once you have somewhere to explore, it's time to [learn the
language](syntax.html).
2014-04-09 07:53:30 -07:00
---
## Embed the VM
2014-04-09 07:53:30 -07:00
**The Wren Virtual Machine** is the core of the language that executes Wren
source code. It is just a library, not a standalone application. It's
designed to be [embedded][] in a larger host application.
2015-08-30 22:38:40 -07:00
It has no dependencies beyond the C standard library.
You can use it as a static library, shared library, or simply compile the source into your app.
2015-08-30 22:38:40 -07:00
### Building Wren
2015-08-30 22:38:40 -07:00
To build the Wren library, we look inside the `projects/` folder.
In here you'll find ready to go projects for `Visual Studio`, `XCode` and tools like `make`.
2014-04-09 07:53:30 -07:00
* **Windows** Open `wren.sln` inside `projects/vs2019/` (or `vs2017`), hit build.
* **Mac** Open `wren.xcworkspace` inside `projects/xcode/`, hit build.
* **Linux** Run `make` inside of `projects/make/`.
2014-04-09 07:53:30 -07:00
In each case, **there will be library files generated into the root `lib/` folder**.
These are what you'll link into your project, based on your needs.
2014-04-09 07:53:30 -07:00
* **Static Linking** `wren.lib` on Windows, `libwren.a` elsewhere.
* **Dynamic Linking** `wren.dll` on Windows, `libwren.so` on Linux, and `libwren.dylib` on Mac.
2014-04-09 07:53:30 -07:00
<small>
Note that the default build will also generate `wren_test` inside of `bin/`,
a binary that is used to run the language tests. It can execute simple scripts.
</small>
2014-04-09 07:53:30 -07:00
**Other platforms**
If your platform isn't explicitly supported,
it is recommended that you include the Wren source
in your project for a portable experience.
2014-04-09 07:53:30 -07:00
### Including the code in your project
2014-04-09 07:53:30 -07:00
**all source files**
The alternative to building via the provided projects is to include the wren source code in your project.
Since it has no dependencies this is simple, all the code in `src/` comes along. There's a readme in `src/` for details.
2014-04-09 07:53:30 -07:00
**'amalgamated' build**
If you want an even simpler way, there's an 'amalgamated' build (often called `blob`, or `unity` builds.).
This is _all of the wren source code in one file_.
2014-04-09 07:53:30 -07:00
2021-04-06 19:59:42 -07:00
This file can be generated by running `python3 util/generate_amalgamation.py > build/wren.c`,
which saves the generated output in `build/wren.c`.
Include `build/wren.c` and `src/include/wren.h` in your project code and you're good to go.
<small>Ideally later we can automate generating this and include it in the repo.</small>
2014-04-09 07:53:30 -07:00
---
2014-04-09 07:53:30 -07:00
[embedded]: embedding
2014-04-09 07:53:30 -07:00
If you run into bugs, or have ideas or questions, any of
the following work:
2014-04-09 07:53:30 -07:00
* Join the [discord community][discord].
* Ask on the [Wren mailing list][list] (which is pretty quiet).
* Tell us on twitter at [@munificentbob][twitter] or [@ruby0x1][twitter0x1].
2015-01-20 17:46:52 -08:00
* [File a ticket][issue] at [the GitHub repo][repo].
* The CLI also has [tickets][issue_cli] and a [GitHub repo][repo_cli] too.
* Pull requests are welcome.
2015-01-20 17:46:52 -08:00
[discord]: https://discord.gg/Kx6PxSX
2015-01-20 17:46:52 -08:00
[list]: https://groups.google.com/forum/#!forum/wren-lang
[twitter]: https://twitter.com/intent/user?screen_name=munificentbob
[twitter0x1]: https://twitter.com/intent/user?screen_name=ruby0x1
[issue]: https://github.com/wren-lang/wren/issues
[repo]: https://github.com/wren-lang/wren
[issue_cli]: https://github.com/wren-lang/wren-cli/issues
[repo_cli]: https://github.com/wren-lang/wren-cli