Giter VIP home page Giter VIP logo

hematita's Introduction

Hi. ๐Ÿ‘‹

hematita's People

Contributors

danii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hematita's Issues

Track Token Locations

Token's locations within the source are not currently tracked, meaning error information is scarce, and diagnosing syntax problems becomes tedious.

Error on lua_tuple![].arc()

my code:

fn run(&self, code : &mut Peekable<impl Iterator<Item = char>>) -> Result<Arc<vm::value::Table>> {
    let lexer = ast::lexer::Lexer{ source : code.peekable()};
    let parsed = ast::parser::parse_block(
        &mut ast::parser::TokenIterator(lexer.peekable())
    )?;
    let compiled = compiler::compile_block(&parsed);
    let result = self.vm.execute(&compiled.into(), lua_tuple![].arc()).map_err(into_err)?;
    Ok(result)
}

error occurs on lua_tuple![]
error message:

unresolved import hashbrown
use of undeclared crate or module hashbrownrustcClick for full compiler diagnostic
value.rs(124, 8): Actual error occurred here

if i do cargo add hashbrown the error changes to this:

mismatched types
struct hashbrown::HashMap and struct hashbrown::map::HashMap have similar names, but are actually distinct types
perhaps two different versions of crate hashbrown are being used?rustcClick for full compiler diagnostic
value.rs(133, 28): Actual error occurred here
value.rs(133, 17): arguments to this function are incorrect
map.rs(188, 1): struct hashbrown::HashMap is defined in crate hashbrown
map.rs(192, 1): struct hashbrown::map::HashMap is defined in crate hashbrown
mutex.rs(219, 18): associated function defined here

my dependecies are:

[dependencies]
hematita = "0.1.0"
string-error = "0.1.0"

Modulo operator not implemented?

Modulo operator as simple as that:

print(5 % 2)

Gives out this error:

$ hematita_cli a.lua
runtime error: unknown binary operation error

Probably modulo operator is not properly implemented?

Syntax error: unexpected ',' when inside multiline string '[['

Hi,

First of all thanks for this project. I would like to have more time and knowledge to help on hematita. :)

So, let's talk about bugs...the code below does not run on hematita_cli, but on luajit works fine.

Error

$ hematita_cli print_html.lua 
syntax error: unexpected ','

Code

-- print_html.lua
local html = [[
    <html>
        <head>
            <style>
            table, th, td {
            border: 1px solid black;
            border-collapse: collapse;
            }
            </style>
        </head>
        <body>
        ]]
        local html_footer = [[
        </body>
    </html>
    ]]

print(html)

Garbage Collection

From what I've seen, the project currently handles memory with Arcs, which will leak on cyclic references. Are there plans to use a real garbage collector?

No support for double/float numeric values?

In Lua, all numbers are assumed to be doubles, not integers.

Using double numeric values causes the parser to crash.

local PI = 3.14

panics on let parsed = parser::parse_block(&mut parser::TokenIterator(lexer)).unwrap(); while

local meaning_of_life=42

works perfectly fine.

pairs Funciton Is Impossible With HashMaps

The pairs Lua function cannot be implemented because it is deterministic without state. It seems as if the reference implementation PUC Lua actually uses b-trees rather than hash maps to store tables.

CLI doesn't install

Hmm. Tried installing the CLI based on the README and it failed:

$ cargo install hematita_cli
    Updating crates.io index
error: could not find `hematita_cli` in registry `crates-io` with version `*`

I've tried on Ubuntu 21.10 and Windows 7 (yes, it's old on purpose :D)

Errors with `hashbrown`

The example in the README will fail due to the lua_tuple! macro needing the hasbrown crate. What's a bit unfortunate is that hasbrown 0.12 has restructured things a bit.

Without hasbrown at all, you'll receive

use of undeclared crate or module `hashbrown`

And with 0.12 you'll receive

expected struct `hashbrown::map::HashMap`, found struct `hashbrown::HashMap`

After setting the version in my projects Cargo.toml to 0.11.2 things started working.

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.