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. YAY! Slang parsed 8000+ lines of C# code.

YAY! Slang parsed 8000+ lines of C# code.

Scheduled Pinned Locked Moved The Lounge
csharptutorialcode-review
14 Posts 5 Posters 8 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.
  • honey the codewitchH Offline
    honey the codewitchH Offline
    honey the codewitch
    wrote on last edited by
    #1

    It parses fast enough, but it takes so long to resolve what it parsed though. I need to figure out how to optimize this thing. Still, the parser is getting more and more stable. It already parses better than that ANTLR C#6 grammar did. Technically, it can usually convert to VB without going through the resolution process, but it's kind of a hack. It just so happens that in VB there's no difference in syntax between a delegate invocation and a method call, nor a field access and a property access so it happens to work, but it's not proper to resolve method invocations as delegate invocations and all member access as field access which is what the parser has to do, since it doesn't have type info. Overall I'm happy with the project but I need to figure on something to make it more speedy so it will be generally useful.

    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.

    C P S 3 Replies Last reply
    0
    • honey the codewitchH honey the codewitch

      It parses fast enough, but it takes so long to resolve what it parsed though. I need to figure out how to optimize this thing. Still, the parser is getting more and more stable. It already parses better than that ANTLR C#6 grammar did. Technically, it can usually convert to VB without going through the resolution process, but it's kind of a hack. It just so happens that in VB there's no difference in syntax between a delegate invocation and a method call, nor a field access and a property access so it happens to work, but it's not proper to resolve method invocations as delegate invocations and all member access as field access which is what the parser has to do, since it doesn't have type info. Overall I'm happy with the project but I need to figure on something to make it more speedy so it will be generally useful.

      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.

      C Offline
      C Offline
      Chris Maunder
      wrote on last edited by
      #2

      Awesome work (and best of luck with the optimising)

      cheers Chris Maunder

      honey the codewitchH 1 Reply Last reply
      0
      • honey the codewitchH honey the codewitch

        It parses fast enough, but it takes so long to resolve what it parsed though. I need to figure out how to optimize this thing. Still, the parser is getting more and more stable. It already parses better than that ANTLR C#6 grammar did. Technically, it can usually convert to VB without going through the resolution process, but it's kind of a hack. It just so happens that in VB there's no difference in syntax between a delegate invocation and a method call, nor a field access and a property access so it happens to work, but it's not proper to resolve method invocations as delegate invocations and all member access as field access which is what the parser has to do, since it doesn't have type info. Overall I'm happy with the project but I need to figure on something to make it more speedy so it will be generally useful.

        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.

        P Online
        P Online
        PIEBALDconsult
        wrote on last edited by
        #3

        There are no lines. :D Something I keep wondering about your Slang system is whether or not it can be used to implement a language extension similar to Oracle's PRO*C or Microsoft's ESQL -- SQL statements embedded in C programs (or C# now I suppose).

        honey the codewitchH 1 Reply Last reply
        0
        • P PIEBALDconsult

          There are no lines. :D Something I keep wondering about your Slang system is whether or not it can be used to implement a language extension similar to Oracle's PRO*C or Microsoft's ESQL -- SQL statements embedded in C programs (or C# now I suppose).

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

          LINQ already kind of provides that, but yes. You can use this as a starting point to implement a Domain Specific Language. If I was real clever I might make it so you could extend the language through the language itself. Adding keywords and such but that's out of the scope of this for now.

          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.

          P 1 Reply Last reply
          0
          • C Chris Maunder

            Awesome work (and best of luck with the optimising)

            cheers Chris Maunder

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

            Thanks. The articles bombed so far but I think that's either because it's so preliminary, or people don't understand it, or nobody has a use for it. Or a combination of those things. Still, *I* have a couple of uses for it and I understand it so that's a start. :laugh:

            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
            • honey the codewitchH honey the codewitch

              It parses fast enough, but it takes so long to resolve what it parsed though. I need to figure out how to optimize this thing. Still, the parser is getting more and more stable. It already parses better than that ANTLR C#6 grammar did. Technically, it can usually convert to VB without going through the resolution process, but it's kind of a hack. It just so happens that in VB there's no difference in syntax between a delegate invocation and a method call, nor a field access and a property access so it happens to work, but it's not proper to resolve method invocations as delegate invocations and all member access as field access which is what the parser has to do, since it doesn't have type info. Overall I'm happy with the project but I need to figure on something to make it more speedy so it will be generally useful.

              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.

              S Offline
              S Offline
              Super Lloyd
              wrote on last edited by
              #6

              Wow... are you trying to impress us? well.... it might work! :) you need to make an article with some cool nifty example! :P

              A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

              honey the codewitchH 1 Reply Last reply
              0
              • honey the codewitchH honey the codewitch

                LINQ already kind of provides that, but yes. You can use this as a starting point to implement a Domain Specific Language. If I was real clever I might make it so you could extend the language through the language itself. Adding keywords and such but that's out of the scope of this for now.

                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.

                P Online
                P Online
                PIEBALDconsult
                wrote on last edited by
                #7

                honey the codewitch wrote:

                LINQ already kind of provides that

                It does no such thing.

                honey the codewitchH 1 Reply Last reply
                0
                • P PIEBALDconsult

                  honey the codewitch wrote:

                  LINQ already kind of provides that

                  It does no such thing.

                  honey the codewitchH Offline
                  honey the codewitchH Offline
                  honey the codewitch
                  wrote on last edited by
                  #8

                  Then i misunderstood what you meant. LINQ provides SQL like syntax over disparate datasources, including databases.

                  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.

                  P 1 Reply Last reply
                  0
                  • S Super Lloyd

                    Wow... are you trying to impress us? well.... it might work! :) you need to make an article with some cool nifty example! :P

                    A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                    honey the codewitchH Offline
                    honey the codewitchH Offline
                    honey the codewitch
                    wrote on last edited by
                    #9

                    The 2 articles i posted on it so far bombed LOL

                    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.

                    S 1 Reply Last reply
                    0
                    • honey the codewitchH honey the codewitch

                      Then i misunderstood what you meant. LINQ provides SQL like syntax over disparate datasources, including databases.

                      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.

                      P Online
                      P Online
                      PIEBALDconsult
                      wrote on last edited by
                      #10

                      It does no such thing.

                      honey the codewitchH 1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        It does no such thing.

                        honey the codewitchH Offline
                        honey the codewitchH Offline
                        honey the codewitch
                        wrote on last edited by
                        #11

                        Then I must be using a magic feature of an as of yet unheard of version of C# with magical embedded sql like syntax that nobody else has access to. Gosh thanks microsoft. Boy, I feel speshul.

                        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.

                        J 1 Reply Last reply
                        0
                        • honey the codewitchH honey the codewitch

                          The 2 articles i posted on it so far bombed LOL

                          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.

                          S Offline
                          S Offline
                          Super Lloyd
                          wrote on last edited by
                          #12

                          mm... I am not sure what you mean by "bombed" is it [this](https://www.codeproject.com/Articles/5252827/Slang-Part-1-Parsing-a-Csharp-Subset-into-the-Code) and [that](https://www.codeproject.com/Articles/5253246/Slang-Part-2-Scope-and-Type-Resolution-in-the-Code) one? I can only see 4 and 2 votes so far! :O ;P Just quickly read that at work just now! ;P Mm.... this is cool and obviously quite an achievement :thumbsup::cool: However I am not sure where I could reuse that myself.. :O I'll have to think about it again if / when I need code generation....

                          A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                          honey the codewitchH 1 Reply Last reply
                          0
                          • S Super Lloyd

                            mm... I am not sure what you mean by "bombed" is it [this](https://www.codeproject.com/Articles/5252827/Slang-Part-1-Parsing-a-Csharp-Subset-into-the-Code) and [that](https://www.codeproject.com/Articles/5253246/Slang-Part-2-Scope-and-Type-Resolution-in-the-Code) one? I can only see 4 and 2 votes so far! :O ;P Just quickly read that at work just now! ;P Mm.... this is cool and obviously quite an achievement :thumbsup::cool: However I am not sure where I could reuse that myself.. :O I'll have to think about it again if / when I need code generation....

                            A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                            honey the codewitchH Offline
                            honey the codewitchH Offline
                            honey the codewitch
                            wrote on last edited by
                            #13

                            It *is* pretty specialized. I do a lot of codegen so obv to me it's useful but i don't think it will ever have a wide audience. Where it's super useful to is once it's shored up enough I can use it in my parsers for code inside the grammar. If you write it in Slang it will render out in whatever so it doesn't tie the grammar to a particular output language. Downside is the language in the grammar must be Slang. Right now I've also added an Evaluate() method to CodeDomResolver so it can evaluate expressions, call methods and such at runtime. If I did full evaluation i could do runtime grammars without codegen but it would be S-L-O-W.

                            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
                            • honey the codewitchH honey the codewitch

                              Then I must be using a magic feature of an as of yet unheard of version of C# with magical embedded sql like syntax that nobody else has access to. Gosh thanks microsoft. Boy, I feel speshul.

                              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.

                              J Offline
                              J Offline
                              Jorgen Andersson
                              wrote on last edited by
                              #14

                              Unstoppable force, may I introduce immovable object. :) ESQL and Pro*C aren't "SQL Like". They are embedded SQL.

                              Wrong is evil and must be defeated. - Jeff Ello

                              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