Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sheepda integration #255

Open
jtolio opened this issue Mar 20, 2017 · 6 comments
Open

Sheepda integration #255

jtolio opened this issue Mar 20, 2017 · 6 comments

Comments

@jtolio
Copy link

jtolio commented Mar 20, 2017

Sheepda is a lambda calculus interpreter written in Go. Because it's in Go, GopherJS can compile it to Javascript.

Try this in your HTML somewhere:

<script src="https://jtolds.github.io/sheepda/sheepdajs.js"></script>
<script>
  var output_type = "result";  // can also be "output" or "parse"
  var code = "(\\x.x \\y.y)";
  var result = sheepda.eval(code, output_type);  // returns [output, error]
  if (result[1] != "") {
    console.log(result[1]);
  } else {
    console.log(result[0]);
  }
</script>

If you want to rebuild https://jtolds.github.io/sheepda/sheepdajs.js from source, install Go and GopherJS and run

go get github.com/jtolds/sheepda/bin/sheepdajs
gopherjs build github.com/jtolds/sheepda/bin/sheepdajs

Lambda calculus is super basic - so much so that it's not useful without a ton of definitions. You might be interested in including some prelude code like https://github.com/jtolds/sheepda/blob/master/interview-probs/prelude.shp that you prepend to any code the user provides. https://jtolds.github.io/sheepda/ gives the user a choice via a checkbox.

@jtolio
Copy link
Author

jtolio commented Mar 20, 2017

Kinda scary to run automatically, since it can be pretty easy to accidentally cause non-terminating behavior, but dunno how Klipse handles that usually.

@workshub
Copy link

workshub bot commented Jun 2, 2020

If you successfully complete this Issue via WorskHub there's a $150 reward available.
Start work via WorksHub Issue Details page.

@workshub
Copy link

workshub bot commented Jan 5, 2022

@shyamasravani started working on this issue via WorksHub.

@S-Somnium
Copy link

I never contributed on github, could u explain what u need? i would like to help

@benjamin-asdf
Copy link

Jo is the bounty still valid? Basic sheepda is working:

<!DOCTYPE html>
<html lang="en-GB">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<script src="https://jtolio.github.io/sheepda/sheepdajs.js"></script>
</head>

<body>
<script>
  var output_type = "result";  // can also be "output" or "parse"
  var code = "(\\x.x \\y.y)";
  var result = sheepda.eval(code, output_type);  // returns [output, error]
  console.log("hello..")
  if (result[1] != "") {
    console.log(result[1]);
  } else {
    console.log(result[0]);
  }
</script>
</body>
</html>

my current idea would be to get inspired by e.g. the kotlin klipse plugin and make an analogous sheepda one.

  • add the prelude (standard lib)
  • add a checkmark for the prelude

@viebel
Copy link
Owner

viebel commented Dec 31, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants