Grammatical inference of regular expressions for given finite list of representative strings?

Yes, it turns out this does exist; what is required is what is known academically as a DFA Learning algorithm, examples of which include: Angluin’s L* L* (adding counter-examples to columns) Kearns / Vazirani Rivest / Schapire NL* Regular positive negative inference (RPNI) DeLeTe2 Biermann & Feldman’s algorithm Biermann & Feldman’s algorithm (using SAT-solving) Source … Read more

Regular vs Context Free Grammars

Regular grammar is either right or left linear, whereas context free grammar is basically any combination of terminals and non-terminals. Hence you can see that regular grammar is a subset of context-free grammar. So for a palindrome for instance, is of the form, S->ABA A->something B->something You can clearly see that palindromes cannot be expressed … Read more

Example of Non-Linear, UnAmbiguous and Non-Deterministic CFL?

“IN CONTEXT OF CHOMSHY CLASSIFICATION OF FORMAL LANGUAGE” (1) L3 = {wwR | w ∈ {a, b}* } Language L3 is a Non-Deterministic Context Free Language, its also Unambiguous and Liner language. (2) Lp is language of parenthesis matching. There are two terminal symbols “(” and “)”. Grammar for Lp is: S → SS S … Read more

Is it possible for a computer to “learn” a regular expression by user-provided examples?

Yes, it is possible, we can generate regexes from examples (text -> desired extractions). This is a working online tool which does the job: http://regex.inginf.units.it/ Regex Generator++ online tool generates a regex from provided examples using a GP search algorithm. The GP algorithm is driven by a multiobjective fitness which leads to higher performance and … Read more