geomol / world Goto Github PK
View Code? Open in Web Editor NEWWorld Programming Language
Home Page: http://world-lang.org
World Programming Language
Home Page: http://world-lang.org
This is an alpha release. For testing only. Use at your own risk. Do not distribute. To run a test ------------- Pick one of the world_* files and rename it to 'world' - then make it executable. (Rename 'world_win32.exe' to 'world.exe' under Windows). Also download "cortex.w", "user.w" and the libs/, mezz/ and test/ directories (or just the whole ZIP). Start world from a terminal. At the world prompt do this: w> . ; run the Hello, World! program w> test ; should return true w> m ; will run a Mandelbrot example If it behaves this way, you are ready to go. Follow: http://www.world-lang.org World at GitHub: https://github.com/Geomol/World Have fun! To get help at the World prompt: w> help Known issues ------------ - The memory handling system can't cope with cyclic references. - Operators don't support literals as their first argument, as functions do, and they don't take refinements.
[btiffin@home World]$ ./world
Loading Cortex... Done
World/Cortex 0 Copyright (c) 2009-2011 John Niclasen, NicomSoft
build: Dec 23 2011 10:09:47
w> system/options/format/real/digits: 32
== 32
w> 1 / 3
== 0.33333333333333331482961625624739
w> system/options/format/real/digits: 48
== 48
w> 1 / 3
*** stack smashing detected ***: ./world terminated
======= Backtrace: =========
...
== 0.333333333333333314829616256247390992939472198486Aborted (core dumped)
Somewhere between 32 and 48, my GNU/Linux world cracks. Don't care about digit support that high, but access to the real/digits field may require some fencing.
CTRL-C crashes World on Windows in some cases
Example:
w> wait 10 ;then press CTRL-C
or
w> p: open udp://:1234 first p ;then press CTRL-C
sqlab: the automatic closing of open brackets may be handy when typing, but it gets in the way copying from the clipboard
== -5:00
w>n: now
== -5:00
w> n/time
== 4:03:45
w> call "set"
...
LANG=en_US.utf8
LANGUAGE=
...
I don't see any other LC_ or locale settings
Currently, starting the world binary with a script as an argument just ignores the script and gets you to the prompt:
$ ./world_linux hello.w
Loading Cortex... Done
World/Cortex 0 Copyright (c) 2009-2011 John Niclasen, NicomSoft
build: Dec 4 2011 09:53:36
w>
It would be nice if a world script could be executed directly that way.
Implicit compilation of blocks (via do
) works fine:
w> x: 42
== 42
w> c1: [x]
== [x]
w> do c1
== 42
Explicit compilation, however, does not:
w> c2: [x]
== [x]
w> compile c2
== [x]
w> compiled? c2
== true
w> do c2
== [x] ;; expected: 42
[btiffin@hcn09 World]$ ./world
Loading Cortex... Done
World/Cortex 0 Copyright (c) 2009-2012 John Niclasen, NicomSoft
build: Jan 12 2012 12:13:51
w> load/all %world
== [#{7F454C46010101}]
w> q
[btiffin@hcn09 World]$ hexdump world | head
0000000 457f 464c 0101 0001 0000 0000 0000 0000
0000010 0002 0003 0001 0000 a68c 0804 0034 0000
Latest git pull, 2011-12-22 try.w is missing from test/functions/control
w> help system system is a context! of value: ** Script error: attempt to compile a value of type string! ** Near: length? series
Currently pressing ctrl-d inputs the EOT character (u+0004). It would be nice if ctrl-d just exits the interpreter instead (as if calling q
).
w> outer: func [x] [func [] [x]]
w> inner: outer 42
w> inner
**** ci < ci_base ****
w>
For scripts to be invoked from the command-line, a method to access command-line parameters is required (such as wrapping argv
(where available) as a block!
in system/options/args
).
Geomol, Can you add "words" to list out the dictionary? I know REBOL uses "what" but being a Forther, words makes far more sense and I never got with the what. Having said that, what would suffice if you are going for compatibility.
$ ./world_linux -q hello.w
Loading Cortex... Done
hello, world!
In quiet mode, the "Loading Cortex... Done" output should be suppressed.
I guess that would require exposing the information that World was started in quiet mode somewhere. REBOL's system/options/quiet
would be one possibility. (A script-local argument passed from the interpreter to cortex, another.)
Currently, World prints the whole gamut of startup banners even when executing a script:
$ ./world_linux hello.w
Loading Cortex... Done
World/Cortex 0 Copyright (c) 2009-2011 John Niclasen, NicomSoft
build: Dec 22 2011 09:52:46
hello, world!
$
For executing scripts, this excessive verbosity is rarely useful. Instead, executing a script should default to quiet mode (i.e. as if -q
was passed to the World interpreter).
In rebol:
>> use [x][x: 5 y: func [r][r + x]]
>> y 6
== 11
In World:
Loading Cortex... Done
World/Cortex 0 (c) John Niclasen, NicomSoft
build: Apr 3 2015 19:29:22
w> do %rebol.w
Loading REBOL Extension... Done
w> use [x][x: 5 y: func [r][r + x]]
w> y 5
** Script error: y has no value
** Near: y 5
The Red programming language(https://github.com/red/red) alse inspired by Rebol with native-code compiler,can derectly generates EXE
w> help 'abc ** Script error: abc has no value ** Near: path! <> type? :word w> a: 'abc == abc w> help a a is a word! of value: abc w>
Loading Cortex... Done
World/Cortex 0 Copyright (c) 2009-2011 John Niclasen, NicomSoft
build: Dec 11 2011 21:28:07
git pull on Dec 13, 22:00 Ottawa time.
Missing the second colon borks.
w> lp: open tcp://8080
Segmentation fault (core dumped)
[btiffin@home World]$ ./world
Loading Cortex... Done
World/Cortex 0 Copyright (c) 2009-2011 John Niclasen, NicomSoft
build: Dec 11 2011 21:28:07
w> lp: open tcp://:8080
w> call "uname -a"
Linux home 2.6.35.14-106.fc14.x86_64 #1 SMP Wed Nov 23 13:07:52 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
== 0
w>
Let's start with a simple code block:
w> x: 99
== 99
w> c: [x]
== [x]
w> do c
== 99 ;; Fine
w> compiled? c
== true
If we now change the block's content, the compiled flag is not reset:
w> append c [* 2]
== [x * 2]
w> c
== [x * 2]
w> compiled? c
== true
Now it could be that it's just marked as "dirty" and recompiled the next time it's evaluated. But no, evaluating the block again returns an unexpected result:
w> do c
== 99 ;; expected: 198
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.