<commit_before>[![Build Status](https://travis-ci.org/fengari-lua/fengari.svg?branch=master)](https://travis-ci.org/fengari-lua/fengari)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![#fengari on Freenode](https://img.shields.io/Freenode/%23fengari.png)](https://webchat.freenode.net/?channels=fengari)

<p align="center">
    <img src="https://github.com/fengari-lua/fengari/raw/master/logo.png" alt="Fengari" width="304" height="304">
</p>


# fengari

🐺 φεγγάρι - The Lua VM written in JS ES6 for Node and the browser

## So far

- [x] Lexing/Parsing
- [x] Parse bytecode
- [x] Opcodes
- [x] Basic types representation:
- [x] Tag Methods
- [ ] Standard library
    - [x] Base lib
    - [x] Coroutine
    - [x] Debug
    - [x] Math
    - [x] String
    - [x] Table
    - [x] utf8
    - [x] os (~~`os.setlocale()`~~)
    - [x] Package
    - [ ] io
        - [x] `file:__tostring()`
        - [x] `file:flush()`
        - [x] `file:write()`
        - [x] `io.close()`
        - [x] `io.stderr`
        - [x] `io.stdin`
        - [x] `io.stdout`
        - [x] `io.type()`
        - [x] `io.write()`
        - [x] `io.flush()`
        - [ ] `io.input()`: partially implemented
        - [ ] `io.lines()`
        - [ ] `io.open()`
        - [ ] `io.output()`: partially implemented
        - [ ] `io.popen()`
        - [ ] `io.read()`
        - [ ] `io.tmpfile()`
        - [ ] `file:lines()`
        - [ ] `file:read()`
        - [ ] `file:setvbuf()`
        - [ ] `file:__gc()`
- [x] C API
- [x] Auxiliary library
- [ ] Run [Lua test suite](https://github.com/lua/tests)
    - [x] `attrib.lua`
    - [x] `bitwise.lua` (16/16)
    - [x] `calls.lua` (32/32)
    - [x] `closure.lua` (16/16)
    - [x] `constructs.lua` (`_soft`) (10/10)
    - [x] `errors.lua` (64/64)
    - [x] `events.lua` (26/26)
    - [x] `goto.lua` (18/18)
    - [x] `literals.lua` (30/30)
    - [x] `locals.lua` (10/10)
    - [x] `nextvar.lua` (44/44)
    - [x] `strings.lua` (34/34)
    - [x] `vararg.lua` (8/8)
    - [ ] `coroutine.lua` (32/40)
    - [ ] `math.lua` (44/68)
    - [ ] `pm.lua` (27/38)
    - [ ] `sort.lua` (21/24)
    - [ ] `tpack.lua` (20/32)
    - [ ] `utf8.lua` (14/20)
    - [ ] `api.lua`
    - [ ] `big.lua`
    - [ ] `code.lua`
    - [ ] `db.lua`
    - [ ] `verybig.lua`
- [ ] DOM API binding: [https://github.com/fengari-lua/fengari-interop](https://github.com/fengari-lua/fengari-interop)


## Extensions

### `dv = lua_todataview(L, idx)`

Equivalent to `lua_tolstring` but returns a [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instead of a string.


### `str = lua_toljsstring(L, idx)`
<commit_msg>attrib.js is still in progress<commit_after>[![Build Status](https://travis-ci.org/fengari-lua/fengari.svg?branch=master)](https://travis-ci.org/fengari-lua/fengari)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![#fengari on Freenode](https://img.shields.io/Freenode/%23fengari.png)](https://webchat.freenode.net/?channels=fengari)

<p align="center">
    <img src="https://github.com/fengari-lua/fengari/raw/master/logo.png" alt="Fengari" width="304" height="304">
</p>


# fengari

🐺 φεγγάρι - The Lua VM written in JS ES6 for Node and the browser

## So far

- [x] Lexing/Parsing
- [x] Parse bytecode
- [x] Opcodes
- [x] Basic types representation:
- [x] Tag Methods
- [ ] Standard library
    - [x] Base lib
    - [x] Coroutine
    - [x] Debug
    - [x] Math
    - [x] String
    - [x] Table
    - [x] utf8
    - [x] os (~~`os.setlocale()`~~)
    - [x] Package
    - [ ] io
        - [x] `file:__tostring()`
        - [x] `file:flush()`
        - [x] `file:write()`
        - [x] `io.close()`
        - [x] `io.stderr`
        - [x] `io.stdin`
        - [x] `io.stdout`
        - [x] `io.type()`
        - [x] `io.write()`
        - [x] `io.flush()`
        - [ ] `io.input()`: partially implemented
        - [ ] `io.lines()`
        - [ ] `io.open()`
        - [ ] `io.output()`: partially implemented
        - [ ] `io.popen()`
        - [ ] `io.read()`
        - [ ] `io.tmpfile()`
        - [ ] `file:lines()`
        - [ ] `file:read()`
        - [ ] `file:setvbuf()`
        - [ ] `file:__gc()`
- [x] C API
- [x] Auxiliary library
- [ ] Run [Lua test suite](https://github.com/lua/tests)
    - [x] `bitwise.lua` (16/16)
    - [x] `calls.lua` (32/32)
    - [x] `closure.lua` (16/16)
    - [x] `constructs.lua` (`_soft`) (10/10)
    - [x] `errors.lua` (64/64)
    - [x] `events.lua` (26/26)
    - [x] `goto.lua` (18/18)
    - [x] `literals.lua` (30/30)
    - [x] `locals.lua` (10/10)
    - [x] `nextvar.lua` (44/44)
    - [x] `strings.lua` (34/34)
    - [x] `vararg.lua` (8/8)
    - [ ] `attrib.lua`
    - [ ] `coroutine.lua` (32/40)
    - [ ] `math.lua` (44/68)
    - [ ] `pm.lua` (27/38)
    - [ ] `sort.lua` (21/24)
    - [ ] `tpack.lua` (20/32)
    - [ ] `utf8.lua` (14/20)
    - [ ] `api.lua`
    - [ ] `big.lua`
    - [ ] `code.lua`
    - [ ] `db.lua`
    - [ ] `verybig.lua`
- [ ] DOM API binding: [https://github.com/fengari-lua/fengari-interop](https://github.com/fengari-lua/fengari-interop)


## Extensions

### `dv = lua_todataview(L, idx)`

Equivalent to `lua_tolstring` but returns a [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instead of a string.


### `str = lua_toljsstring(L, idx)`

{'fraction_non_alphanumeric': 0.23280132085855806, 'fraction_numerical': 0.02971931755641167, 'mean_word_length': 2.212728344136712, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 22, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4054546', 'n_tokens_mistral': 2439, 'n_tokens_neox': 2290, 'n_words': 387}