Gapotchenko.Turbo.CocoR
2022.1.3
Prefix Reserved
See the version list below for details.
dotnet tool install --global Gapotchenko.Turbo.CocoR --version 2022.1.3
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Gapotchenko.Turbo.CocoR --version 2022.1.3
#tool dotnet:?package=Gapotchenko.Turbo.CocoR&version=2022.1.3
nuke :add-package Gapotchenko.Turbo.CocoR --version 2022.1.3
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.
Features
- Follows the baseline Coco/R standard with some extensions
- Multilingual support: C#, other languages are coming
- Ready for consumption: available in a handy regularly-updated prebuilt package
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.
Getting Started
Install Turbo Coco/R tool using .NET package manager:
> dotnet tool install Gapotchenko.Turbo.CocoR --global
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.
Requirements
- Turbo Coco/R tool requires .NET SDK 7.0+
- 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
This package has no dependencies.