Coco/R (http://ssw.jku.at/coco/) is a compiler generator, which takes an attributed grammar of a source language and generates a scanner and a parser for this language. The scanner works as a deterministic finite automaton. The parser uses recursive descent. LL(1)
conflicts can be resolved by a multi-symbol lookahead or by semantic checks. Thus the class of accepted grammars is LL(k)
for an arbitrary k
.
There is a version of Coco/R
for Python language called CocoPy
.
This is a fork of CocoPy-1.1.0rc (https://pypi.org/pypi/CocoPy/) by Ronald Longo, since it is unmaintained.
This is vastly improved beyond the original state. See the git log
and changelog.json
for more details.
Mostly:
- usage via API is available (but be careful, this shit is GPLed💀 and I am not in power to change that, blame the original authors for that);
- runtime and generated code are separated (the runtime is also GPLed (its code is derived from frame files that were GPLed), but Coco/py license says
If not otherwise stated, any source code generated by Coco/R (other than Coco/R itself) does not fall under the GNU General Public License.
); - frame files are eliminated in favour of object oriented programming as a more saner, cleaner and code-safe way;
- correct processing of inline python code (now this shit can generate itself!);
- some optimizations in generated code;
- sorce code is typed;
- legacy versions of python have been dropped.