Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / May 2007

Tip: Looking for answers? Try searching our database.

bug in babel ShiftReduceParser

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gerry - 11 Feb 2007 21:38 GMT
I have come across what I beleive is a bug in the VsSdk babel support code
for MPPG .
Below is a description of the bug a fix for it - so far this fix hasn't
caused any ill side-effects.
Does anyone know if this is a known issue ?
Is a list of known bugs & fixes for the VsSdk available somewhere ?

Gerry

using the following MPLEX specification :

   %%
   SECTION1            return (int)(Tokens.SECTION1);
   SECTION2            return (int)(Tokens.SECTION2);
   [.\n]*                       /* ignore */
   %%

and using the following MPPG grammer :

   %token    SECTION1 SECTION2
   %%
   Program:        Section1 Section2 ;
   Section1:
           |        SECTION1 ;
   Section2:
           |        SECTION2 ;
   %%

parsing the following input using MPPG :

      SECTION2

Will result in an error IndexOutOfRangeException in ShiftReduceParse.cs at
the line indicated below.
This error seems to happen whenever the 1st rule in the start rule is
optional and is not present in the data being parsed.
The following code includes a fixes for the problem.

ShiftReducedParser.cs line 124
124:         Rule rule = rules[rule_nr];

               //
               // Default action "$$ = $1" for unit productions.
               //
-->           // if (rule.rhs.Length == 1)
-->           if ( rule.rhs.Length < 2 )
                   yyval = value_stack.Top(); // default action: $$ = $1;
               else
                   yyval = new YYSTYPE();
               //
               // Default action "@$ = @1.Merge(@N)" for location info.
               //
-->          // if (rule.rhs.Length == 1)
-->          if ( rule.rhs.Length < 2 )
                   yyloc = location_stack.Top();
               else
               {
exc -->        YYLTYPE at1 = location_stack.array[location_stack.top -
rule.rhs.Length];
                   YYLTYPE atN = location_stack.array[location_stack.top -
1];
                   if (at1 != null && atN != null) yyloc = at1.Merge(atN);
               }
               DoAction(rule_nr);
gerry - 13 Feb 2007 18:31 GMT
one fix to the fix - see below

>I have come across what I beleive is a bug in the VsSdk babel support code
>for MPPG .
[quoted text clipped - 40 lines]
>                // Default action "$$ = $1" for unit productions.
>                //

this one was wrong - leave as is - for zero ( not 1 )  generate empty node

> -->           if (rule.rhs.Length == 1)
>                    yyval = value_stack.Top(); // default action: $$ = $1;
[quoted text clipped - 15 lines]
>                }
>                DoAction(rule_nr);
bralston - 05 Mar 2007 17:44 GMT
Gerry - you are my hero! I was having the exact same problem. I kept going
over my grammer line by line thinking the problem was with my grammer. But
your one line fixed cured it!

ATTN: Managed Babel framework engineers - Please fix this!

-Ben
gerry - 05 Mar 2007 20:48 GMT
good to hear I am not alone
I was beginning to think that I was the only person to use MPLEX/MPPG
now I know there are 2 of us ;-)

what would be really nice would be to have a version of MPPG that does not
produce babel dependent output
my next project is to make a single file generator that wraps MPPG and
removes the babel stuff from the result.

Gerry

> Gerry - you are my hero! I was having the exact same problem. I kept going
> over my grammer line by line thinking the problem was with my grammer. But
[quoted text clipped - 3 lines]
>
> -Ben
bralston7 - 04 May 2007 02:00 GMT
I submitted a bug for this since it is still not fixed in the latest 'Orcas"
VSSDK. You can go here and vote for it:

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID
=275558


-Ben
germ - 04 May 2007 20:34 GMT
Thanks for reporting the issue. We are unable to repro the issue with the
steps provided. We did not find ShiftRedueParser.cs, both in VSSDK 4.0 for
VS2005, and the latest Orcas release (OrcasBeta1VSTS) of the VSSDK. Could
you provide us the location of the file? Or did you create the file
yourself? Could you attach a ZIP of a sample project? Thank you, Visual
Studio Product Team.
Posted by Microsoft on 03/05/2007 at 8:46 PM

wow !!!
& they even closed it already ( same day ) - what a joke !

>I submitted a bug for this since it is still not fixed in the latest
>'Orcas"
[quoted text clipped - 3 lines]
>
> -Ben
bralston7 - 07 May 2007 18:18 GMT
They now show this as active and reproducable. Thanks again for finding the
fix for this gerry. How is your non-Babel-dependant wrapper tool coming?

-Ben

> wow !!!
> & they even closed it already ( same day ) - what a joke !
germ - 08 May 2007 16:44 GMT
Hi Ben,
I got away from that project for a bit and haven't found the time to get
back to it.

Gerry

> They now show this as active and reproducable. Thanks again for finding
> the
[quoted text clipped - 4 lines]
>> wow !!!
>> & they even closed it already ( same day ) - what a joke !

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.