is there a delete grammer in lex and yacc?
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
add a comment |
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
add a comment |
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
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
yacc context-free-grammar
edited Jan 2 at 3:29
John Kugelman
245k54406457
245k54406457
asked Jan 2 at 3:18
curtankcurtank
505
505
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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