Comments (4)
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.
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.
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.
Oh, @KCreate really nice! Thank you for sharing! 🎉
from charly.
Related Issues (20)
- Refactor Parser & Lexer configuration
- Dump dot-language AST graph
- Refactor CLI Interface HOT 4
- Anonymous methods are saved to the local scope
- Improve Object.keys()
- Wrong formatting on index out of bounds exception.
- Remove references from the language
- Share trace entries across included files.
- Fix invalid method name checks
- Escape sequence for backslash in Strings
- Remove Object.instanceof
- Make Object.typeof an operator
- Refactor the way the prelude is loaded. HOT 1
- Remove operator overloading from the language HOT 1
- Change repo topic from "crystal-lang" to "crystal" HOT 1
- Binary, Octal, Hex literals
- Bitwise operators HOT 4
- AND assignment for bitwise operators HOT 2
- A VM for crystal HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from charly.