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

success story with ASCIIMathML.js — thanks! :) #19

Open
akavel opened this issue Apr 17, 2017 · 3 comments
Open

success story with ASCIIMathML.js — thanks! :) #19

akavel opened this issue Apr 17, 2017 · 3 comments

Comments

@akavel
Copy link

akavel commented Apr 17, 2017

Wanted to write by email, but given that there are two small tweaks worth reporting, I decided to write via github.

So, firstly, big thanks for the tool! :) I used it to successfully translate the ASCIIMathML.js tool from JS to Lua 5.2. I'm hoping to use it to build a math rendering feature into the SILE typesetter.

As an aside, I had to do two tiny but really tricky tweaks after the initial port:

  1. x = {} (function() end) is treated by Lua as an attempt to call an array; I had to insert a comma ; to fix such a situation and it took me some time to realize this was the reason for a weird Lua error message;
  2. castl.sort is potentially slightly broken when translating JS sort to Lua table.sort — Lua expects the compare func to implement <, while castl.sort resulted in <= semantics in my case. I tweaked the translated code to fix the issue in my code, as it was easier for me in this case than tweaking castl.sort.

Thanks again!

EDIT: added link to the fix I did regarding castl.sort; forgot to add the link originally :/

@PaulBernier
Copy link
Owner

Hi Mateusz,

Thanks a lot for your feedback! And wow that's great what you did with ASCIIMathML. About creating a math rendering feature on top of it, without any insight, I'd be slightly worried about what could be the resulting performances (especially if you're going to use regular Lua VM and not the JIT). But that's a great experiment you are conducting and I'm happy to hear about it :)

For 1. upfront it looks like it should be pretty easy to fix. What is the JS code that lead to this weird Lua code?

For 2. that looks more tricky, I'd have to deep dive, but I remember I already had trouble back in the time with sorting... not sure it's easily fixable...

@akavel
Copy link
Author

akavel commented Apr 18, 2017

Re. 1: asciimath.js, l.32-34

Re. 2: It shouldn't be really hard to observe, if you copy the core logic from what happened in my code into some unit test. Related areas of code:

@PaulBernier
Copy link
Owner

For 1. I just tried to transpile asciimath.js with the latest version of castl and the resulting output had a semi-colon after _obj({}). I'm not sure why it didn't happen in your case :/

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

2 participants