Gapotchenko.Turbo.CocoR
2022.2.12
Prefix Reserved
dotnet tool install --global Gapotchenko.Turbo.CocoR --version 2022.2.12
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Gapotchenko.Turbo.CocoR --version 2022.2.12
#tool dotnet:?package=Gapotchenko.Turbo.CocoR&version=2022.2.12
nuke :add-package Gapotchenko.Turbo.CocoR --version 2022.2.12
Turbo Coco/R
Turbo Coco/R is a compile-time compiler generator which takes an attributed grammar of a source language and generates a scanner and a parser for this language. It is based on the de-facto Coco/R standard and extends it to be more useful in commercial settings.
Basics
Turbo Coco/R is very similar to once popular lex
and yacc
tools and their open-source flex
and bison
counterparts.
The main distinction of Turbo Coco/R is that it provides the support for multiple programming languages and generates both a scanner and a parser from a provided grammar file.
The produced scanners and parsers are tiny, do not have external dependendencies and thus can be embedded into any project at the source level.
The scanner works as a deterministic finite automaton. The parser uses recursive descent. A multi-symbol lookahead or semantic checks can resolve LL(1) conflicts. Thus the class of accepted grammars is LL(k) for an arbitrary k.
Turbo Coco/R rigorously follows the baseline Coco/R standard while providing a plethora of improvements, extensions, and integrations.
Getting Started
Install Turbo Coco/R tool using .NET package manager:
> dotnet tool install --global Gapotchenko.Turbo.CocoR
Create your first attributed grammar file:
> turbo-coco new grammar MyLang.atg
Create the customizable frame files for a scanner and parser:
> turbo-coco new frame scanner parser
A frame file defines the basic code structure of a generated file.
Now you can generate the actual scanner and parser source files for your grammar:
> turbo-coco MyLang.atg
Once generated, the files are ready to be compiled as a part of your project.
For further guidance, see the examples.
Build Integration
In addition to the traditional command line approach, Turbo Coco/R offers automatic build integration to streamline the development process.
Requirements
- Turbo Coco/R tool requires .NET 7.0+ to run
Please note that:
- The produced source files are not subject to any requirements and can work anywhere
Licensing
Turbo Coco/R is licensed under GNU General Public License v2.0.
If not otherwise stated, any source code generated by Turbo Coco/R (other than Turbo Coco/R itself) does not fall under the GNU General Public License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.