I am beating this thing!
-
So distinguishing between a cast expression and a standard parenthesized subexpression in C# requires backtracking! I whipped up a backtracking
IEnumerator
class, ironed out the kinks with that, and then stuck that under my input to incorporate backtracking it into my parse. Whammo, now it can handle these stupid expressions, and any future backtracking requirements that crop up. I now have a backtracking hand rolled recursive descent parser a lot like what C# uses (aside from the research compiler that was GLR based) C#'s language structure looks deceptively clean. There's a reason it requires very modern parser and compiler technology to operate though. The grammar itself is very ambiguous. It doesn't seem like it is. It's not Perl after all, but it is actually pretty damned hard to parse without type information. I'm using a similar approach that Microsoft's GLR C# research parser project took, and basically coding in possible alternate structures so when i parse, the parse tree i get back can reflect all of those multiple different possible constructs, but my mechanism is more hard coded and rudimentary than theirs was. Fortunately there's a limited number of cases where this has to happen. Either way, I'm proud of what I've managed to pull off so far. This is turning out to be pretty cool.When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
-
So distinguishing between a cast expression and a standard parenthesized subexpression in C# requires backtracking! I whipped up a backtracking
IEnumerator
class, ironed out the kinks with that, and then stuck that under my input to incorporate backtracking it into my parse. Whammo, now it can handle these stupid expressions, and any future backtracking requirements that crop up. I now have a backtracking hand rolled recursive descent parser a lot like what C# uses (aside from the research compiler that was GLR based) C#'s language structure looks deceptively clean. There's a reason it requires very modern parser and compiler technology to operate though. The grammar itself is very ambiguous. It doesn't seem like it is. It's not Perl after all, but it is actually pretty damned hard to parse without type information. I'm using a similar approach that Microsoft's GLR C# research parser project took, and basically coding in possible alternate structures so when i parse, the parse tree i get back can reflect all of those multiple different possible constructs, but my mechanism is more hard coded and rudimentary than theirs was. Fortunately there's a limited number of cases where this has to happen. Either way, I'm proud of what I've managed to pull off so far. This is turning out to be pretty cool.When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
-
So distinguishing between a cast expression and a standard parenthesized subexpression in C# requires backtracking! I whipped up a backtracking
IEnumerator
class, ironed out the kinks with that, and then stuck that under my input to incorporate backtracking it into my parse. Whammo, now it can handle these stupid expressions, and any future backtracking requirements that crop up. I now have a backtracking hand rolled recursive descent parser a lot like what C# uses (aside from the research compiler that was GLR based) C#'s language structure looks deceptively clean. There's a reason it requires very modern parser and compiler technology to operate though. The grammar itself is very ambiguous. It doesn't seem like it is. It's not Perl after all, but it is actually pretty damned hard to parse without type information. I'm using a similar approach that Microsoft's GLR C# research parser project took, and basically coding in possible alternate structures so when i parse, the parse tree i get back can reflect all of those multiple different possible constructs, but my mechanism is more hard coded and rudimentary than theirs was. Fortunately there's a limited number of cases where this has to happen. Either way, I'm proud of what I've managed to pull off so far. This is turning out to be pretty cool.When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
Parse about the codedom go Make the types in shadow show All the ways in which they know When witch will be and gone they go. Double, double toil and trouble; Fire burn and cauldron bubble...
-
Sounds like article time to me :-D
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
Maybe by christmas
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
-
Parse about the codedom go Make the types in shadow show All the ways in which they know When witch will be and gone they go. Double, double toil and trouble; Fire burn and cauldron bubble...
That sounds about right.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
-
Parse about the codedom go Make the types in shadow show All the ways in which they know When witch will be and gone they go. Double, double toil and trouble; Fire burn and cauldron bubble...
Tim Deveaux wrote:
Double, double toil and trouble; VB burn and sorting bubble...
FTFY!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!