Re: Starting indeces at 0 in Phix

new topic     » goto parent     » topic index » view thread      » older message » newer message

That would be a mammoth undertaking and a monumental mistake to even try.
As you probably know, pwa/p2js transpiles Phix code to JavaScript.
What you probably did not know is that it is also supposed to be able to transpile the generated JavaScript back into working Phix code.
From that point it might not be utterly ridiculous to transpile [nb plain] C code into (almost) working Phix code.
Obviously the aim is not and never will be to "work out of the box", but instead to "reduce tedious manual effort".
It would, for instance, be perfectly reasonable for such a transpiler to force you to comment out any bits it does not understand, and retry.
Of course pretty much all included C libs would be out, so don't be expecting (say) parseXAML() calls to work!

To get the ball rolling, what you need to do is find and post a short C sample along with the nearest manually ported line-for-line working Phix code you can muster.
In the specific case of 0==>1 based indexes I would expect the latter code to contain several otherwise unnecessary "+1]", and
suppress any natural instinct to optimise, invoke builtins, or replace anything with a standard idiom.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu