Code Monkey home page Code Monkey logo

Comments (4)

KCreate avatar KCreate commented on July 3, 2024 3

Hey, that looks really nice, something like that was exactly what I had in mind.
I'm currently devoting most of my development to a new c++ virtual machine for the Charly programming language and will mostly likely deprecate the Crystal version once the VM is finished.

If you're interested in that, please take a look at the new project: KCreate/charly-vm

from charly.

KCreate avatar KCreate commented on July 3, 2024

Should be possible, but I'm not sure how it should behave. Charly loads a prelude file on startup, so it would need to be run every time to make sure you always run off a blank slate.

Another option would be to instantiate a dedicated Charly object that would handle these things.

What I mean:

require "charly"

vm = Charly.new

vm.run "2 + 2" # => 4

code = <<-CODE
print("hello world")
CODE

vm.run code # => hello world

Something similar to this is also included inside Issue #154.

Thanks for the suggestion!

from charly.

faustinoaq avatar faustinoaq commented on July 3, 2024

Hi, nice shard here: https://github.com/veelenga/lua.cr

It works very similar to you comment sample:

lua = Lua.load
sum = lua.run %q{
  function sum(x, y)
    return x + y
  end

  return sum
}
p sum.as(Lua::Function).call(3.2, 1) # => 4.2
lua.close

from charly.

faustinoaq avatar faustinoaq commented on July 3, 2024

Oh, @KCreate really nice! Thank you for sharing! 🎉

from charly.

Related Issues (20)

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.