r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Topaz] The Topaz Language

BrianH
26-Nov-2011
[254]
Well, Topaz compiles to or is interpreted in JavaScript at the moment. 
There are several ways to run JS on Windows outside of web browsers 
- it is one of the ActiveScripting languages, so you can use cscript, 
for instance - or you can load the Topaz environment in a web page, 
which can be a local html file with no web server needed. None of 
this is tested yet, of course, so be sure to tell us how well that 
works for you :)
Pekr
26-Nov-2011
[255]
Could I have the option, that editing html page, I would see the 
topaz (on client), and once run, it compiles at that time?
PeterWood
26-Nov-2011
[256]
I wrote some notes on how to get and install Topaz at https://github.com/giesse/Project-SnowBall/wiki/Topaz-:-Getting-Started


There a little old but should still work. If not please let me know.
Gabriele
27-Nov-2011
[257]
Peter's how to should work. Or, just use a real operating system. 
:P
BrianH
27-Nov-2011
[258x4]
He was asking about how to run Topaz outside of a browser. All of 
the suggestions I made above apply to Linux as well, except you have 
to install your own JS interpreter instead of using the one that 
comes preinstalled on Windows. So, it's a bit harder on your "real" 
operating system.
Oh, I see, you're installing a JS interpreter on Windows as well 
instead of using the built-in one, or even one that is made for Windows. 
Makes sense.
OK, good, there's a node.js for Windows now (Cygwin doesn't count): 
http://npmjs.org/doc/README.html#Installing-on-Windows-Experimental
A proper installer too, the latest version: http://nodejs.org/dist/v0.6.3/node-v0.6.3.msi
Kaj
27-Nov-2011
[262]
My guess would be that most Linux distros have about five JS interpreters 
preinstalled by now
Gabriele
28-Nov-2011
[263]
Brian... Windows is the odd one around, all the other operating systems 
just require installing a package. But, if windows has a built in 
JS interpreter, and if it is standard (and I don't mean the 1998 
standard at that), then you can run Topaz on it.
BrianH
28-Nov-2011
[264]
It appears to be standard (it's the one in IE, so if you have IE9 
it is as standard as V8). However, it doesn't seem to have one of 
the objects or functions that Topaz's bootstrap depends on. Some 
time I'll try to do a proper port. In the meanwhile, Node just requires 
installing a package on Windows (at least as of the last couple months), 
so any Cygwin-related criticism can be ignored now :)
Gabriele
29-Nov-2011
[265]
missing object: look at the source of try-topaz.html. what you need 
is probably there.
Gabriele
1-Dec-2011
[266]
I don't have string parsing in Topaz yet, but I wanted to illustrate 
how what Endo is asking in the Parse group would be much easier:

Topaz Interpreter - (C) 2011 Gabriele Santilli - MIT License
>> b: ["bla" 1 2 "bla"]
== ["bla" 1 2 "bla"]
>> parse b [collect any [keep number! | skip]]
== [1 2]
Geomol
1-Dec-2011
[267]
Looks simple. Cool!
Pekr
2-Dec-2011
[268]
Cool, I want collect/keep in R3 too :-)
PeterWood
2-Dec-2011
[269]
>> parse b [collect any [keep number! | skip]]
== [1 2]


Very interesting. What would be returned if the parse rule was more 
complicated and "failed" (ie would have returned false in REBOL).
Gabriele
2-Dec-2011
[270x2]
If it fails, it returns none.
PARSE works in a similar way to DO, in that it returns the last "result". 
I will document this in detail before a 1.0 release. There is a slide 
in my september presentation about PARSE vs. INTERPRET which explains 
why I went this route.
PeterWood
2-Dec-2011
[272]
Thanks, Gabriele
BrianH
2-Dec-2011
[273]
Does it return the subject series at the position of the last result, 
or does it return the last recognized pattern as a value?
Gabriele
3-Dec-2011
[274]
Brian, each "rule" has two effect: it advances the series, and returns 
a result. Most rules return the matched value, but not all. Examples:

>> parse [1] [number!]
== 1
>> parse [1 2 3] [number! number! number!]
== 3
>> parse [1 2 3] [some number!]
== 3
>> parse [1 2 3] [object [a: number! b: number! c: number!]]
== object none [
==     a: 1
==     b: 2
==     c: 3
== ]

>> parse [1 2 3] [object [a: number! b: object [c: number! d: number!]]]
== object none [
==     a: 1
==     b: object none [
==         c: 2
==         d: 3
==     ]
== ]
BrianH
3-Dec-2011
[275]
Seems a bit like a cross between a destructuring matcher and regex. 
Useful.
GiuseppeC
15-Dec-2011
[276]
Hi, I am interested into building an maintaining documentation for 
those programming languages based on REBOL.
It would be nice to have a DOCBASE for them.
What I search is:
- Someone ABLE to SETUP the Linux and the Wiki Software
- Someone which would share with me the cost of hosting.
Do you like the idea ?
Write me at [giuseppe-:-chillemi-:-eu]
Gabriele
16-Dec-2011
[277]
Note, the Topaz specific wiki is on github: https://github.com/giesse/Project-SnowBall/wiki
AdrianS
7-Feb-2012
[278x2]
Gabriele, you might want to update the Getting Started page on github 
in relation to using Topaz with Windows. The situation is much improved 
now that there is an official Node installer (also includes npm).
so you don't need to mess around with Cygwin anymore
Gabriele
8-Feb-2012
[280x2]
Thanks, I don't really use Windows so it's hard for me to keep up 
to date on that front. Peter already said he's going to update the 
wiki; if anyone else wants to help, I believe github allows a fork 
approach to the wiki as well, otherwise I can add you to the main 
wiki to edit it directly.
Also, you only really need to install node etc. if you want to work 
*on* Topaz, otherwise you can use any web browser to just *use* Topaz, 
like in the try-topaz.html example.
Henrik
8-Feb-2012
[282x2]
I wonder if it makes sense to allow REBOL to call try-topaz.html, 
although it would be calling JS code? Then you could mix Topaz with 
REBOL for tests, etc.
res: topaz [1 + 2]
Gabriele
8-Feb-2012
[284]
a topaz function for REBOL, you mean?
Henrik
8-Feb-2012
[285]
yes, something like that
Gabriele
8-Feb-2012
[286x2]
once I have the compiler, it would certainly be possible to target 
REBOL instead of JS. not sure if that is useful though. :-)
but, i guess you can use CALL to run node.js, or you can get node.js 
to listen to a tcp port and connect to it from REBOL, etc.
Henrik
8-Feb-2012
[288x2]
I was only thinking about whether it could be used to test topaz 
vs. rebol via one piece of code.
ok
Maxim
8-Feb-2012
[290]
henrik, do you mean something like? :

topaz: func [ block ][

 load read/custom http://server/try-topaz.htmlreduce ['POST  mold 
 block]
]


(where the post data above is replaced by whatever is required to 
properly fill in the form)
Gabriele
8-Feb-2012
[291]
Maxim, certainly not, as there is no server side whatsoever to try-topaz.html
Maxim
8-Feb-2012
[292]
ok, I thought the discussion about using node.js was for this purpose... 
to have server and client side using the same language... sorry for 
the confusion.
Gabriele
8-Feb-2012
[293]
Topaz runs in any JS interpreter; I use node.js because it's convenient. 
try-topaz.html uses the JS interpreter in your browser to run Topaz.
Henrik
8-Feb-2012
[294]
then it may be too much trouble. I was simply curious.
GrahamC
8-Feb-2012
[295x3]
No arithmetic operators in topaz yet?
>> 37 * 11
*** Script error: Word has no value: *
*** Stack: * 11
Not implemented
PeterWood
12-Feb-2012
[298]
I've updated the getting started wiki page at GitHub.

Please let me know if there are any errors in it.
GrahamC
20-Feb-2012
[299]
Last comitt was 3 months ago?
Gabriele
21-Feb-2012
[300]
I'm busy.
Gabriele
22-Feb-2012
[301]
Added a couple commits to make Graham happy. :P
GrahamC
22-Feb-2012
[302]
I need to check the Topaz G+ hangout :)
Gabriele
23-Feb-2012
[303:last]
We need to do that again soon... I'm leaving for LA in about a week, 
then we have BIL2012 there, then I'll see if I can set up a hangout.