{"library":"psharp-js","title":"P#-JS","description":"An implementation of the P# programming language in JavaScript, including a transpiler from P# to JavaScript. Currently at version 0.1.0, this package provides tools to translate P# code (a probabilistic programming language) into executable JavaScript. As an early-stage release, it has limited documentation and may contain bugs. Key differentiators: it enables running P# programs in Node.js or browser environments, leveraging JavaScript's ecosystem. However, it is experimental and not suitable for production use.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install psharp-js"],"cli":null},"imports":["import { transpile } from 'psharp-js'","import { run } from 'psharp-js'","import { VERSION } from 'psharp-js'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { transpile, run } from 'psharp-js';\n\n// Example P# code\nconst psharpCode = `\ndef main() {\n  x = sample Bernoulli(0.5);\n  return x;\n}\n`;\n\n// Transpile to JavaScript\nconst jsCode = transpile(psharpCode);\nconsole.log('Transpiled code:', jsCode);\n\n// Run the transpiled code (requires a random number generator environment)\nconst result = run(jsCode);\nconsole.log('Result:', result);\n","lang":"typescript","description":"Transpile a simple P# program with a Bernoulli sample and execute the resulting JavaScript code.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}