Metaf.Parser
0.0.1
dotnet add package Metaf.Parser --version 0.0.1
NuGet\Install-Package Metaf.Parser -Version 0.0.1
<PackageReference Include="Metaf.Parser" Version="0.0.1" />
paket add Metaf.Parser --version 0.0.1
#r "nuget: Metaf.Parser, 0.0.1"
// Install Metaf.Parser as a Cake Addin #addin nuget:?package=Metaf.Parser&version=0.0.1 // Install Metaf.Parser as a Cake Tool #tool nuget:?package=Metaf.Parser&version=0.0.1
Metaf Parser
Overview
MetaF Parser utilizes ANTLR4 grammars to parse scripts written in the Metaf language to an easy to work with model format.
Features
ANTLR4 Grammar: The project includes a comprehensive ANTLR4 grammar for the Metaf language, defining the syntax and structure of the scripts.
C# ANTLR Visitor: A C# visitor class (
MetafModelBuilderVisitor
) is implemented to traverse the parsed AST (Abstract Syntax Tree) and construct a correspondingMeta
model.C# Model Parser: A C# class (
ModelParser
) with a simplified interface for turning meta file contents into aMeta
model.Meta Model: The
Meta
model represents the structured information extracted from Metaf scripts, including states, rules, conditions, actions, nav routes, and more.
Usage
Install the Metaf.Parser
nuget package and see the examples below.
Example
string afContents = "..."; // Your Metaf script here
var parser = new ModelParser(afContents);
var parseResult = parser.TryParse(out Meta? meta);
if (!parseResult) {
// check parser.ErrorHandler.Errors for a list of parser errors.
}
else {
// Now you can use the 'meta' object to access the parsed information
foreach(var state in meta.States) {
// do stuff
}
}
Updating the grammar
To update the grammar, update the lexer/parser .g4 grammar files and rebuild the project. The updated parser / lexer code should be automatically generated.
Contributions
Contributions are welcome! If you find any issues, have suggestions, or want to improve the project, feel free to submit a pull request or open an issue on the GitLab repository. License
This project is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Antlr4.Runtime (>= 4.6.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.0.1 | 258 | 11/24/2023 |
Initial release