Skip to content

Conversation

@mzaidannas
Copy link

Updated version to 2.5.1 to include modern javascript usage (ES6)

@jessedoyle
Copy link
Owner

Hi @mzaidannas, thanks for the PR!

I see the diff removes the src/js/coffee-script.js file - the way this shard works is that it relies on a bundled distributable JS file for the CoffeeScript compiler.

Are we able to build a bundled JS distributable for version 2.5.1 of the CoffeeScript compiler that runs on Duktape?

@jessedoyle
Copy link
Owner

Hey @mzaidannas - nevermind, I think the GitHub web UI is just messing me up on the large diff.

Let me just confirm a few things (I'd like to sanity check a build of the compiler bundle locally), but I think we can move forward with merging this shortly.

@jessedoyle jessedoyle mentioned this pull request Feb 3, 2021
@mzaidannas
Copy link
Author

mzaidannas commented Feb 3, 2021 via email

@jessedoyle
Copy link
Owner

jessedoyle commented Feb 16, 2021

Hey @mzaidannas - have you been able to make this work?

I've tried running builds of the CoffeeScript 2.X compiler on Duktape without success.

The closest I was able to get was using the legacy browser build of the compiler to get the following stack trace when trying to compile example code:

Unhandled exception: RangeError: regexp executor recursion limit (Duktape::RangeError)
  from lib/duktape/src/duktape/api/error_handling.cr:45:13 in 'raise_error'
  from lib/duktape/src/duktape/runtime.cr:165:9 in 'check_and_raise_error'
  from lib/duktape/src/duktape/runtime.cr:130:7 in 'call'
  from lib/duktape/src/duktape/runtime.cr:112:7 in 'call'
  from lib/coffee-script/src/coffee_script.cr:54:5 in 'compile'
  from test.cr:3:6 in '__crystal_main'
  from /usr/local/Cellar/crystal/0.36.0/src/crystal/main.cr:110:5 in 'main_user_code'
  from /usr/local/Cellar/crystal/0.36.0/src/crystal/main.cr:96:7 in 'main'
  from /usr/local/Cellar/crystal/0.36.0/src/crystal/main.cr:119:3 in 'main'

I tried recompiling Duktape locally to allow for a deeper regexp stack recursion depth (see here), but that only causes a stack overflow error further down the line.

It would be awesome if it gets merged and you push the gem to rubygems too

I just wanted to confirm - this is the Crystal shard for coffee-script-source. It's not a Ruby library.

We rely on the Duktape engine to execute JS, so any builds of CoffeeScript must run natively on the Duktape engine (ES5 only).

I'd like to be able to update this library to version 2.X of the CoffeeScript compiler, but we'd need the following to proceed:

  • A bundled version of the CoffeeScript compiler that uses legacy/ES5 syntax to be compatible with the Duktape runtime.
  • The CoffeeScript compiler must be able to correctly compile the example code from its homepage (currently it appears to generate infinite/deep recursion at runtime).
  • Steps to build the CoffeeScript bundle from scratch for verification.

If anyone is able to satisfy the requirements above, I'd be happy to merge a PR!

@jessedoyle
Copy link
Owner

I'm closing this for now - if anyone is able to provide a working build of CoffeeScript >= 2.X for Duktape, please comment and we can reopen!

@jessedoyle jessedoyle closed this Mar 2, 2021
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

Successfully merging this pull request may close these issues.

2 participants