1
$\begingroup$

Regular expressions are a powerful practical tool for string processing. But there are simple examples of useful string processing tasks (like, say, removing brackets from an expression (E) -> E when E might itself contain brackets) which cannot be represented by a convenient regular expression.

Is there a language of expressions that can be used to conveniently process patterns defined by a context-free grammar?

$\endgroup$

1 Answer 1

1
$\begingroup$

Most domain-specific languages for context-free grammars are some variant of Backus-Naur form (BNF). A number of popular programming languages have BNF modules, like python's pyparsing module. They are also a first-class entity in the Raku programming language (a variant/successor to Perl) - see Raku rules. More commonly, you can write BNF grammars for various parser generators and then consume the generated parsers from a language of your choice.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.