is there a delete grammer in lex and yacc?












2















In common grammar in lex and yacc,



A : aB
B : bc


The above grammar can deduce 'abc' into symbol 'A'



Further,I want to convert 'A' to 'S' by a delete operation



for example,



S : A`delete(c)`


combine all grammar above,and we can deduce 'ab' into 'S'



is there a similar grammar in lex and yacc?










share|improve this question





























    2















    In common grammar in lex and yacc,



    A : aB
    B : bc


    The above grammar can deduce 'abc' into symbol 'A'



    Further,I want to convert 'A' to 'S' by a delete operation



    for example,



    S : A`delete(c)`


    combine all grammar above,and we can deduce 'ab' into 'S'



    is there a similar grammar in lex and yacc?










    share|improve this question



























      2












      2








      2








      In common grammar in lex and yacc,



      A : aB
      B : bc


      The above grammar can deduce 'abc' into symbol 'A'



      Further,I want to convert 'A' to 'S' by a delete operation



      for example,



      S : A`delete(c)`


      combine all grammar above,and we can deduce 'ab' into 'S'



      is there a similar grammar in lex and yacc?










      share|improve this question
















      In common grammar in lex and yacc,



      A : aB
      B : bc


      The above grammar can deduce 'abc' into symbol 'A'



      Further,I want to convert 'A' to 'S' by a delete operation



      for example,



      S : A`delete(c)`


      combine all grammar above,and we can deduce 'ab' into 'S'



      is there a similar grammar in lex and yacc?







      yacc context-free-grammar






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 2 at 3:29









      John Kugelman

      245k54406457




      245k54406457










      asked Jan 2 at 3:18









      curtankcurtank

      505




      505
























          1 Answer
          1






          active

          oldest

          votes


















          1














          No, there isn't.



          (F)lex patterns are essentially regular expressions of thr mathematical variety, with some convenience operators (such as character classes). (F)lex doesn't implement thr plethora of non-regular "Regex" operators found in most regex libraries. In theory, it is possible to implement a set difference operator without straying out of the firmal language definition of regular expression, since regular languages are closed over conjunction and inversion. In practice, implementation of this operator is uncommon. (The Ragel stare machine generator has it, but I don't know of any regex library which does.)



          Yacc/bison only implement context-free grammars described in BNF. Context-free languages are not closed over inversion or conjunction, so it is hard to see how any CFG-basef parser generator might tackle suxh a feature.






          share|improve this answer
























          • Understood. Here is the original problem stackoverflow.com/questions/54017344/… hope it will illustrate what I really want to do.

            – curtank
            Jan 3 at 6:38













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54000848%2fis-there-a-delete-grammer-in-lex-and-yacc%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          No, there isn't.



          (F)lex patterns are essentially regular expressions of thr mathematical variety, with some convenience operators (such as character classes). (F)lex doesn't implement thr plethora of non-regular "Regex" operators found in most regex libraries. In theory, it is possible to implement a set difference operator without straying out of the firmal language definition of regular expression, since regular languages are closed over conjunction and inversion. In practice, implementation of this operator is uncommon. (The Ragel stare machine generator has it, but I don't know of any regex library which does.)



          Yacc/bison only implement context-free grammars described in BNF. Context-free languages are not closed over inversion or conjunction, so it is hard to see how any CFG-basef parser generator might tackle suxh a feature.






          share|improve this answer
























          • Understood. Here is the original problem stackoverflow.com/questions/54017344/… hope it will illustrate what I really want to do.

            – curtank
            Jan 3 at 6:38


















          1














          No, there isn't.



          (F)lex patterns are essentially regular expressions of thr mathematical variety, with some convenience operators (such as character classes). (F)lex doesn't implement thr plethora of non-regular "Regex" operators found in most regex libraries. In theory, it is possible to implement a set difference operator without straying out of the firmal language definition of regular expression, since regular languages are closed over conjunction and inversion. In practice, implementation of this operator is uncommon. (The Ragel stare machine generator has it, but I don't know of any regex library which does.)



          Yacc/bison only implement context-free grammars described in BNF. Context-free languages are not closed over inversion or conjunction, so it is hard to see how any CFG-basef parser generator might tackle suxh a feature.






          share|improve this answer
























          • Understood. Here is the original problem stackoverflow.com/questions/54017344/… hope it will illustrate what I really want to do.

            – curtank
            Jan 3 at 6:38
















          1












          1








          1







          No, there isn't.



          (F)lex patterns are essentially regular expressions of thr mathematical variety, with some convenience operators (such as character classes). (F)lex doesn't implement thr plethora of non-regular "Regex" operators found in most regex libraries. In theory, it is possible to implement a set difference operator without straying out of the firmal language definition of regular expression, since regular languages are closed over conjunction and inversion. In practice, implementation of this operator is uncommon. (The Ragel stare machine generator has it, but I don't know of any regex library which does.)



          Yacc/bison only implement context-free grammars described in BNF. Context-free languages are not closed over inversion or conjunction, so it is hard to see how any CFG-basef parser generator might tackle suxh a feature.






          share|improve this answer













          No, there isn't.



          (F)lex patterns are essentially regular expressions of thr mathematical variety, with some convenience operators (such as character classes). (F)lex doesn't implement thr plethora of non-regular "Regex" operators found in most regex libraries. In theory, it is possible to implement a set difference operator without straying out of the firmal language definition of regular expression, since regular languages are closed over conjunction and inversion. In practice, implementation of this operator is uncommon. (The Ragel stare machine generator has it, but I don't know of any regex library which does.)



          Yacc/bison only implement context-free grammars described in BNF. Context-free languages are not closed over inversion or conjunction, so it is hard to see how any CFG-basef parser generator might tackle suxh a feature.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 2 at 3:53









          ricirici

          155k20135204




          155k20135204













          • Understood. Here is the original problem stackoverflow.com/questions/54017344/… hope it will illustrate what I really want to do.

            – curtank
            Jan 3 at 6:38





















          • Understood. Here is the original problem stackoverflow.com/questions/54017344/… hope it will illustrate what I really want to do.

            – curtank
            Jan 3 at 6:38



















          Understood. Here is the original problem stackoverflow.com/questions/54017344/… hope it will illustrate what I really want to do.

          – curtank
          Jan 3 at 6:38







          Understood. Here is the original problem stackoverflow.com/questions/54017344/… hope it will illustrate what I really want to do.

          – curtank
          Jan 3 at 6:38






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54000848%2fis-there-a-delete-grammer-in-lex-and-yacc%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Mossoró

          Error while reading .h5 file using the rhdf5 package in R

          Pushsharp Apns notification error: 'InvalidToken'