[Cs5500] Clarification on project 4

Karl Lieberherr lieber at ccs.neu.edu
Sun Mar 6 15:06:40 EST 2011


Hi Rick:

Print works fine unless you have a really huge input where you might
get a run-time stack overflow.

Paarth reported a similar issue which Ahmed tried to reproduce but could not.
His recommendation was to clean the generated directory and regenerate.

-- Karl

On Sun, Mar 6, 2011 at 2:45 PM, Rick Keilty <rkeilty at gmail.com> wrote:
> Thanks for the changes.  The only problem we're running into (which isn't
> really blocking us, just makes debugging a bit harder), is the print()
> method seems to be busted for some of the classes.  If you do a print on
> some of the generated code it throws errors that look like:
>
> java.lang.RuntimeException:
>   DemeterF: Did not find a match for:
>       Print.combine(Var, _LT)
>
> I dont think this is due to your CD's, I seem to remember in class there was
> mention of print() not always working.
>
> Thanks again for the inputs.
>
> -Rick
>
> On Fri, Mar 4, 2011 at 3:05 PM, gautam naik <naik.ga at husky.neu.edu> wrote:
>>
>> Thanks Rashmi, what you have suggested is absolutely correct, there is no
>> need to make changes in the scg.beh file.
>> Rick please refer the attached file on how to parse the request string.
>> Thanks,
>> Gautam
>>
>> On Fri, Mar 4, 2011 at 2:26 PM, Rick Keilty <rkeilty at gmail.com> wrote:
>>>
>>> Thanks for looking into this so quickly, I look forward to seeing the
>>> updated .beh file, hopefully it solves our parsing issues.
>>>
>>> On Fri, Mar 4, 2011 at 2:13 PM, rashmi nayak <rashmi.n.nayak at gmail.com>
>>> wrote:
>>>>
>>>> Hi Gautam,
>>>>
>>>> My 2 cents to this question.
>>>>
>>>> finishParse() is not necessary in every class. It is required only for
>>>> classes which are abstracted like Instance, Solution, InstanceSet, Claim
>>>> etc. Since they have to use the FullyQualifiedClassName and verbatim to
>>>> generate the Interface objects.
>>>>
>>>> Each time we want to get objects of these classes. It is best to call
>>>> finishParse() on them so that they are populated properly. But I dont think
>>>> you need to provide finishParse() for each of the transaction classes.
>>>>
>>>> Thanks,
>>>> Rashmi
>>>>
>>>> On Fri, Mar 4, 2011 at 2:00 PM, gautam naik <naik.ga at husky.neu.edu>
>>>> wrote:
>>>>>
>>>>> I am sorry, I forget to check the scg.beh file yesterday, this file has
>>>>> the finishParse method for instance,claim and solution, while the method is
>>>>> missing for transaction classes like PlayerRequest,etc.
>>>>> We need to add these methods, will send the updated scg.beh file in a
>>>>> while.
>>>>> Thanks
>>>>> Gautam
>>>>>
>>>>> On Fri, Mar 4, 2011 at 1:48 AM, gautam naik <naik.ga at husky.neu.edu>
>>>>> wrote:
>>>>>>
>>>>>> Hi Rick,
>>>>>>     We tried a few things with the generated class, and found that the
>>>>>> request in following format:
>>>>>> "request[propose " +
>>>>>> "hsr.HSRInstanceSet {{HSR(4,1,3/4)}} protocol.PositiveHSR 0.5" +
>>>>>> "]"
>>>>>> does create the PlayerRequest object, but has the InstanceSet object
>>>>>> present in Claim set to null.
>>>>>> We also found out that in case of just parsing a claim string, this
>>>>>> InstanceSet object in claim is populated by explicity calling the
>>>>>> claim.finishParse() method (See the attached Test.java), but this
>>>>>> finishParse() method is not generated for PlayerRequest class.
>>>>>> Will have to ask the professor why this method is generated in some
>>>>>> classes, while is missing in some other generated classes?
>>>>>> Regards,
>>>>>> Gautam & Ketan
>>>>>> On Thu, Mar 3, 2011 at 10:33 PM, Rick Keilty <rkeilty at gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Gautam,
>>>>>>>
>>>>>>> Thanks for your class definition files, we were able to fully
>>>>>>> generate all the code we need to push forward.  However, we seem to be
>>>>>>> having an issue when writing sample inputs for the PlayerRequest object.  We
>>>>>>> took an initial attempt at creating a ProposeRequest object, and we can get
>>>>>>> the PlayerRequest.parse to work if we pass in the following string:
>>>>>>>
>>>>>>> "request[propose hsr.HSRInstanceSet {{spec}} protocol.PositiveHSR
>>>>>>> 0.5]"
>>>>>>>
>>>>>>> We're not sure why this is parsing appropriately, because the CD for
>>>>>>> Claim indicates it takes an InstanceSet, ProtocolI, and double.  An
>>>>>>> InstanceSet is a tuple of FullyQualifiedClassName (hsr.HSRInstanceSet),
>>>>>>> InstanceSetI (which we assume is the InstanceSet of the HSR object, as
>>>>>>> indicated by the HSRInstanceSet class, which takes an input that looks like
>>>>>>> HSR(4,1,3/4) according to your CD, and finally a verbatim object (which is
>>>>>>> just set to {{spec}} here).  We would expect that the input should look more
>>>>>>> like:
>>>>>>>
>>>>>>> "request[propose hsr.HSRInstanceSet HSR(4,1,3/4) {{spec}}
>>>>>>> protocol.PositiveHSR protocolInput 0.5]"
>>>>>>>
>>>>>>> Yet we get parse errors when attempting this, because it doesn't like
>>>>>>> the HSR(4,1,3/4) we have in place.  When we leave this out, the InstanceSetI
>>>>>>> and ProtocolI properties of the ProposeRequest object are null (and we're
>>>>>>> assuming that via reflection, these objects should be of type
>>>>>>> hsr.HSRInstanceSet and protocol.PositiveHSR).
>>>>>>>
>>>>>>> Did you generate any test inputs to your PlayerRequest object?  I've
>>>>>>> included our test harness below and the output from the harness.
>>>>>>>
>>>>>>> Thanks for your help, we've been stuck trying to figure this out for
>>>>>>> a couple of hours now, and we're running out of ideas.
>>>>>>>
>>>>>>> -GreekGods (Rick, Pat, and James)
>>>>>>>
>>>>>>>
>>>>>>> With input: "request[propose hsr.HSRInstanceSet {{spec}}
>>>>>>> protocol.PositiveHSR 0.5]"
>>>>>>> We get:
>>>>>>> Protocol Name: protocol.PositiveHSR
>>>>>>> Claim Quality: 0.5
>>>>>>> InstanceSet Qualified Name: hsr.HSRInstanceSet
>>>>>>> InstanceSet Spec: spec
>>>>>>> Claim InstanceSetI is null: true
>>>>>>> Claim ProtocolI is null: true
>>>>>>> Exception in thread "main" java.lang.RuntimeException:
>>>>>>>   DemeterF: Null Field Found:  InstanceSet.instanceSet
>>>>>>>
>>>>>>>     at edu.neu.ccs.demeterf.util.Util.nullFieldError(Util.java:212)
>>>>>>>     at
>>>>>>> edu.neu.ccs.demeterf.AbstTraversal.traverse(AbstTraversal.java:68)
>>>>>>>     at
>>>>>>> edu.neu.ccs.demeterf.AbstTraversal.traverse(AbstTraversal.java:72)
>>>>>>>     at
>>>>>>> edu.neu.ccs.demeterf.AbstTraversal.traverse(AbstTraversal.java:72)
>>>>>>>     at
>>>>>>> edu.neu.ccs.demeterf.AbstTraversal.traverse(AbstTraversal.java:72)
>>>>>>>     at
>>>>>>> edu.neu.ccs.demeterf.AbstTraversal.traverse(AbstTraversal.java:28)
>>>>>>>     at scg.Print.PrintM(Print.java:18)
>>>>>>>     at scg.ProposeRequest.print(ProposeRequest.java:44)
>>>>>>>     at test.FullHSRTest.main(FullHSRTest.java:32)
>>>>>>>
>>>>>>> And with input:"request[propose hsr.HSRInstanceSet HSR(4,1,3/4)
>>>>>>> {{spec}} protocol.PositiveHSR protocolInput 0.5]"
>>>>>>> We get:
>>>>>>>
>>>>>>> Exception in thread "main" scg.ParseException: Encountered " <IDENT>
>>>>>>> "HSR "" at line 1, column 36.
>>>>>>> Was expecting one of:
>>>>>>>     "." ...
>>>>>>>     <TEXT> ...
>>>>>>>
>>>>>>>     at scg.TheParser.generateParseException(TheParser.java:915)
>>>>>>>     at scg.TheParser.jj_consume_token(TheParser.java:850)
>>>>>>>     at scg.TheParser.parse_verbatim(TheParser.java:205)
>>>>>>>     at scg.TheParser.parse_InstanceSet(TheParser.java:268)
>>>>>>>     at scg.TheParser.parse_Claim(TheParser.java:289)
>>>>>>>     at scg.TheParser.parse_Cons$Claim$(TheParser.java:658)
>>>>>>>     at scg.TheParser.parse_List$Claim$(TheParser.java:639)
>>>>>>>     at scg.TheParser.parse_ProposeRequest(TheParser.java:460)
>>>>>>>     at scg.TheParser.parse_Request(TheParser.java:398)
>>>>>>>     at scg.TheParser.parse_PlayerRequest(TheParser.java:388)
>>>>>>>     at scg.PlayerRequest.parse(PlayerRequest.java:29)
>>>>>>>     at test.FullHSRTest.main(FullHSRTest.java:13)
>>>>>>>
>>>>>>> Our simple test harness looks like this:
>>>>>>> public static void main(String[] args) throws Exception
>>>>>>>     {
>>>>>>>         PlayerRequest pr =
>>>>>>>             PlayerRequest.parse("request[propose hsr.HSRInstanceSet
>>>>>>> {{spec}} protocol.PositiveHSR 0.5]");
>>>>>>>
>>>>>>>         ProposeRequest req = (ProposeRequest)pr.getRequest();
>>>>>>>         for (Claim c : req.getForbidden())
>>>>>>>         {
>>>>>>>             String protocolName =
>>>>>>> constructFullyQualifiedClassName(c.getProtocolClassName());
>>>>>>>             System.out.println("Protocol Name: " + protocolName);
>>>>>>>             System.out.println("Claim Quality: " + c.getQuality());
>>>>>>>             InstanceSet iset = c.getInstanceSet();
>>>>>>>             String isetName =
>>>>>>> constructFullyQualifiedClassName(iset.getInstanceSetClassName());
>>>>>>>             System.out.println("InstanceSet Qualified Name: " +
>>>>>>> isetName);
>>>>>>>             System.out.println("InstanceSet Spec: " +
>>>>>>> iset.getInstanceSetSpec().getText());
>>>>>>>             InstanceSetI isi = iset.getInstanceSet();
>>>>>>>             System.out.println("Claim InstanceSetI is null: " + (isi
>>>>>>> == null));
>>>>>>>             ProtocolI pro = c.getProtocol();
>>>>>>>             System.out.println("Claim ProtocolI is null: " + (pro ==
>>>>>>> null));
>>>>>>>
>>>>>>>         }
>>>>>>>
>>>>>>>         System.out.println(req.print());
>>>>>>>     }
>>>>>>>
>>>>>>>     private static String
>>>>>>> constructFullyQualifiedClassName(FullyQualifiedClassName name)
>>>>>>>     {
>>>>>>>         String className = "";
>>>>>>>         className += name.getName().getName();
>>>>>>>         for (Qualifier q : name.getRest())
>>>>>>>         {
>>>>>>>             className += "." + q.getName().getName();
>>>>>>>         }
>>>>>>>
>>>>>>>         return className;
>>>>>>>     }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> This parses fine, and we're able to cast the
>>>>>>>
>>>>>>> On Thu, Mar 3, 2011 at 3:24 AM, gautam naik <naik.ga at husky.neu.edu>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi Patrick,
>>>>>>>>     Attached are the class definition files for project 4. Please
>>>>>>>> let us know if you have in issues with the game design.
>>>>>>>> Thanks,
>>>>>>>> Gautam
>>>>>>>>
>>>>>>>> On Wed, Mar 2, 2011 at 10:36 PM, Karl Lieberherr
>>>>>>>> <lieber at ccs.neu.edu> wrote:
>>>>>>>>>
>>>>>>>>> Hi Patrick:
>>>>>>>>>
>>>>>>>>> that is correct. You may want to protect yourself against illegal
>>>>>>>>> requests. Later
>>>>>>>>> the admin will do that for you.
>>>>>>>>>
>>>>>>>>> Please use the test cases that Ketan and Gautam developed (and
>>>>>>>>> passed
>>>>>>>>> on to Rashmi's team).
>>>>>>>>> I don't want you to be slowed down by a non-performing team.
>>>>>>>>>
>>>>>>>>> -- Karl
>>>>>>>>>
>>>>>>>>> On Wed, Mar 2, 2011 at 10:08 PM, Patrick Lannigan
>>>>>>>>> <lannigan at ccs.neu.edu> wrote:
>>>>>>>>> > We are working on implementing the code for project 4. My current
>>>>>>>>> > understanding of what we need to produce is code that can take in
>>>>>>>>> > a request
>>>>>>>>> > as a string, parse it into an object. Then based on the type of
>>>>>>>>> > request,
>>>>>>>>> > call the appropriate method in the avatar interface. We then
>>>>>>>>> > return the
>>>>>>>>> > string representation of the response back so it can be handled
>>>>>>>>> > by the
>>>>>>>>> > administrator.
>>>>>>>>> >
>>>>>>>>> > Is this a correct description of what the assignment is?
>>>>>>>>> >
>>>>>>>>> > Patrick
>>>>>>>>> >
>>>>>>>>> > PS: The group we are paired with has not been in contact with us
>>>>>>>>> > since the
>>>>>>>>> > Friday meeting. They have yet to provide us with a game design,
>>>>>>>>> > sample input
>>>>>>>>> > files or a behavior file for an avatar that will work in their
>>>>>>>>> > game. Can you
>>>>>>>>> > talk to them to ensure that they provide us with the work they
>>>>>>>>> > were
>>>>>>>>> > assigned?
>>>>>>>>> >
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
>



More information about the Cs5500 mailing list