2015-01-01 21:04:14 -08:00
<!DOCTYPE html>
< html >
< head >
< meta http-equiv = "Content-type" content = "text/html;charset=UTF-8" / >
2015-11-09 08:01:19 -08:00
< title > Getting Started – Wren< / title >
2020-06-05 22:25:23 +00:00
< script type = "application/javascript" src = "prism.js" data-manual > < / script >
< script type = "application/javascript" src = "codejar.js" > < / script >
< script type = "application/javascript" src = "wren.js" > < / script >
< link rel = "stylesheet" type = "text/css" href = "prism.css" / >
2015-01-01 21:04:14 -08:00
< link rel = "stylesheet" type = "text/css" href = "style.css" / >
2015-01-15 21:18:18 -08:00
< link href = '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic|Source+Code+Pro:400|Lato:400|Sanchez:400italic,400' rel = 'stylesheet' type = 'text/css' >
2015-01-01 21:04:14 -08:00
<!-- Tell mobile browsers we're optimized for them and they don't need to crop
the viewport. -->
< meta name = "viewport" content = "width=device-width, initial-scale=1, maximum-scale=1" / >
< / head >
< body id = "top" >
< header >
< div class = "page" >
< div class = "main-column" >
2015-01-18 15:37:50 -08:00
< h1 > < a href = "./" > wren< / a > < / h1 >
2020-06-05 22:25:23 +00:00
< h2 > a classy little scripting language< / h2 >
2015-01-01 21:04:14 -08:00
< / div >
< / div >
< / header >
< div class = "page" >
2015-11-09 08:01:19 -08:00
< nav class = "big" >
2019-02-06 02:52:27 +00:00
< a href = "./" > < img src = "./wren.svg" class = "logo" > < / a >
2015-01-01 21:04:14 -08:00
< ul >
< li > < a href = "getting-started.html" > Getting Started< / a > < / li >
2015-11-09 08:01:19 -08:00
< li > < a href = "contributing.html" > Contributing< / a > < / li >
2019-02-06 02:52:27 +00:00
< li > < a href = "blog" > Blog< / a > < / li >
2020-06-05 22:25:23 +00:00
< li > < a href = "try" > Try it!< / a > < / li >
2015-01-01 21:04:14 -08:00
< / ul >
< section >
2019-02-06 02:52:27 +00:00
< h2 > guides< / h2 >
2015-01-01 21:04:14 -08:00
< ul >
< li > < a href = "syntax.html" > Syntax< / a > < / li >
< li > < a href = "values.html" > Values< / a > < / li >
< li > < a href = "lists.html" > Lists< / a > < / li >
< li > < a href = "maps.html" > Maps< / a > < / li >
2015-11-09 08:01:19 -08:00
< li > < a href = "method-calls.html" > Method Calls< / a > < / li >
< li > < a href = "control-flow.html" > Control Flow< / a > < / li >
< li > < a href = "variables.html" > Variables< / a > < / li >
< li > < a href = "classes.html" > Classes< / a > < / li >
2021-04-08 04:25:47 +00:00
< li > < a href = "functions.html" > Functions< / a > < / li >
2015-11-09 08:01:19 -08:00
< li > < a href = "concurrency.html" > Concurrency< / a > < / li >
< li > < a href = "error-handling.html" > Error Handling< / a > < / li >
< li > < a href = "modularity.html" > Modularity< / a > < / li >
2015-01-01 21:04:14 -08:00
< / ul >
< / section >
< section >
2020-06-05 22:25:23 +00:00
< h2 > API docs< / h2 >
2015-01-01 21:04:14 -08:00
< ul >
2015-11-09 08:01:19 -08:00
< li > < a href = "modules" > Modules< / a > < / li >
2020-06-05 22:25:23 +00:00
< / ul >
< / section >
< section >
< h2 > reference< / h2 >
< ul >
< li > < a href = "cli" > Wren CLI< / a > < / li >
2017-10-19 07:05:45 -07:00
< li > < a href = "embedding" > Embedding< / a > < / li >
2015-01-01 21:04:14 -08:00
< li > < a href = "performance.html" > Performance< / a > < / li >
< li > < a href = "qa.html" > Q & A< / a > < / li >
< / ul >
< / section >
< / nav >
2015-11-09 08:01:19 -08:00
< nav class = "small" >
< table >
< tr >
2019-10-03 06:50:59 +00:00
< div > < a href = "getting-started.html" > Getting Started< / a > < / div >
< div > < a href = "contributing.html" > Contributing< / a > < / div >
< div > < a href = "blog" > Blog< / a > < / div >
2020-06-05 22:25:23 +00:00
< div > < a href = "try" > Try it!< / a > < / div >
2015-11-09 08:01:19 -08:00
< / tr >
< tr >
2019-02-06 02:52:27 +00:00
< td colspan = "2" > < h2 > guides< / h2 > < / td >
2015-11-09 08:01:19 -08:00
< td > < h2 > reference< / h2 > < / td >
< / tr >
< tr >
< td >
< ul >
< li > < a href = "syntax.html" > Syntax< / a > < / li >
< li > < a href = "values.html" > Values< / a > < / li >
< li > < a href = "lists.html" > Lists< / a > < / li >
< li > < a href = "maps.html" > Maps< / a > < / li >
< li > < a href = "method-calls.html" > Method Calls< / a > < / li >
< li > < a href = "control-flow.html" > Control Flow< / a > < / li >
< / ul >
< / td >
< td >
< ul >
< li > < a href = "variables.html" > Variables< / a > < / li >
< li > < a href = "classes.html" > Classes< / a > < / li >
2021-04-08 04:25:47 +00:00
< li > < a href = "functions.html" > Functions< / a > < / li >
2015-11-09 08:01:19 -08:00
< li > < a href = "concurrency.html" > Concurrency< / a > < / li >
< li > < a href = "error-handling.html" > Error Handling< / a > < / li >
< li > < a href = "modularity.html" > Modularity< / a > < / li >
< / ul >
< / td >
< td >
< ul >
2020-06-05 22:25:23 +00:00
< li > < a href = "modules" > API/Modules< / a > < / li >
2017-10-19 07:05:45 -07:00
< li > < a href = "embedding" > Embedding< / a > < / li >
2015-11-09 08:01:19 -08:00
< li > < a href = "performance.html" > Performance< / a > < / li >
< li > < a href = "qa.html" > Q & A< / a > < / li >
< / ul >
< / td >
< / tr >
< / table >
< / nav >
2015-01-01 21:04:14 -08:00
< main >
2019-02-06 02:52:27 +00:00
< h2 > Getting Started< / h2 >
2020-06-05 22:25:23 +00:00
< h2 > Trying out the language < a href = "#trying-out-the-language" name = "trying-out-the-language" class = "header-anchor" > #< / a > < / h2 >
< p > If you’ d like to try Wren, you have a few options.< / p >
< ul >
< li > < strong > In your browser.< / strong > You can try Wren < strong > < a href = "./try/" > right here< / a > < / strong > !< / li >
< li > < strong > On your computer.< / strong > The < a href = "cli" > Wren CLI< / a > project is a downloadable executable
to run scripts with access to file io and more. See the < a href = "cli" > Wren CLI docs< / a > .< / li >
< li > < strong > Embedded in your code.< / strong > See how to < a href = "#embed-the-vm" > build and embed Wren< / a > below. < br / >
And then read the < a href = "embedding" > embedding guide< / a > !< / li >
< / ul >
< p > Once you have somewhere to explore, it’ s time to < a href = "syntax.html" > learn the
language< / a > .< / p >
< hr / >
< h2 > Embed the VM < a href = "#embed-the-vm" name = "embed-the-vm" class = "header-anchor" > #< / a > < / h2 >
< p > < strong > The Wren Virtual Machine< / strong > 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 < a href = "embedding" > embedded< / a > in a larger host application.< / p >
< p > 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.< / p >
< h3 > Building Wren < a href = "#building-wren" name = "building-wren" class = "header-anchor" > #< / a > < / h3 >
< p > To build the Wren library, we look inside the < code > projects/< / code > folder.
In here you’ ll find ready to go projects for < code > Visual Studio< / code > , < code > XCode< / code > and tools like < code > make< / code > .< / p >
< ul >
< li > < strong > Windows< / strong > Open < code > wren.sln< / code > inside < code > projects/vs2019/< / code > (or < code > vs2017< / code > ), hit build.< / li >
< li > < strong > Mac< / strong > Open < code > wren.xcworkspace< / code > inside < code > projects/xcode/< / code > , hit build.< / li >
< li > < strong > Linux< / strong > Run < code > make< / code > inside of < code > projects/make/< / code > .< / li >
< / ul >
< p > In each case, < strong > there will be library files generated into the root < code > lib/< / code > folder< / strong > . < br / >
These are what you’ ll link into your project, based on your needs.< / p >
2015-09-11 21:39:04 -07:00
< ul >
2020-06-05 22:25:23 +00:00
< li > < strong > Static Linking< / strong > < code > wren.lib< / code > on Windows, < code > libwren.a< / code > elsewhere.< / li >
< li > < strong > Dynamic Linking< / strong > < code > wren.dll< / code > on Windows, < code > libwren.so< / code > on Linux, and < code > libwren.dylib< / code > on Mac.< / li >
2015-09-11 21:39:04 -07:00
< / ul >
2020-06-05 22:25:23 +00:00
< p > < small >
Note that the default build will also generate < code > wren_test< / code > inside of < code > bin/< / code > , < br / >
a binary that is used to run the language tests. It can execute simple scripts.
< / small > < / p >
< p > < strong > Other platforms< / strong > < br / >
If your platform isn’ t explicitly supported,
it is recommended that you include the Wren source
in your project for a portable experience.< / p >
< h3 > Including the code in your project < a href = "#including-the-code-in-your-project" name = "including-the-code-in-your-project" class = "header-anchor" > #< / a > < / h3 >
< p > < strong > all source files< / strong > < br / >
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 < code > src/< / code > comes along. There’ s a readme in < code > src/< / code > for details.< / p >
< p > < strong > ’ amalgamated’ build< / strong > < br / >
If you want an even simpler way, there’ s an ‘ amalgamated’ build (often called < code > blob< / code > , or < code > unity< / code > builds.).
This is < em > all of the wren source code in one file< / em > .< / p >
2021-04-08 01:41:04 +00:00
< p > This file can be generated by running < code > python3 util/generate_amalgamation.py > build/wren.c< / code > ,
which saves the generated output in < code > build/wren.c< / code > .< / p >
< p > Include < code > build/wren.c< / code > and < code > src/include/wren.h< / code > in your project code and you’ re good to go.
2020-06-05 22:25:23 +00:00
< small > Ideally later we can automate generating this and include it in the repo.< / small > < / p >
< hr / >
< p > If you run into bugs, or have ideas or questions, any of
the following work:< / p >
2015-01-01 21:04:14 -08:00
< ul >
2020-06-05 22:25:23 +00:00
< li > Join the < a href = "https://discord.gg/Kx6PxSX" > discord community< / a > .< / li >
< li > Ask on the < a href = "https://groups.google.com/forum/#!forum/wren-lang" > Wren mailing list< / a > (which is pretty quiet).< / li >
< li > Tell us on twitter at < a href = "https://twitter.com/intent/user?screen_name=munificentbob" > @munificentbob< / a > or < a href = "https://twitter.com/intent/user?screen_name=ruby0x1" > @ruby0x1< / a > .< / li >
< li > < a href = "https://github.com/wren-lang/wren/issues" > File a ticket< / a > at < a href = "https://github.com/wren-lang/wren" > the GitHub repo< / a > .< / li >
< li > The CLI also has < a href = "https://github.com/wren-lang/wren-cli/issues" > tickets< / a > and a < a href = "https://github.com/wren-lang/wren-cli" > GitHub repo< / a > too.< / li >
< li > Pull requests are welcome.< / li >
2015-01-01 21:04:14 -08:00
< / ul >
< / main >
< / div >
< footer >
< div class = "page" >
< div class = "main-column" >
2015-11-09 08:01:19 -08:00
< p > Wren lives
2019-02-06 02:52:27 +00:00
< a href = "https://github.com/wren-lang/wren" > on GitHub< / a >
2015-11-09 08:01:19 -08:00
— Made with ❤ by
< a href = "http://journal.stuffwithstuff.com/" > Bob Nystrom< / a > and
2020-06-12 17:15:45 +00:00
< a href = "https://github.com/wren-lang/wren/blob/main/AUTHORS" > friends< / a > .
2015-11-09 08:01:19 -08:00
< / p >
2015-01-01 21:04:14 -08:00
< div class = "main-column" >
< / div >
< / footer >
< / body >
2015-04-25 08:50:08 -07:00
< / html >