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

Compiling failed in Racket 6.3 #48

Open
wargrey opened this issue Dec 2, 2015 · 7 comments
Open

Compiling failed in Racket 6.3 #48

wargrey opened this issue Dec 2, 2015 · 7 comments

Comments

@wargrey
Copy link

wargrey commented Dec 2, 2015

  1. whalesong/lang/private/qq-and-or.rkt:108:118: idl: unbound identifier in module (in phase 1, transformer environment)
  2. whalesong/parser/parse-bytecode-5.3.3.7.rkt:100:50: match: wrong number for fields for structure compilation-top: expected 4 but got 3
@soegaard
Copy link
Owner

soegaard commented Dec 2, 2015

@wargrey

I hope someone will look into this - in the mean time we are stuck with Racket 6.2.

Notes:
ad 1) The file qq-and-or.rkt was changed in racket/base when the new macro expander arrived.
Maybe we just need to copy the new file?
ad 2) This error is due to a change in the Racket VM.
The bytecode compilation-top got an extra parameter.
I haven't checked what the new parameter is used for - maybe it is enough to
add an extra field to the compilation-top struct in Whalesong - and then ignore it.

@wargrey
Copy link
Author

wargrey commented Dec 3, 2015

Oh, I see.
I will use whalesong in my next project these days.
I will try if I can get involved in.

@SuzanneSoy
Copy link

FWIW I added a commit which ignores the extra fields (there was also an error with the "wrapped" struct which was removed, and with the "prefix" and "mod" structs which got an extra field).

Here's the commit:
SuzanneSoy@8470341

With that change, the codebase compiles, but the tests fail. I doubt it will work as-is, anyway: all the extra fields which my commit ignores seem related to the new macro expander, so it is quite possible that some problems related to identifiers which should or should not be equal will arise.

Also, I added a new bytecode parser for version 6.3, as this is the version in which @soegaard said the changes were introduced, but the exact version number might need to be adjusted.

Hopefully someone with good knowledge of the zo structs will step in and say how the new fields have to be handled.

@soegaard
Copy link
Owner

@jsmaniac I happened to reread this today. You say the tests fail on 6.3 - but that might not be a bad sign. Do you know whether the tests fail on 6.2 or not?

@SuzanneSoy
Copy link

@soegaard How exactly are you supposed to run the tests? raco test -p whalesong spits out a lot of errors and runs interactive stuff, and raco test -x -p whalesong also generates a lot of errors.

@pmatos
Copy link

pmatos commented Sep 30, 2018

@soegaard What's missing to get this working with Racket 7.0? It seems this broke awhile ago - 6.1 or so and has been broken since.

@soegaard
Copy link
Owner

Hi @pmatos ,

Whalesong is supposed to work on Racket 6.2.

The Whalesong compiler uses the standard Racket compiler to compile Racket files into zo-files i.e. to bytecode. Then the bytecode is compiled to JavaScript. This has the effect that each time a change is made to the Racket VM bytecodes, Whalesong needs to be fixed. Normally small changes are reasonable easy to fix, but in the 6.3 the new macro expander arrived. That meant that a fix is more involved - see the comment on qq-and-or.rkt and the change to the compilation-top bytecode.

There were some further changed to the VM between 6.3 and 7.0, but the introduction of 7.0 is yet again a major change to the VM and compilation system, so alas Whalesong is stuck with 6.2 for the time being.

The new compiler (the one with Chez Scheme backend) produces so-called linklets. The best way to make a Racket to JavaScript compiler would be to reuse the Racket-to-linklet part of the compiler and then figure out how to compile from linklets to JavaScript. Thus avoiding bytecodes altogether. This way a JavaScript compiler won't break at every bytecode change.

In https://github.com/soegaard/urlang/tree/master/compiler-rjs I have the beginnings of such a compiler, but it does not support modules (nor linklets) yet. (TCO is supported in browsers with a JavaScript engine that supports TCO (read Safari). Sadly Chrome had TCO support at some time, but removed it).

Anyways - if you want to use Whalesong you are unfortunately stuck with 6.2.

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