GithubHelp home page GithubHelp logo

jua's Introduction

Jua

Java lua

Introduction

Jua is a simplified Lua (5.3) implementation written in Java.

The purpose of building this project is to learn:

  • Data Structure
  • Register-based Virtual Machine & Instruction Set Design
  • Compilers
  • Lua & Standard Libraries

Features

  • Virtual Machine: (Instruction Set & Runner)
  • Compiler: Lexer, AST Parser & Code Generator
  • Standard Libraries
  • Metaprogramming

To-Do List

Standard Libraries

Lua 5.3 Reference Manual

Basic

No. Function Synopsis
0 print print (···)
1 assert assert (v [, message])
2 error error (message [, level])
3 select select (index, ···)
4 ipairs ipairs (t)
5 pairs pairs (t)
6 next next (table [, index])
7 load load (chunk [, chunkname [, mode [, env]]])
8 loadfile loadfile ([filename [, mode [, env]]])
9 dofile dofile ([filename])
10 pcall pcall (f [, arg1, ···])
11 xpcall xpcall (f, msgh [, arg1, ···])
12 getmetatable getmetatable (object)
13 setmetatable setmetatable (table, metatable)
14 rawequal rawequal (v1, v2)
15 rawlen rawlen (v)
16 rawget rawget (table, index)
17 rawset rawset (table, index, value)
18 type type (v)
19 tostring tostring (v)
20 tonumber tonumber (e [, base])

Math

No. Function Synopsis
0 random math.random ([m [, n]])
1 randomseed math.randomseed (x)
2 max math.max (x, ···)
3 min math.min (x, ···)
4 exp math.exp (x)
5 log math.log (x [, base])
6 deg math.deg (x)
7 rad math.rad (x)
8 sin math.sin (x)
9 cos math.cos (x)
10 tan math.tan (x)
11 asin math.asin (x)
12 acos math.acos (x)
13 atan math.atan (y [, x])
14 ceil math.ceil (x)
15 floor math.floor (x)
16 abs math.abs (x)
17 sqrt math.sqrt (x)
18 fmod math.abs (x)
19 modf math.modf (x)
20 ult math.ult (m, n)
21 tointeger math.tointeger (x)
22 type math.type (x)
23 pi The value of π.
24 huge A value larger than any other numeric value.
25 maxinteger An integer with the maximum value for an integer.
26 mininteger An integer with the minimum value for an integer.

String

No. Function Synopsis
0 len string.len (s)
1 rep string.rep (s, n [, sep])
2 lower string.lower (s)
3 upper string.upper (s)

...

Modules

No. Function Synopsis
0 require require (modname)
1 searchers package.searchers
2 searchpath package.searchpath (name, path [, sep [, rep]])

...

Example

Dependencies

  • JDK 1.8+
  • Maven 3+

Build Project

mvn clean package

Write and Run Script

sum.lua

function sum()
    local s = 0
    for i = 1, 100 do
        if i % 2 == 0 then
            s = s + math.sqrt(i)
        end
    end
    return s
end
print(sum())
$ java -jar jua-5.3.5-alpha.jar sum.lua

             ,---._
           .-- -.' \
           |    |   :
           |    |   |         ,--,
           |    |   |       ,'_ /|
           |    |   |  .--. |  | :    ,--.--.
           |    |   |,'_ /| :  . |   /       \
           |    |   ||  ' | |  . .  .--.  .-. |
       ___ |    |   ||  | ' |  | |   \__\/| . .
     /    /\    |   ||  | : ;  ; |   ," .--.; |
    /  ../  `..-    ,|  |  `--'   \ /  /  ,.  |
    \    \         ; :  ,      .-./;  :  |..'  \
     \    \      ,'   `--`----'    |  ,     .-./
      "---....--'                   `--`---'
    :: jua ::                      (5.3.5-alpha)

338.048

Links

License

See LICENSE file.

jua's People

Contributors

kyle-ip avatar

Stargazers

 avatar  avatar  avatar CHOI avatar

Watchers

 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.