GithubHelp home page GithubHelp logo

kensuke-hinata / wa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wa-lang/wa

1.0 2.0 0.0 2.66 MB

🇨🇳 凹语言™ The Wa Programming Language

Home Page: https://wa-lang.org

License: GNU Affero General Public License v3.0

C 0.51% Go 95.67% Makefile 0.13% JavaScript 2.39% WebAssembly 0.06% C++ 0.25% Dockerfile 0.01% Yacc 0.07% Batchfile 0.01% Shell 0.04% CSS 0.42% HTML 0.08% Witcher Script 0.36%

wa's Introduction

The Wa Programming Language

简体中文 | English

Build Status Go Report Card Coverage Status GitHub release Go Reference license

Wa is a general-purpose programming language designed for developing robustness and maintainability WebAssembly software. Instead of requiring complex toolchains to set up, you can simply go install it - or run it in a browser.

Note: Our canonical Git repository is located at https://gitee.com/wa-lang/wa. There is a mirror of the repository at https://github.com/wa-lang/wa. Unless otherwise noted, the Wa source files are distributed under the AGPL-v3 license found in the LICENSE file.

Playground

https://wa-lang.org/playground

Snake Game

Install and Run:

Go >= 1.17

  1. go install wa-lang.org/wa@latest
  2. wa init -name=_examples/hi
  3. wa run _examples/hi

The Wa project is still in very early stage. If you want to submit PR, please read the Contribution Guide(Chinese). We do not accept PR only about 3rdparty changes.

Example: Print Wa

Print rune and call function:

// Copyright @2019-2022 The Wa author. All rights reserved.

import "fmt"

func main {
	println("hello, Wa!")
	println(add(40, 2))

	fmt.Println(1+1)
}

func add(a: i32, b: i32) => i32 {
	return a+b
}

Execute the program:

$ go run main.go hello.wa 
hello, Wa!
42
2

Example: Print Prime

Print prime numbers up to 30:

func main {
	for n := 2; n <= 30; n = n + 1 {
		var isPrime int = 1
		for i := 2; i*i <= n; i = i + 1 {
			if x := n % i; x == 0 {
				isPrime = 0
			}
		}
		if isPrime != 0 {
			println(n)
		}
	}
}

Execute the program:

$ go run main.go run _examples/prime
2
3
5
7
11
13
17
19
23
29

Example: Print Prime with Chinese syntax

Print prime numbers up to 30:

引于 "书"

【启】:
  // 输出30以内的素数
  从n=2,到n>30,有n++:
    设素=1
    从i=2,到i*i>n,有i++:
      设x=n%i
      若x==0则:
        素=0
      。
    。
    若素!=0则:
      书·曰:n
    。
  。
。

Output is the same as the previous example.

More examples _examples

wa's People

Contributors

chai2010 avatar 3dgen avatar benshi001 avatar yanxingjushi avatar ohxxx avatar codefromthecrypt avatar kensuke-hinata avatar wanglong001 avatar nobodxbodon avatar

Stargazers

Oral liquid avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.