Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. I am beating this thing!

I am beating this thing!

Scheduled Pinned Locked Moved The Lounge
csharpperldata-structuresbusinesshelp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #1

    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.

    pkfoxP T 2 Replies Last reply
    0
    • H honey the codewitch

      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.

      pkfoxP Offline
      pkfoxP Offline
      pkfox
      wrote on last edited by
      #2

      Sounds like article time to me :-D

      "We can't stop here - this is bat country" - Hunter S Thompson - RIP

      H 1 Reply Last reply
      0
      • H honey the codewitch

        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.

        T Offline
        T Offline
        Tim Deveaux
        wrote on last edited by
        #3

        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...

        H OriginalGriffO 2 Replies Last reply
        0
        • pkfoxP pkfox

          Sounds like article time to me :-D

          "We can't stop here - this is bat country" - Hunter S Thompson - RIP

          H Offline
          H Offline
          honey the codewitch
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • T Tim Deveaux

            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...

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • T Tim Deveaux

              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...

              OriginalGriffO Offline
              OriginalGriffO Offline
              OriginalGriff
              wrote on last edited by
              #6

              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!

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups