With the latest commit the Gambit universal library can be used in the browser… it is as simple as:
% make _gambit.js % gsc/gsc -:= -target js -exe -o webapp.js webapp.scm % open webapp.html
webapp.scm:
(declare (extended-bindings))
(define (document.write html) (##inline-host-statement "document.write(g_scm2host(@1@));" html))
(document.write "<h1>Hello world!</h1>")
webapp.html:
<!doctype html> <html>
<head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>webapp</title> </head>
<body> <script type="text/javascript" src="webapp.js"></script> </body>
</html>