Loading ...
Sorry, an error occurred while loading the content.

Re: [antlr-interest] Problems with java.g/java.tree.g and super

Expand Messages
  • Chris Pratt
    Jerry, Thanks for the pointer, I downloaded JParse and looked through java.g, but I don t see any major differences dealing with super . Am I just being
    Message 1 of 5 , Jan 5, 2001
    • 0 Attachment
      Jerry,
      Thanks for the pointer, I downloaded JParse and looked through java.g,
      but I don't see any major differences dealing with "super". Am I just being
      dense? Looking at your version (with the code generation stuff removed):

      postfixExpression
      : primaryExpression // start with a primary

      ( // qualified id (id.id.id.id...) -- build the name
      DOT^ ( IDENT
      | "this"
      | "class"
      | newExpression
      | "super" LPAREN^ expressionList RPAREN
      )

      The only difference is that the expressionList is no longer optional, so
      super() should fail, correct? The original code that came with ANTLR looked
      like:

      postfixExpression
      : primaryExpression // start with a primary

      ( // qualified id (id.id.id.id...) -- build the name
      DOT^ ( IDENT
      | "this"
      | "class"
      | newExpression
      | "super" LPAREN ( expressionList )? RPAREN
      )

      Any clarification you could add would greatly help my newbie grey matter.
      Thanks.
      (*Chris*)

      ----- Original Message -----
      From: <james@...>
      To: <antlr-interest@egroups.com>
      Sent: Friday, January 05, 2001 9:06 AM
      Subject: Re: [antlr-interest] Problems with java.g/java.tree.g and super


      > On Thu, 04 Jan 2001 at 06:46:15 -0000, chris@... wrote:
      > > I'm using the java.g and java.tree.g and I'm running into a problem
      > > with the super keyword. The below code compiles fine with javac, but
      > > generates "unexpected AST node: super" using ANTLR. Unfortunately
      > > that's the extent of the useful information that is given, so I'm not
      > > exactly sure how to proceed. Any help would be appreciated.
      >
      > This is a minor bug in java.g. I've fixed that bug in my JParse tool
      > (see the java.g in <URL:http://www.ittc.ku.edu/JParse/>). I've also got
      > a bunch of fixes to JParse batched up. I've got to push a new version
      > soon...
      > --
      > Jerry James
      >
      >
      >
    • Chris Pratt
      Silly me, the fix was to java.tree.g (from your java.print.g). I guess I should have started there. Thanks again for the help. (*Chris*) ... From: Chris
      Message 2 of 5 , Jan 5, 2001
      • 0 Attachment
        Silly me, the fix was to java.tree.g (from your java.print.g). I guess I
        should have started there. Thanks again for the help.
        (*Chris*)

        ----- Original Message -----
        From: "Chris Pratt" <chris@...>
        To: <antlr-interest@egroups.com>
        Sent: Friday, January 05, 2001 10:24 AM
        Subject: Re: [antlr-interest] Problems with java.g/java.tree.g and super


        > Jerry,
        > Thanks for the pointer, I downloaded JParse and looked through java.g,
        > but I don't see any major differences dealing with "super". Am I just
        being
        > dense? Looking at your version (with the code generation stuff removed):
        >
        > postfixExpression
        > : primaryExpression // start with a primary
        >
        > ( // qualified id (id.id.id.id...) -- build the name
        > DOT^ ( IDENT
        > | "this"
        > | "class"
        > | newExpression
        > | "super" LPAREN^ expressionList RPAREN
        > )
        >
        > The only difference is that the expressionList is no longer optional, so
        > super() should fail, correct? The original code that came with ANTLR
        looked
        > like:
        >
        > postfixExpression
        > : primaryExpression // start with a primary
        >
        > ( // qualified id (id.id.id.id...) -- build the name
        > DOT^ ( IDENT
        > | "this"
        > | "class"
        > | newExpression
        > | "super" LPAREN ( expressionList )? RPAREN
        > )
        >
        > Any clarification you could add would greatly help my newbie grey matter.
        > Thanks.
        > (*Chris*)
        >
        > ----- Original Message -----
        > From: <james@...>
        > To: <antlr-interest@egroups.com>
        > Sent: Friday, January 05, 2001 9:06 AM
        > Subject: Re: [antlr-interest] Problems with java.g/java.tree.g and super
        >
        >
        > > On Thu, 04 Jan 2001 at 06:46:15 -0000, chris@... wrote:
        > > > I'm using the java.g and java.tree.g and I'm running into a problem
        > > > with the super keyword. The below code compiles fine with javac, but
        > > > generates "unexpected AST node: super" using ANTLR. Unfortunately
        > > > that's the extent of the useful information that is given, so I'm not
        > > > exactly sure how to proceed. Any help would be appreciated.
        > >
        > > This is a minor bug in java.g. I've fixed that bug in my JParse tool
        > > (see the java.g in <URL:http://www.ittc.ku.edu/JParse/>). I've also got
        > > a bunch of fixes to JParse batched up. I've got to push a new version
        > > soon...
        > > --
        > > Jerry James
        > >
        > >
        > >
        >
      • Chris Pratt
        For the maintainers of ANTLR s examples, the following fix to java.tree.g properly parses the code from the previous message: primaryExpression ... ( expr (
        Message 3 of 5 , Jan 5, 2001
        • 0 Attachment
          For the maintainers of ANTLR's examples, the following fix to java.tree.g
          properly parses the code from the previous message:

          primaryExpression
          : IDENT
          | #( DOT
          ( expr
          ( IDENT
          | arrayIndex
          | "this"
          | "class"
          | #( "new" IDENT elist )
          | "super" <-- This was the
          culprit
          )
          | #(ARRAY_DECLARATOR type)
          | builtInType ("class")?
          )
          )
          | arrayIndex
          | #(METHOD_CALL primaryExpression elist)
          | #(TYPECAST typeSpec expr)
          | newExpression
          | constant
          | "super"
          | "true"
          | "false"
          | "this"
          | "null"
          | typeSpec // type name used with instanceof
          ;

          Thanks.
          (*Chris*)

          ----- Original Message -----
          From: <chris@...>
          To: <antlr-interest@egroups.com>
          Sent: Wednesday, January 03, 2001 10:46 PM
          Subject: [antlr-interest] Problems with java.g/java.tree.g and super


          > I'm using the java.g and java.tree.g and I'm running into a problem
          > with the super keyword. The below code compiles fine with javac, but
          > generates "unexpected AST node: super" using ANTLR. Unfortunately
          > that's the extent of the useful information that is given, so I'm not
          > exactly sure how to proceed. Any help would be appreciated.
          > (*Chris*)
          >
          >
          > class outer {
          >
          > public outer () {
          > } //outer
          >
          > class inner {
          >
          > public inner () {
          > } //inner
          >
          > } //*inner
          >
          > } //*outer
          >
          > public class bug extends outer.inner {
          >
          > public bug (outer o) {
          > o.super();
          > } //bug
          >
          > } //*bug
          >
          >
          >
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.