[pypy-dev] trsnslating pypy to another language besides C

Joonas Liik liik.joonas at gmail.com
Wed Mar 4 21:29:26 CET 2015


the host language is called JASS2*

JASS2 is the underlying scripting language for game basically,(Blizzards
Warcraft 3 from 2002/2003 depending on where you're from)
It is
    -strongly typed,
    -not very fast,
    -supports a grand total of 0 bit-wise operations
    -it has obscure and arcane ways.. / limitations that need to be worked
around*
    -it has a type declaration, C-like.. a bit (type A extends B)
    -it has no type-casting facilities at all.. (except for some number
types and strings)**,
    -oh and it the end product is larger then 4 Megabytes.. it will have
significantly reduced usefulness(thx blizzard, you have awesome ideas..)
    -FileIO is.. well it IS possible, surprisingly but it is so haxy you
really wouldn't want to rely on it too much.. (oh.. u can write ur crap all
overs peoples hard drives
            but if you want to read it back you need to set a registry
flag.. just .. charming..)
    -oh.. if your snippet of code runs for more than 30 000 bytecode ops
(internally there's a bytecode interpreter, we can't access it in any
meaningful
            way but some people have hacked away enough to prove it is
there)***
    - numeric types include "integer" == int32 and "real" == float32
(except some funny NaN behaviour i've heard about but not verified)
    - it is multithreaded... except it isn't. u can start many threads
(using ExecuteFunc, TriggerExecute or.. what was that 3rd one..) but
             they will run sequentially, this is useful for circumventing
the OP limit.
    - it has arrays****
    - the arrays are sized (read: every array is exactly 8192 instances of
which the last one you cant
             really use because it is buggy (an off by 1 some place i
guess...))
    - classes? who needs em?! not us, no classes for you :P (there's a few
custom dialects that mend this and usually
             do a just good enough solution to be used by everyone and
loved by none)
    - It has a strange standard library that mainly consists of functions
that swap its arguments and pass it to an underlying native..
             or do a nested loop just to set a value in a table.. it is
absolutely awesome! trembling with excitement ;)

    - it doesn't seem to do any bounds checking ... anywhere (u can tell it
to create a unit in a strange location and the whole game crashes)
    - null is 0 .. almost. well it is when it matters and bites you in the
ass.
    - no introspection (the closest one can come is ExecuteFunc which
actually takes a functions name to execute...(sic!)
              but it is useless unless the function takes no parameters and
returns none)
    - I'm sure i missed a ton of other /great/ features ;)


i can't emit assembler. (well i kind of CAN write files but they will emit
so much extra garbage that there's very low (0) chance it will really be
executable.. well except that the way to read files is basically to execute
them("Preload"))



So to sum it up.. if i can even compile RPython and have it not implode i
would be rather happy.

* a simpler compile target might be Galaxy Script (the scripting language
for Starcraft 2) tho i probably wouldn't be motivated enough to finish this
without the first one.
** theres about 20 built in types.. that are mostly ints in reality.. but
you cant use that.
*** this can be circumvented in a number of ways but at some cost ..  its a
real pain tho if u want to calculate something expensive.
**** of all types except "code" (meaning function) this can be circumvented
by wrapping it in a boolexpr



On 4 March 2015 at 20:48, Ryan Gonzalez <rymg19 at gmail.com> wrote:

> Not necessarily. I figured that a C++ target might look a tad nicer
> because it has built-in objects and exception handling.
>
> Of course, again, it'd likely have its own set of painful holes and would
> be largely useless. But I still want to try it. ;)
>
> On Wed, Mar 4, 2015 at 12:23 PM, Maciej Fijalkowski <fijall at gmail.com>
> wrote:
>
>> C is C++ right? or what precisely did you want to do?
>>
>> On Wed, Mar 4, 2015 at 8:15 PM, Ryan Gonzalez <rymg19 at gmail.com> wrote:
>> > I'd kind of like to know this, too. I've wanted to try to get PyPy to
>> > translate to C++. I doubt it would be of any advantage, but I'm just too
>> > curious...
>> >
>> > On Wed, Mar 4, 2015 at 2:58 AM, Joonas Liik <liik.joonas at gmail.com>
>> wrote:
>> >>
>> >> Hey
>> >>
>> >> If i wanted to translate PyPy in to another language..
>> >>
>> >> Where would i start?
>> >> What would be the absolute minimum i had to do to get it working?
>> >>
>> >> I cant run any C code.. at all  (obscure sandboxed platform that only
>> runs
>> >> an obscure scripting language none of you has probably ever heard of)
>> how
>> >> much of a problem will this be? how to mitigate?
>> >>
>> >>
>> >> _______________________________________________
>> >> pypy-dev mailing list
>> >> pypy-dev at python.org
>> >> https://mail.python.org/mailman/listinfo/pypy-dev
>> >>
>> >
>> >
>> >
>> > --
>> > Ryan
>> > If anybody ever asks me why I prefer C++ to C, my answer will be simple:
>> > "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was
>> > nul-terminated."
>> > Personal reality distortion fields are immune to contradictory
>> evidence. -
>> > srean
>> > Check out my website: http://kirbyfan64.github.io/
>> >
>> > _______________________________________________
>> > pypy-dev mailing list
>> > pypy-dev at python.org
>> > https://mail.python.org/mailman/listinfo/pypy-dev
>> >
>>
>
>
>
> --
> Ryan
> If anybody ever asks me why I prefer C++ to C, my answer will be simple:
> "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was
> nul-terminated."
> Personal reality distortion fields are immune to contradictory evidence. -
> srean
> Check out my website: http://kirbyfan64.github.io/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20150304/4eeb3502/attachment-0001.html>


More information about the pypy-dev mailing list