Thread: [Pydev-code] Embedding python in a DSL in PyDev
Brought to you by:
fabioz
From: Cynebeald <cyn...@na...> - 2009-03-25 15:01:44
|
Hello, I'd like to ask how hard it would be to embed python in another language (RenPy). That language has mostly it's own syntax (indentation based), but it's possible to switch to pure python (either starting a statement with $, or putting code in a python: block). Or to put it another way, RenPy is syntactic sugar to a python API, but it's possible to use the API (and python) directly. I tried opening a rpy file in PyDev, and syntax highlighting works OK, but the parser chokes on the first line because it encounters some special syntax it doesn't understand. Could this be scripted via jython, or will it be necessary to go into pydev sources? Regards, Cynebeald |
From: Fabio Z. <fa...@es...> - 2009-03-26 21:59:11
|
To do this you'd need to go into the Pydev sources -- and you have to create a parser that can validate the RenPy syntax properly and use it instead of the Pydev parser. If the structure is logically similar to the Python structure, it should just provide an AST in the same way that Pydev provides for Python -- if it's not, the logical structure might have to be expanded for the additional structures. Cheers, Fabio On Wed, Mar 25, 2009 at 11:33 AM, Cynebeald <cyn...@na...> wrote: > Hello, > I'd like to ask how hard it would be to embed python in another language > (RenPy). That language has mostly it's own syntax (indentation based), but > it's possible to switch to pure python (either starting a statement with $, > or putting code in a python: block). Or to put it another way, RenPy is > syntactic sugar to a python API, but it's possible to use the API (and > python) directly. I tried opening a rpy file in PyDev, and syntax > highlighting works OK, but the parser chokes on the first line because it > encounters some special syntax it doesn't understand. > > Could this be scripted via jython, or will it be necessary to go into pydev > sources? > Regards, > Cynebeald > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |
From: Cynebeald <cyn...@na...> - 2009-03-27 12:28:58
|
Hi, Thanks, I was afraid I'd have to look into the source itself - at least I know now that its pointless to try to do this via scripting. I hope it's going to be possible to reuse the python parser for blocks of python code. Cynebeald > -----Original Message----- > From: Fabio Zadrozny [mailto:fa...@es...] > Sent: 26. brezna 2009 22:59 > To: pyd...@li... > Subject: Re: [Pydev-code] Embedding python in a DSL in PyDev > > > To do this you'd need to go into the Pydev sources -- and you have to > create a parser that can validate the RenPy syntax properly and use it > instead of the Pydev parser. If the structure is logically similar to > the Python structure, it should just provide an AST in the same way > that Pydev provides for Python -- if it's not, the logical structure > might have to be expanded for the additional structures. > > Cheers, > > Fabio > > On Wed, Mar 25, 2009 at 11:33 AM, Cynebeald > <cyn...@na...> wrote: > > Hello, > > I'd like to ask how hard it would be to embed python in another language > > (RenPy). That language has mostly it's own syntax (indentation > based), but > > it's possible to switch to pure python (either starting a > statement with $, > > or putting code in a python: block). Or to put it another way, RenPy is > > syntactic sugar to a python API, but it's possible to use the API (and > > python) directly. I tried opening a rpy file in PyDev, and syntax > > highlighting works OK, but the parser chokes on the first line > because it > > encounters some special syntax it doesn't understand. > > > > Could this be scripted via jython, or will it be necessary to > go into pydev > > sources? > > Regards, > > Cynebeald > > > > > > > ------------------------------------------------------------------ > ------------ > > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > > easily build your RIAs with Flex Builder, the Eclipse(TM)based > development > > software that enables intelligent coding and step-through debugging. > > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > > _______________________________________________ > > pydev-code mailing list > > pyd...@li... > > https://lists.sourceforge.net/lists/listinfo/pydev-code > > > > ------------------------------------------------------------------ > ------------ > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |