Rosetta Code/Run examples: Difference between revisions
m
→{{header|Wren}}: Minor tidy
(Updated the URL to get page content and updated the regular expression as "lang" has changed to "syntaxhighlight".) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 1,984:
This is designed to work for Go, Perl, Python and Wren itself though see the remarks in the Go entry about using the first three languages and other more general points.
As far as Wren is concerned, in addition to Wren-cli programs, this should be able to run DOME, Wren-gmp, Wren-sql, Wren-i64, Wren-linear, Wren-regex and Wren-
However, no attempt has been made - at least for now - to run other embedded programs (which can be identified by the presence of the 'foreign' keyword) due to a number of technical difficulties in doing so.
<syntaxhighlight lang="
import "./pattern" for Pattern
Line 2,072:
} else if (lang == "wren") {
lang2 = "Wren"
lang3 = "[
ext = "wren"
}
Line 2,115:
} else if (preamble.contains("{{libheader|Wren-regex}}")) {
Exec.run2("./wren-regex", fileName)
} else if (preamble.contains("{{libheader|Wren-psieve}}")) {
Exec.run2("./wren-psieve", fileName)
} else { // Wren-cli
Exec.run2("wren4", fileName)
Line 2,128 ⟶ 2,130:
}</syntaxhighlight>
We now embed this script in the following Go program and run it:
<syntaxhighlight lang="go">/* go run
package main
Line 2,252 ⟶ 2,254:
module := wren.NewModule(classMap)
fileName := "
vm.SetModule(fileName, module)
vm.InterpretFile(fileName)
|