I know there are resources out there to do this. Amusing I actually put in some tiny simple code into a website that claimed to convert from c sharp to python, but spit out repeated errors on the easiest conversion example that I could think of.
I thought it might be a fun project to build a crude interpreter to do this. So I've basically completed some untested code that interprets using reserved keyword examinations coupled with scope bracing (C #). Actually seemed to be a cumbersome project as I delved into it, but not as difficult as I thought progressing into the project. Now I am up to scope/cataloging everything from Namespace, Class, Class function, if/ else, for, and switch, here building these according to necessary input parameters which now lead to all other potential line/multi excutable types left. Since python instantiates a variable object as opposed to having an object definition, a definition containing information about the object type but not needing an defined object instance, I am left with the handy task of completing the conversion from either omitting or instancing initial values on definitions. Not actually as bad as it sounds, although there are some hairier places where instancing at the outset, for instance, classes from other modules which have necessity from some level of interwoven data from other data generating classes. In this case, it may be better to simply pound comment these definitions until instancing them later. Anyways I know there are probably already written packages out there that do exactly this, but re inventing the wheel actually is turning into an interesting code side project. Basically building a key word token parser and interpreter has amounted to so far 488 lines of code.
I thought it might be a fun project to build a crude interpreter to do this. So I've basically completed some untested code that interprets using reserved keyword examinations coupled with scope bracing (C #). Actually seemed to be a cumbersome project as I delved into it, but not as difficult as I thought progressing into the project. Now I am up to scope/cataloging everything from Namespace, Class, Class function, if/ else, for, and switch, here building these according to necessary input parameters which now lead to all other potential line/multi excutable types left. Since python instantiates a variable object as opposed to having an object definition, a definition containing information about the object type but not needing an defined object instance, I am left with the handy task of completing the conversion from either omitting or instancing initial values on definitions. Not actually as bad as it sounds, although there are some hairier places where instancing at the outset, for instance, classes from other modules which have necessity from some level of interwoven data from other data generating classes. In this case, it may be better to simply pound comment these definitions until instancing them later. Anyways I know there are probably already written packages out there that do exactly this, but re inventing the wheel actually is turning into an interesting code side project. Basically building a key word token parser and interpreter has amounted to so far 488 lines of code.
No comments:
Post a Comment