Code Monkey home page Code Monkey logo

whalesong's Introduction

whalesong

Whalesong: Racket to JavaScript compiler

Danny here: unfortunately, I am unable to do much development on Whalesong these days, so my source tree has bit-rotted and not followed changes to recent changes to Racket. My apologies!

You may find better results with the fork at: https://github.com/soegaard/whalesong.

whalesong's People

Contributors

bookshelfdave avatar dyoo avatar jpolitz avatar m4burns avatar rhcarvalho avatar samth avatar soegaard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whalesong's Issues

raco setup issues: file permissions failures

I got two error messages when doing raco setup (following the instructions at http://hashcollision.org/whalesong/ ). I don't know what's up with the first one. The second one is a permission error, because I didn't run it as root, but the instructions seem to imply that the launcher will be created in the current directory, rather than /usr/bin.

$ raco setup -P dyoo whalesong.plt 1 0
raco setup: version: 5.1.3 [3m]
raco setup: variants: 3m
raco setup: main collects: /usr/share/racket/collects
raco setup: collects paths:
raco setup: /home/dougo/.racket/5.1.3/collects
raco setup: /usr/share/racket/collects
raco setup: --- pre-installing collections ---
raco setup: --- compiling collections ---
raco setup: making: racket
raco setup: --- parallel build using 2 processes ---
raco setup: making: /home/dougo/whalesong (Whalesong)
raco setup: in /home/dougo/whalesong/
user break
user break
raco setup: in /home/dougo/whalesong/lang/
raco setup: in /home/dougo/whalesong/image/
raco setup: in /home/dougo/whalesong/lang/private/
raco setup: in /home/dougo/whalesong/lang/unsafe/
raco setup: in /home/dougo/whalesong/lang/js/
raco setup: in /home/dougo/whalesong/image/private/
raco setup: in /home/dougo/whalesong/resource/
raco setup: in /home/dougo/whalesong/compiler/
raco setup: in /home/dougo/whalesong/js/
raco setup: in /home/dougo/whalesong/world/
raco setup: in /home/dougo/whalesong/private/
raco setup: in /home/dougo/whalesong/make/
raco setup: in /home/dougo/whalesong/parser/
raco setup: in /home/dougo/whalesong/version-case/
raco setup: in /home/dougo/whalesong/js-assembler/
require: unknown module: 'program
raco setup: error: during Building docs for /home/dougo/.racket/planet/300/5.1.3/cache/dyoo/closure-compile.plt/1/2/manual.scrbl
raco setup: require: unknown module: 'program
raco setup: in /home/dougo/whalesong/web-world/
raco setup: in /home/dougo/whalesong/scribblings/
raco setup: making: /home/dougo/whalesong/base
raco setup: making: /home/dougo/whalesong/base/lang
raco setup: in /home/dougo/whalesong/base/lang/
raco setup: making: /home/dougo/whalesong/bf
raco setup: in /home/dougo/whalesong/bf/
raco setup: in /home/dougo/whalesong/lang/
raco setup: in /home/dougo/whalesong/lang/private/
raco setup: in /home/dougo/whalesong/lang/check-expect/
raco setup: making: /home/dougo/whalesong/bf/lang
raco setup: in /home/dougo/whalesong/bf/lang/
raco setup: making: /home/dougo/whalesong/compiler
raco setup: in /home/dougo/whalesong/compiler/
raco setup: making: /home/dougo/whalesong/image
raco setup: making: /home/dougo/whalesong/image/private
raco setup: making: /home/dougo/whalesong/images
raco setup: making: /home/dougo/whalesong/js
raco setup: making: /home/dougo/whalesong/js-assembler
raco setup: in /home/dougo/whalesong/js-assembler/
raco setup: making: /home/dougo/whalesong/js-assembler/runtime-src
raco setup: making: /home/dougo/whalesong/korean
raco setup: making: /home/dougo/whalesong/korean/lang
raco setup: in /home/dougo/whalesong/korean/lang/
raco setup: making: /home/dougo/whalesong/lang
raco setup: in /home/dougo/whalesong/lang/
raco setup: making: /home/dougo/whalesong/lang/base
raco setup: in /home/dougo/whalesong/lang/base/
raco setup: making: /home/dougo/whalesong/lang/check-expect
raco setup: making: /home/dougo/whalesong/lang/js
raco setup: making: /home/dougo/whalesong/lang/private
raco setup: making: /home/dougo/whalesong/lang/unsafe
raco setup: making: /home/dougo/whalesong/make
raco setup: making: /home/dougo/whalesong/notes
raco setup: making: /home/dougo/whalesong/parser
raco setup: in /home/dougo/whalesong/parser/
raco setup: making: /home/dougo/whalesong/private
raco setup: making: /home/dougo/whalesong/resource
raco setup: making: /home/dougo/whalesong/scribblings
raco setup: making: /home/dougo/whalesong/tool
raco setup: in /home/dougo/whalesong/tool/
raco setup: making: /home/dougo/whalesong/version-case
raco setup: making: /home/dougo/whalesong/web-world
raco setup: making: /home/dougo/whalesong/world
raco setup: --- updating info-domain tables ---
raco setup: updating: /home/dougo/.racket/planet/300/5.1.3/cache.rktd
raco setup: --- creating launchers ---
raco setup: launcher: /whalesong
copy-file: cannot open destination file; cannot copy: /usr/share/racket/collects/launcher/sh to: /usr/bin/whalesong (Permission denied; errno=13)
raco setup: --- building documentation ---
raco setup: skipping: /dyoo/closure-compile.plt/1/2/manual.scrbl
raco setup: skipping: handin-server/scribblings/handin-server.scrbl
raco setup: running: /home/dougo/whalesong/scribblings/manual.scrbl
raco setup: rendering: /home/dougo/whalesong/scribblings/manual.scrbl
raco setup: --- installing collections ---
raco setup: --- post-installing collections ---
raco setup:
raco setup: error: during Launcher Setup for /home/dougo/whalesong (Whalesong)
raco setup: copy-file: cannot open destination file; cannot copy: /usr/share/racket/collects/launcher/sh to: /usr/bin/whalesong (Permission denied; errno=13)

test suite is currently broken

The un-nesting solution I applied appears to have broken the test suite in the master branch. I'm trying to figure out why.

Idea: Let call-method generate a runtime error when run in DrRacket

Currently a use of call-method results in the compile time error:

link: module mismatch, probably from old bytecode whose dependencies have changed: variable not provided (directly or indirectly) from module: "/Users/soegaard/Dropbox/GitHub/stxmat-exercises/whalesong/current/js/main.rkt" accessed from module: 'stxmat-exercises at source phase level: 0 in: call-method

when the program is run in DrRacket.

Now if there are other errors in the program such as a reference to an undefined variable, then
one can not use DrRacket to find this error (because it just finds one error and stops).

If instead call-method generated a runtime-error, them DrRacket could be used
to find "real" errors.

IE compatibility issues

On IE, canvas-related programs are not running correctly. See SK's words.rkt program, for example. We need the silly IE compatibility shims, I think.

debugging setting in DrRacket causes link errors at runtime

If debugging is on in DrRacket, Whalesong programs produce an error at runtime that's bizzare:

link: module mismatch, probably from old bytecode whose dependencies have changed: variable not provided (directly or indirectly) from module: ...

web-world API: make it easier to do multiple updates at once

From sk:

It would be good to have an update-view-css/many (not sure of the
name) so we can perform all updates at once.


Maybe something like this?

(bulk-update-view-css id name value
id name value ...)

I'm a little unsatisfied because I don't quite know yet the right way to represent this in a programmer-friendly way.

link error in DrRacket

This module works fine from the command line (well, it prints 'not-done-yet) and can be built and viewed in a browser:

#lang planet dyoo/whalesong

(require (planet dyoo/whalesong/js))

(call-method ($ "<h1>Hello World</h1>")
             "appendTo"
             body)

(void)

But when I try to Check Syntax or Run in DrRacket, I get this error:

index.rkt:5:1: link: module mismatch, probably from old bytecode whose dependencies have changed: variable not provided (directly or indirectly) from module: "/home/dougo/whalesong/js/main.rkt" accessed from module: 'index at source phase level: 0 in: call-method

Not sure if this is a problem with Whalesong or DrRacket or some installation problem. I'm running 5.1.3--2011-08-16(-/f).

read-syntax failing when there are collapsed snipclasses

Andrew Kovacs reports the following bug:

If I have expressions collapsed/folded in DrRacket then I get the following error when I try to build...

$ ~/whalesong/whalesong build tourguide.rkt

read-syntax: cannot load snip-class reader: #"(lib "collapsed-snipclass.ss" "framework")"

=== context ===
/local/projects/racket/releases/5.1.3/collects/wxme/wxme.rkt:381:2: find-class
/local/projects/racket/releases/5.1.3/collects/wxme/wxme.rkt:207:2: read-snip
/local/projects/racket/releases/5.1.3/collects/wxme/wxme.rkt:616:4: read-proc
/local/projects/racket/releases/5.1.3/collects/mzlib/port.rkt:168:4: do-read-it
/local/projects/racket/releases/5.1.3/collects/syntax/module-reader.rkt:179:21: loop
/local/projects/racket/releases/5.1.3/collects/syntax/module-reader.rkt:173:2: wrap-internal
lang:read-syntax
/local/projects/racket/releases/5.1.3/collects/wxme/wxme.rkt:694:2: wxme-read-syntax
standard-module-name-resolver
/gpfs/main/home/akovacs/whalesong/lang/js/query.rkt:30:0: has-javascript-implementation?
/gpfs/main/home/akovacs/whalesong/js-assembler/package.rkt:226:2: wrap-source
/local/projects/racket/releases/5.1.3/collects/racket/private/map.rkt:18:11: map
/gpfs/main/home/akovacs/whalesong/make/make.rkt:115:0: make
/gpfs/main/home/akovacs/whalesong/js-assembler/package.rkt:217:0: core
/gpfs/main/home/akovacs/whalesong/js-assembler/package.rkt:376:0: get-code
/gpfs/main/home/akovacs/whalesong/js-assembler/package.rkt:291:0: package-standalone-xhtml
...

get-gui-namespace doesn't work for textual racket

We were using get-gui-namespace to get around an issue with graphical snips. However, not all systems support get-gui-namespace. It might be necessary to do something more involved with dynamic-require.

unquote-splicing causes runtime error

This program:

`(0 ,@(list 1 2) 4)

sucessfully compiles and builds, but viewing the page produces this Javascript error:

TypeError: Cannot read property 'namespace' of undefined

last-commit-name.rkt missing?

Hi,

JFYI the following error appears during "raco setup" of whalesong.

default-load-handler: cannot open input file: "/Users/soegaard/Dropbox/GitHub/stxmat-exercises/whalesong/current/last-commit-name.rkt" (No such file or directory; errno=2)

/Jens Axel

The whalesong view library is missing some primitives

It would be really nice to have the following:

view-clear: view -> view
remove all the children of the focused node.

view-insert-left: view dom -> view

view-insert-right: view dom -> view

view-replace: view dom -> view

map doesn't work on more that two lists

Issue reported by Jens:

Today I got this error (in red in the browser) from Whalesong:

Error: map: expected 2 value(s), received 3 value(s)
at Object.raiseArityMismatchError

I've traced this down to a bug in apply. The reason my tests cases didn't catch this earlier is because the version that's unit tested comes from kernel and doesn't use apply. The version of map that's exposed from the toplevel whalesong language is the one specialized by private/lang/map.rkt, which uses apply underneath the service.

Now trying to figure out why apply is doing the wrong thing.

list->string and substring not exposed

I am missing the primitives list->string and substring among the exposed functions for immutable strings.
Given these constructors, I can easily write temporary implementations of most string functions
in my own code.

soundness error with values

There's something about the following macro that is being miscompiled. This is a high-priority thing to fix!

Context: trying to compile the signature implementation in the cs019 language. For some reason, the constructor name gets bound to the first selector name. It's like I'm off by one somewhere, which is very bad.

(define-syntax (define-struct: stx)
(syntax-case stx (:)
[(_ sn ([f : S] ...))
(with-syntax ([(names ...)
(build-struct-names #'sn
(syntax->list #'(f ...))
#f #f)]
[term-srcloc (syntax-srcloc stx)]
[(S ...) (parse-sigs #'(S ...))])
(with-syntax ([(S-srcloc ...) (map syntax-srcloc (syntax->list #'(S ...)))]
[sig-name (datum->syntax #'sn
(string->symbol
(string-append
(symbol->string
(syntax->datum #'sn))
"$")))]
[cnstr (syntax-case #'(names ...) ()
[(struct:name-id constructor misc ...)
#'constructor])]
[(_sid _ctr _id? setters ...)
(build-struct-names #'sn
(syntax->list #'(f ...))
#t #f)]
[pred (syntax-case #'(names ...) ()
[(struct:name-id const predicate misc ...)
#'predicate])])
#'(begin
(define-values (names ...)
(let ()
(begin
(define-struct sn (f ...) #:transparent #:mutable)
(let ([cnstr
(lambda (f ...)
(let ([wrapped-args
(let loop ([sigs (list S ... )]
[args (list f ...)]
[sig-srclocs (list S-srcloc ...)]
[n 1])
(if (null? sigs)
'()
(cons (wrap (car sigs)
(car args)
(car sig-srclocs))
(loop (cdr sigs)
(cdr args)
(cdr sig-srclocs)
(add1 n)))))])
(apply cnstr wrapped-args)))]
[setters
(lambda (struct-inst new-val)
(setters struct-inst (wrap S new-val S-srcloc)))]
...)
(values names ...)))))
;; This could be a define below, but it's a define-values
;; due to a bug in ISL's local. See [email protected]
;; thread, 2011-09-03, "splicing into local". Should not
;; be necessary with next release.
(define-values (sig-name)
(first-order-sig pred term-srcloc)))))]))

ie compatibility issues

Reported by Greg Hendershott:


  1. Unfortunately Internet Explorer 8 on Windows 7 gives a page with
    red text saying:

'Error: unable to focus to "add-button": "JScript object expected"'


I've traced these to issues in IE with regards to DOM node values: in IE8 and probably below, they aren't truly javascript objects, so they don't support many of the features. I'm working around this with 7a2ee5a and 3346f88. Waiting to hear back from Greg before I close this issue.

typesetting error for "--" in manual

The manual says "–compress-javascript" when it should say "--compress-javascript" (i.e. the two hyphens turn into a Unicode dash). Same for "--verbose". This is pretty minor, but I was temporarily confused about whether it meant one hyphen or two...

Potential issue with IE 10

SK mentions that Moby isn't playing well with IE10, with the following:


I tried to run

www.cs.brown.edu/~sk/tmp/Tara/

in IE 10 on Windows 8, and it wouldn't work:

Object doesn't support property or method 'indexOf'
'Node' is undefined


I'm following up and finding out if this affects Whalesong as well.

In Whalesong, the only place indexOf shows up is in the implementation of jsworld's remove_world_listener function. This is not safe under IE anyway, so in Whalesong, I'm replacing it with a manual array scan.

Improve README

The README ought to include instructions to compile Whalesong.

raco make whalesong.rkt

Without this people will think Whalesong is ridiculous slow :-)

each application seems annotated with a lot more information than expected

While looking at the bytecode, I see something unusual: the constant being recorded for the procedure application
is significantly larger than I expected. For example:

(make-WithContMark
(make-ToplevelRef 1 6 false false)
(make-Constant
(list
(list 'apply 'make-swf 'args)
#path:/gpfs/main/home/dyoo/work/whalesong/tests/more-tests/isolating-bug.rkt
23
34
858
18))
(make-App
(make-PrimitiveKernelValue 'apply)
(list (make-LocalRef 2 true) (make-LocalRef 4 false))))
(list 2 6)
'_1)

I don't remember the tracing-app function doing that much work. I have to see why the continuation mark's value is recording that much information.

Add break functionality

We need a way to break evaluation. Let's do the thing we did with js-vm with a flag that's checked at trampoline time.

Add missing language tower (ASL)

Requirement: need support for the ASL language tower; in particular, the language in whalesong.rkt needs to not do implicit begin for the definitions, and should also have signatures just like Shriram's base cs019.rkt language.

more ie compatibilty issues

make sure all references to console.log are guarded.

string->list: must use charAt rather than array indexing. Same with string-ref.

compatibility headers: must use ie=7 to work with excanvas. Otherwise, it breaks horribly.

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.