bounties icon indicating copy to clipboard operation
bounties copied to clipboard

JavaScript (or Monte) Compiler for RChain

Open TrenchFloat opened this issue 7 years ago • 10 comments

A compiler from monte to rholang could ease the transition from the community of programmers familiar with python and the like.

filed on behaof of @dckc

TrenchFloat avatar Feb 26 '18 13:02 TrenchFloat

a tiny bit of progress: https://gist.github.com/dckc/fb6c0a49361e8502b0be418ec71b44c1

dckc avatar Feb 26 '18 23:02 dckc

I am not really familiar with the Monte language(actually first time touch). I just check it here. So I can understand it like something which compile the Python to Rholang, right?

zsluedem avatar Feb 27 '18 01:02 zsluedem

Yes, that's the idea.

dckc avatar Feb 27 '18 03:02 dckc

That's a nice idea. As far as I have known, there are always some limits about that kind of compiler.But still it is a good touch for understanding Rholang for Python developers. I can help with some test once you are done.

zsluedem avatar Feb 27 '18 05:02 zsluedem

I got it working in one case:

"feed"; "water"; "grow"

compiles to

new return in {
  new step2Ch in {
    new step1Ch in {
      step1Ch!("feed") | for(step1 <- step1Ch) {
	step2Ch!("water")
      }
    } | for(step2 <- step2Ch) {
      return!("grow")
    }
  }
}

https://gist.github.com/dckc/fb6c0a49361e8502b0be418ec71b44c1

dckc avatar Feb 27 '18 23:02 dckc

I just (re-)discoverd section 3. INTERPRETING CAPABILITIES of Policy as Types has an example of translating javascript to a rho-calculus language. So this idea is not unprecedented. :)

I made some notes on the bibliography section of Mobile process calculi for programming the new blockchain.

Propositions as sessions by Wadler confirmed my understanding of C-H for pi calculus too. This linear logic stuff may take a little getting used to, but I'm starting to grok.

dckc avatar Mar 28 '18 02:03 dckc

or perhaps TinySES https://github.com/Agoric/TinySES

dckc avatar Jun 18 '18 19:06 dckc

Some progress Jun 21: https://github.com/dckc/tinyses2rho 0e24be8

dckc avatar Jun 25 '18 17:06 dckc

Mike Stay chatted about continuations in other languages such as JavaScript.

How would garbage collection work? How would the collector see what the closure closes over?

dckc avatar Sep 15 '18 17:09 dckc

I just re-discovered shell-monad which reminded me that sunroof might be a good approach to rholang-to-js.

dckc avatar Dec 13 '18 20:12 dckc