Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second Lua implementation (Lua.2) #630

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile.impls
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ wasm_MODE = wasmtime

IMPLS = ada ada.2 awk bash basic bbc-basic c c.2 chuck clojure coffee common-lisp cpp crystal cs d dart \
elisp elixir elm erlang es6 factor fantom fennel forth fsharp go groovy gnu-smalltalk \
guile haskell haxe hy io janet java java-truffle js jq julia kotlin livescript logo lua make mal \
guile haskell haxe hy io janet java java-truffle js jq julia kotlin livescript logo lua lua.2 make mal \
matlab miniMAL nasm nim objc objpascal ocaml perl perl6 php picolisp pike plpgsql \
plsql powershell prolog ps purs python python.2 r racket rexx rpython ruby ruby.2 rust scala scheme skew sml \
swift swift3 swift4 swift5 tcl ts vala vb vhdl vimscript wasm wren yorick xslt zig
Expand Down Expand Up @@ -149,6 +149,7 @@ kotlin_STEP_TO_PROG = impls/kotlin/$($(1)).jar
livescript_STEP_TO_PROG = impls/livescript/$($(1)).js
logo_STEP_TO_PROG = impls/logo/$($(1)).lg
lua_STEP_TO_PROG = impls/lua/$($(1)).lua
lua.2_STEP_TO_PROG = impls/lua.2/$($(1)).lua
make_STEP_TO_PROG = impls/make/$($(1)).mk
mal_STEP_TO_PROG = impls/mal/$($(1)).mal
matlab_STEP_TO_PROG = impls/matlab/$($(1)).m
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ FAQ](docs/FAQ.md) where I attempt to answer some common questions.
| [LiveScript](#livescript) | [Jos van Bakel](https://github.com/c0deaddict) |
| [Logo](#logo) | [Dov Murik](https://github.com/dubek) |
| [Lua](#lua) | [Joel Martin](https://github.com/kanaka) |
| [Lua #2](#lua-2) | [Hüseyin Er](https://github.com/chemindefer) |
| [GNU Make](#gnu-make-381) | [Joel Martin](https://github.com/kanaka) |
| [mal itself](#mal) | [Joel Martin](https://github.com/kanaka) |
| [MATLAB](#matlab-gnu-octave-and-matlab) (GNU Octave & MATLAB) | [Joel Martin](https://github.com/kanaka) |
Expand Down Expand Up @@ -715,6 +716,22 @@ make # to build and link linenoise.so and rex_pcre.so
./stepX_YYY.lua
```

### Lua.2

The second Lua implementation of mal has been tested with Lua 5.3 and
5.4 this implementation does not include readline functionality. In
order to have it one can use `rlwrap`. This implementation uses manual
tokenizer instead of using regular expressions.

```
cd impls/lua.2
./stepX_YYY.lua
# with readline functionality
rlwrap ./stepX_YYY.lua
# with readline functionality
rlwrap ./stepX_YYY.lua
```

### Mal

Running the mal implementation of mal involves running stepA of one of
Expand Down
1 change: 1 addition & 0 deletions docs/graph/base_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ languages:
- [livescript , LiveScript , ML , Dynamic , []]
- [logo , Logo , OTHER , Dynamic , []]
- [lua , Lua , Algol , Dynamic , []]
- [lua.2 , Lua , Algol , Dynamic , []]
- [make , GNU Make , OTHER , OTHER , []]
- [mal , mal itself , Lisp , Dynamic , []]
- [matlab , MATLAB , Algol , Dynamic , []]
Expand Down
33 changes: 33 additions & 0 deletions impls/lua.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ubuntu:18.04
MAINTAINER Hüseyin Er <[email protected]>

##########################################################
# General requirements for testing or common across many
# implementations
##########################################################

RUN apt-get -y update

# Required for running tests
RUN apt-get -y install make python

# Some typical implementation and test requirements
RUN apt-get -y install curl
RUN mkdir -p /mal
WORKDIR /mal

##########################################################
# Specific implementation requirements
##########################################################
# rlwrap for readline program
RUN apt-get -y install rlwrap
# Lua
RUN apt-get -y install gcc libreadline-dev unzip

RUN \
curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz && \
tar -zxf lua-5.3.5.tar.gz && \
cd lua-5.3.5 && \
make linux test && \
make install

14 changes: 14 additions & 0 deletions impls/lua.2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Second Lua implementation of [mal](https://github.com/kanaka/mal)
Major difference from first Lua implementation is tokenisation is done manually instead of using regular expressions.

# requirements
* Lua 5.3 or greater
* rlwrap (optional) for readline editing [rlwrap](https://github.com/hanslub42/rlwrap)
```sh
# for repl with a readline
rlwrap ./stepA_mal.lua
# for repl
./stepA_mal.lua
# for evaluating script file
./stepA_mal.lua <mal-src-file>
```