Top

Environment

This article describes how to install and run Z1h

Support System

Z1h language supports the following systems:

  • Windows
  • mac OS
  • Linux
  • Android
  • iOS
  • WebAssembly
  • Raspberry PI

Download

The installation package download address: https://z1h.org/download

  • After downloading the installation package of the corresponding platform
  • Unzip the zip, get the executable file and configuration example file
  • Open the terminal (such as Terminal of macOS, cmd of Windows) , And enter the decompression directory
  • Drag the executable file to the terminal, press Enter, you can see the command line help instructions

If the platform is correct, you will see the following output:

Version = vx.x.x_xxxxxx

Usage:
	-run
		the file to be run
	-web
		http listen port
	-conf
		configuration file
	-repl
		run repl mode

Repl Mode

Enter on the command line

z1h -repl

You can enter the repl mode, enter the code will run it.

Sample code below is in order to output Z1h version number, and generates a content in this catalog is Z1h official website link of qr code picture.

>> VERSION
"v1.0.0_xxxxxx"
>> $file.write('z1h.jpg', assert($qrcode('z1h.org')))
null

Execute file

Now created a file in this directory, such as hello.z1h

Open the created file, enter the Z1h code content, such as

words = {};
string(assert($http(
`https://cn.bing.com/search?q=${encodeURI('JJ Lin')}`
)))
.find('[\u4e00-\u9fa5]{2,}')
.filter(e=>{(words[e]++) == 2})

After saving the file, enter the command

z1h -run hello.z1h

You can see the contents from spider

PS: there will be a special follow-up tutorial shows you how to Z1h do a spider job, here only as an example , No understanding required