parsers / lexers usable from Python and Java (and C++/C)?

Discussion in 'Python' started by John J. Lee, Jun 24, 2003.

  1. John J. Lee

    John J. Lee Guest

    Are there any parser / lexer generators useable from both CPython and
    Java? I don't mind much if the Python-useable output is in Python or
    C (as long as the C can be wrapped automatically, of course). If I
    could run the same source files through two different tools, that
    would be just as good.

    I'm aware that I could use ANTLR from Jython or perhaps Python+JPE,
    but I was looking for something accessible from CPython without having
    Java installed, too (speed, and ease of use direct from C++ and C
    would be a bonus). And no, I don't want to use JNI!

    Failing that, do tools exist for which one could write spec. files for
    lexer / parser generators that produce code useable from CPython, and
    then apply some minimal tweaks and run them through another tool(s)
    that generates Java code? YAPPS for Python and ANTLR for Java,
    perhaps -- anybody tried that?


    John
     
    John J. Lee, Jun 24, 2003
    #1
    1. Advertising

  2. John J. Lee

    John J. Lee Guest

    "Mike Rovner" <> writes:

    > John J. Lee wrote:
    > > Are there any parser / lexer generators useable from both CPython and
    > > Java?

    >
    > PLY (http://systems.cs.uchicago.edu/ply/) implemented entirely in Python,
    > so it might be possible to use it from both implementations of Python.


    No, I really did mean CPython and Java, not CPython and Jython.


    > You may look at http://www.python.org/cgi-bin/moinmoin/LanguageParsing for
    > other tools.


    Thanks. There doesn't seem to be anything promising there,
    unfortunately.

    All I've found so far are some threads in which Tim Peters complains
    about the lack of a Python interface of some kind to lex. Maybe I can
    automatically SWIG-wrap lex's lexers, and use jflex for Java. For
    parsing (and maybe lexing too), *maybe* it's possible to auto-wrap the
    C++ ANTLR outputs, but wrapping C++ (even generated C++) in an
    automated way without pain seems unlikely.


    John
     
    John J. Lee, Jun 25, 2003
    #2
    1. Advertising

  3. John J. Lee

    Mike Rovner Guest

    John J. Lee wrote:
    > "Mike Rovner" <> writes:
    >
    >> John J. Lee wrote:
    >>> Are there any parser / lexer generators useable from both CPython
    >>> and Java?

    >>
    >> PLY (http://systems.cs.uchicago.edu/ply/) implemented entirely in
    >> Python, so it might be possible to use it from both implementations
    >> of Python.

    >
    > No, I really did mean CPython and Java, not CPython and Jython.


    Your goal is a little vague for me. Jython IS java.

    > ... wrapping C++ (even generated C++) in an
    > automated way without pain seems unlikely.


    Take a look at boost.python pyste.

    Mike
     
    Mike Rovner, Jun 26, 2003
    #3
  4. John J. Lee

    John J. Lee Guest

    "Mike Rovner" <> writes:
    [...]
    > >> PLY (http://systems.cs.uchicago.edu/ply/) implemented entirely in
    > >> Python, so it might be possible to use it from both implementations
    > >> of Python.

    > >
    > > No, I really did mean CPython and Java, not CPython and Jython.

    >
    > Your goal is a little vague for me. Jython IS java.


    Oh, you anal hacker, you.


    > > ... wrapping C++ (even generated C++) in an
    > > automated way without pain seems unlikely.

    >
    > Take a look at boost.python pyste.


    Cool! There are so many nice cross-language tools out there for
    Python now... :)

    Thanks


    John
     
    John J. Lee, Jun 26, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RedEye
    Replies:
    0
    Views:
    738
    RedEye
    Sep 1, 2005
  2. Zed A. Shaw
    Replies:
    0
    Views:
    399
    Zed A. Shaw
    Apr 16, 2008
  3. Artur McCennon
    Replies:
    0
    Views:
    437
    Artur McCennon
    Jul 22, 2009
  4. John Nagle
    Replies:
    9
    Views:
    2,867
    Albert van der Horst
    Apr 21, 2010
  5. RedEye
    Replies:
    0
    Views:
    261
    RedEye
    Sep 1, 2005
Loading...

Share This Page