• Stars
    star
    3,954
  • Rank 11,047 (Top 0.3 %)
  • Language
    Java
  • Created over 13 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A high performance scripting language hosted on the JVM.

AviatorScript

Build Status Maven Central

📖 English Documentation | 📖 中文文档


AviatorScript 是一门高性能、轻量级寄宿于 JVM (包括 Android 平台)之上的脚本语言。

特性介绍

  1. 支持数字、字符串、正则表达式、布尔值、正则表达式等基本类型,完整支持所有 Java 运算符及优先级等。
  2. 函数是一等公民,支持闭包和函数式编程
  3. 内置 bigint/decimal 类型用于大整数和高精度运算,支持运算符重载得以让这些类型使用普通的算术运算符 +-*/ 参与运算。
  4. 完整的脚本语法支持,包括多行数据、条件语句、循环语句、词法作用域和异常处理等。
  5. 函数式编程结合 Sequence 抽象,便捷处理任何集合。
  6. 轻量化的模块系统
  7. 多种方式,方便地调用 Java 方法,完整支持 Java 脚本 API(方便从 Java 调用脚本)。
  8. 丰富的定制选项,可作为安全的语言沙箱和全功能语言使用。
  9. 轻量化,高性能,ASM 模式下通过直接将脚本翻译成 JVM 字节码,解释模式可运行于 Android 等非标 Java 平台。

使用场景包括:

  1. 规则判断及规则引擎
  2. 公式计算
  3. 动态脚本控制
  4. 集合数据 ELT 等 ……

推荐使用版本 5.2.6 及以上

News

  • 5.3.3,修复潜在内存泄露、变量捕获错误等 Bug。
  • 5.3.2,一些 Bug 修复,推荐升级。
  • 5.3.1,逻辑运算符支持别名和 bug 修复等。

Dependency

<dependency>
  <groupId>com.googlecode.aviator</groupId>
  <artifactId>aviator</artifactId>
  <version>{version}</version>
</dependency>

可以在 search.maven.org 查看可用的版本。

快速开始

  1. 下载 aviator shell 到某个目录(最好是在系统的 PATH 环境变量内),比如 ~/bin/aviator:
$ wget https://raw.githubusercontent.com/killme2008/aviator/master/bin/aviator
$ chmod u+x aviator
  1. 执行 aviator 命令,将自动下载最新文档版本 aviator jar 到 ~/.aviatorscript 下的安装目录并运行:
$ aviator
Downloading AviatorScript now...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   153  100   153    0     0    111      0  0:00:01  0:00:01 --:--:--   111
100 1373k  100 1373k    0     0   689k      0  0:00:01  0:00:01 --:--:--  689k
Usage: java com.googlecode.aviator.Main [file] [args]
     : java com.googlecode.aviator.Main -e [script]
     : java com.googlecode.aviator.Main -v
  1. 将下面这个脚本保存为文件 hello.av:
p("Hello, AviatorScript!");

let a = tuple(1, 2, 3, 4, 5);

p("sum of a is: " + reduce(a, +, 0));

let date = new java.util.Date();
p("The year is: "+ getYear(date));
p("The month is: #{getMonth(date)}");

一个更复杂的计算器例子(求值算术表达式字符串)参见calculator.av

  1. 执行脚本:
$ aviator hello.av
Hello, AviatorScript!
sum of a is: 15
The year is: 120
The month is: 3

更详细的请阅读用户指南

Links

More Repositories

1

Metamorphosis

A high available,high performance distributed messaging system.
Java
1,334
star
2

xmemcached

High performance, easy to use multithreaded memcached client in java.
Java
743
star
3

defun

A macro to define clojure functions with parameter pattern matching just like erlang or elixir.
Clojure
462
star
4

node-zk-browser

A zookeeper web administrator in node.js
JavaScript
336
star
5

gecko

A RPC framework in taobao based on java NIO.
Java
156
star
6

clojure-control

Fabric in clojure
Clojure
136
star
7

ip-service

A demo project for QCon meetup
Clojure
57
star
8

hs4j

HandlerSocket client for java
Java
55
star
9

storm-monitor

A monitor for storm
Clojure
46
star
10

clj.qiniu

Clojure SDK for qiniu. Clojure 七牛云存储 SDK。
Clojure
38
star
11

clj.qrgen

QRCode generator for clojure.
Clojure
34
star
12

erlwsh

Erlang web shell--program erlang on web
Erlang
32
star
13

node-shorten

A url shorten web site in node.js
CSS
28
star
14

clj-xmemcached

Memcached client for clojure.
Clojure
25
star
15

stm-profiler

A profiler for clojure STM
Java
23
star
16

clj-rate-limiter

Rate limiter for clojure that supports a rolling window, either in-memory or backed by redis
Clojure
22
star
17

UniqTask

A task manager for android,just like ES task manager
Java
22
star
18

ring.velocity

Render apache velocity template for ring in clojure.
Clojure
21
star
19

cscheme

Scheme interpreter in clojure
Clojure
16
star
20

cloudcode-test

Cloud code test for avoscloud
JavaScript
15
star
21

carmine-sentinel

A Clojure library designed to connect redis by sentinel, make carmine to support sentinel.
Clojure
14
star
22

clj.monitor

Monitoring applications in clojure based on clojure-control.
Clojure
14
star
23

ik-analyzer

An ik-analyzer github fork,ik-analyzer is a chinese tokenizer used in lucene/solr.
11
star
24

jevent

libevent for java
Java
10
star
25

alfred-workflow

my workflow for alfred
10
star
26

ewok

A high available BTM transaction logs journal using bookkeeper.
Java
9
star
27

clojure-notes

clojure 源码解读
Java
9
star
28

metamorphosis-example

metamorphosis examples
Java
8
star
29

secure-rand

A Clojure library designed to generate secure random float,int,bytes and strings based on java.security.SecureRandom
Clojure
7
star
30

lighthouse

leader election and node register/discover/balance in a service cluster by zookeeper in clojure
Clojure
7
star
31

gen-node-module

the script to generate a node.js module skeleton
JavaScript
6
star
32

UniqRecorder

Android手机的万能记录器,习作
Java
6
star
33

clj.where

A clojure library to query maps in sequence.
Clojure
4
star
34

killme2008.github.com

my github page
JavaScript
4
star
35

prowl

A clojure macro and ruby script to profile clojure program.
Ruby
4
star
36

storm-metamorphosis-spout

A storm spout for metamorphosis
Java
4
star
37

ring-session-memcached

Ring sessions stored in memcached
Clojure
3
star
38

EL-benchmark

EL benchmark for aviator
Java
3
star
39

whetherweather

Weather report and alert for android
Java
3
star
40

fnil.net

My personal web site.
HTML
2
star
41

clojure-overview

首次cn-clojure聚会上介绍的《clojure概览》附带源码
Clojure
2
star
42

coding-practice

Some personal coding pratice
C
2
star
43

erlib

Erlang example code
Erlang
1
star
44

storerl

a simple key-value disk store for erlang
Erlang
1
star
45

ring-jetty-hystrix-adapter

Setup a Hystrix (https://github.com/Netflix/Hystrix) event stream with jetty for clojure.
Clojure
1
star
46

pci4clojure

Programming collective intelligence with clojure
Clojure
1
star
47

learn-node-js

my node.js example code
JavaScript
1
star
48

blog.fnil.net

My Blog Posts
JavaScript
1
star
49

corfu

Paxos in elixir, test project
Elixir
1
star
50

node-properties

A node.js module to read properties config file.
JavaScript
1
star
51

Docker-NodeJS-Ubuntu

Build a docker image that runs node.js application in ubuntu.
Shell
1
star
52

Elixir-OTP-In-Action

《OTP in action》 source code rewrite into elixir.
Elixir
1
star
53

LeanCloud-REST-API-Demo

各种语言调用 LeanCloud REST API 源码示例。
1
star
54

programming-elixir-exercises

My《Programming Elixir》 exercises
Elixir
1
star