|go ahead... be a heretic|
Re^3: sourcefilter with complete parser?by LanX (Chancellor)
|on Dec 12, 2013 at 00:50 UTC||Need Help??|
Thanks, even if you replied to the wrong person. =)
Please let me point out that 100% translation is always possible if you don't care about performance.
The most brutal force (if this word exists) is done by emulating the CPU of a processor supporting the language.
I'm not interested to emulate or translate more than 80% of a language even if it might be quite easy with some LISP dialects were most of the complicated constructs are just implemented in some core stuff.
Let me give you an example: there is a very subtle difference how JS and Perl numify strings.
Frankly I don't care to support software which relies on such differences. It even throws warnings.
Of course it's possible to wrap every variable in numeric context with a function which numifies the Perl way.
Such a code would be incredibly slow.
But only supporting the "normal" scalar case were strings are to be treated like numbers is far faster.
Just substract zero:
My theory is that it's pretty feasible to create a new language which is a subset of Perl5 or Perl6 and creates acceptable JS.
"Acceptable" doesn't mean 100% compatible. Neither different versions of Perl nor JS are ever 100% compatible.
perlito is already quite good at this.
( addicted to the Perl Programming Language)