Code Monkey home page Code Monkey logo

univ-backend's Introduction

univ-backend

Experiments with the Gambit universal backend

Gambit's universal backend can compile the Gambit interpreter with much of the same functionnality. Here we have done it for JavaScript (gsi-js) and Python (gsi-py). They can be invoked like this :

% node gsi-js <normal-command-line-arguments>
% python2 gsi-py <normal-command-line-arguments>
% python3 gsi-py <normal-command-line-arguments>

Here is a demo:

% node gsi-js -v
v4.9.3 20200101213000 unknown-system-type "./configure"
% node gsi-js . fib
(time (fib 30))
    2.131000 secs real time
    2.131000 secs cpu time (2.131000 user, 0.000000 system)
    no collections
    no bytes allocated
    no minor faults
    no major faults
832040
% ls
README.md	fib.scm		gsi-js		gsi-py
% node gsi-js
Gambit v4.9.3

> (apropos 'shell)
"##" namespace:
  get-shell-program, os-shell-command, shell-args-numbered, shell-command,
  shell-command-blocking, shell-install-dirs, shell-var-binding,
  shell-var-bindings
empty namespace:
  shell-command, user-info-shell
> (##os-shell-command "ls")
README.md
fib.scm
gsi-js
gsi-py
0
> (file-info "fib.scm")
#<file-info #2
   type: regular
   device: 16777221
   inode: 11159611
   mode: 33188
   number-of-links: 1
   owner: 501
   group: 20
   size: 100
   last-access-time: #<time #3>
   last-modification-time: #<time #4>
   last-change-time: #<time #5>
   attributes: 0
   creation-time: #<time #6>>
> (expt 2 1000)
10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376
> (define (date) (host-expression "g_host2scm(new Date().toString())"))
> (date)
"Fri Mar 20 2020 17:06:45 GMT-0400 (GMT-04:00)"
> (define (Array n) (host-expression "g_host2scm(Array(g_scm2host(@1@)))" n))
> (Array 5)
#(#!void #!void #!void #!void #!void)
> ,q

univ-backend's People

Contributors

feeley avatar

Stargazers

Tom Elam avatar  avatar mathieu2em avatar David Wilson avatar

Watchers

David Wilson avatar  avatar James Cloos avatar

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.