Is my language Context-Free?
I believe that every useful language ends up being Turing-complete, reflexive, etc.
Fortunately that is not the end of the story.
Most of the parser generation tools (yacc, antler, etc) process up to context-free grammars (CFG).
So we divide the language processing problem in 3 steps:
- Build an over-generating CFG; this is the "syntactical" part that constitutes a solid base where we add the other components,
- Add "semantic" constraints (with some extra syntactic and semantic constraints)
- main semantics ( static semantics, pragmatics, attributive semantics, etc)
Writing a context-free grammar is a very standard way of speaking about all the languages!
It is a very clear and didactic notation for languages!! (and sometimes is not telling all the truth).
When We say that "is not context-free, is Turing-complete, ..." you can translate it to "you can count with lots of semantic extra work" :)
How can I speak about it?
Many choices available. I like to do a subset of the following:
- Write a clear semantic oriented CFG
- for each symbol (T or NT) add/define a set of semantic attributes
- for each production rule: add syntactic/semantic constraints predicates
- for each production rule: add a set equations to define the values of the attributes
- for each production rule: add a English explanation, examples, etc