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. General Programming
  3. C#
  4. How to implement a syntax checker using C# ?

How to implement a syntax checker using C# ?

Scheduled Pinned Locked Moved C#
questioncsharpdatabaseregexhelp
6 Posts 6 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.
  • I Offline
    I Offline
    I explore code
    wrote on last edited by
    #1

    Hi guys, I need to develop a SQL syntax checker in C#, how do I go about doing that, I think there are two approaches, one is with RegEx and other is, I can create some customised SQL Dictionary which can be cross-checked whenever I enter some SQL statement in a text box. Please help. I need some more ideas for this concept ?

    C R V P L 5 Replies Last reply
    0
    • I I explore code

      Hi guys, I need to develop a SQL syntax checker in C#, how do I go about doing that, I think there are two approaches, one is with RegEx and other is, I can create some customised SQL Dictionary which can be cross-checked whenever I enter some SQL statement in a text box. Please help. I need some more ideas for this concept ?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      SQL is simple enough that regex may work. However, not all combinations of SQL statements are valid SQL, so you probably need a more complex parser for it to really work.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • I I explore code

        Hi guys, I need to develop a SQL syntax checker in C#, how do I go about doing that, I think there are two approaches, one is with RegEx and other is, I can create some customised SQL Dictionary which can be cross-checked whenever I enter some SQL statement in a text box. Please help. I need some more ideas for this concept ?

        R Offline
        R Offline
        Rudolf Jan
        wrote on last edited by
        #3

        In the good old days we used lex, or flex for this purpose, eventually combined with yacc or bison. Now I don't know. You may google for keywords like parser generator or lexical analysis. No idea how these cooperate with C#

        1 Reply Last reply
        0
        • I I explore code

          Hi guys, I need to develop a SQL syntax checker in C#, how do I go about doing that, I think there are two approaches, one is with RegEx and other is, I can create some customised SQL Dictionary which can be cross-checked whenever I enter some SQL statement in a text box. Please help. I need some more ideas for this concept ?

          V Offline
          V Offline
          Vasudevan Deepak Kumar
          wrote on last edited by
          #4

          I found two parsers: 1) http://www.sqlparser.com/[^] 2) http://www.experlog.com/gibello/zql/[^]

          Vasudevan Deepak Kumar Personal Homepage Tech Gossips

          1 Reply Last reply
          0
          • I I explore code

            Hi guys, I need to develop a SQL syntax checker in C#, how do I go about doing that, I think there are two approaches, one is with RegEx and other is, I can create some customised SQL Dictionary which can be cross-checked whenever I enter some SQL statement in a text box. Please help. I need some more ideas for this concept ?

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            You may want to consider using Antlr[^]. It has grammars for various languages.

            Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.

            1 Reply Last reply
            0
            • I I explore code

              Hi guys, I need to develop a SQL syntax checker in C#, how do I go about doing that, I think there are two approaches, one is with RegEx and other is, I can create some customised SQL Dictionary which can be cross-checked whenever I enter some SQL statement in a text box. Please help. I need some more ideas for this concept ?

              L Offline
              L Offline
              leppie
              wrote on last edited by
              #6

              You will need a proper parser for that. Regex with suffice as a tokenizer, but not for grammar parsing. I suggest you go with something like: GPPG[^].

              **

              xacc.ide-0.2.0.75 - now with C# 3.5 support and Navigation Bar!

              **

              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