Garden Points Parser Generator
Вообще есть два совершенно замечательных файла gppg.pdf и gplex.pdf, там всё написано
Как подключить в msbuild
Нет ли для этого тасков специальных в проектах https://github.com/loresoft/msbuildtasks или https://github.com/mikefourie/MSBuildExtensionPack ?
нет
руками:
http://ecianciotta-en.abriom.com/2013/05/languages-and-translators-with-visual.html
<Target Name="BeforeBuild" DependsOnTargets="BuildGen">
</Target>
<!-- Build generated file target -->
<Target Name="BuildGen" DependsOnTargets="GenerateMyLanguageParser">
</Target>
<!-- Parser items -->
<PropertyGroup>
<ToolsDir>$(SolutionDir)packages\YaccLexTools.0.1.2\tools\</ToolsDir>
<GplexTool>"$(ToolsDir)gplex.exe"</GplexTool>
<GppgTool>"$(ToolsDir)gppg.exe"</GppgTool>
<MyLanguageParser>$(ProjectDir)MyLanguage</MyLanguageParser>
</PropertyGroup>
<ItemGroup>
<None Include="MyLanguage.parser" />
<Compile Include="MyLanguage.Parser.cs">
<DependentUpon>MyLanguage.parser</DependentUpon>
</Compile>
<Compile Include="MyLanguage.Scanner.cs">
<DependentUpon>MyLanguage.parser</DependentUpon>
</Compile>
<None Include="MyLanguage.Language.grammar.y">
<DependentUpon>MyLanguage.parser</DependentUpon>
</None>
<Compile Include="MyLanguage.Parser.Generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MyLanguage.Language.grammar.y</DependentUpon>
</Compile>
<None Include="MyLanguage.Language.analyzer.lex">
<DependentUpon>MyLanguage.parser</DependentUpon>
</None>
<Compile Include="MyLanguage.Scanner.Generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MyLanguage.Language.analyzer.lex</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup />
<!-- Generate the parsers -->
<Target Name="GenerateMyLanguageParser"
Inputs="$(MyLanguageParser).Language.analyzer.lex;$(MyLanguageParser).Language.grammar.y"
Outputs="$(MyLanguageParser).Scanner.Generated.cs;$(MyLanguageParser).Parser.Generated.cs">
<Message Text="Generating scanner for $(MyLanguageParser) ..." />
<Exec Command="$(GplexTool) "/out:$(MyLanguageParser).Scanner.Generated.cs" "$(MyLanguageParser).Language.analyzer.lex""
WorkingDirectory="$(ProjectDir)"
Outputs="$(GenDir)Scanner.cs">
<Output TaskParameter="Outputs" ItemName="MyLanguageScanner" />
</Exec>
<Message Text="Generating parser for $(MyLanguageParser) ..." />
<Exec Command="$(GppgTool) /no-lines /gplex "$(MyLanguageParser).Language.grammar.y" > "$(MyLanguageParser).Parser.Generated.cs""
WorkingDirectory="$(ProjectDir)"
Outputs="$(MyLanguageParser).Parser.Generated.cs">
<Output TaskParameter="Outputs" ItemName="MyLanguageParser" />
</Exec>
</Target>
Item metadata - это исключительно пользовательские свойства? Или эти слова - AutoGen, DesignTime, DependentUpon на что-то влияют?
https://msdn.microsoft.com/en-us/library/ms164284.aspx
https://docs.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items
All project types in Visual Studio have several items in common. These items are defined in the file microsoft.build.commontypes.xsd. (github - Microsoft.Build.Commontypes.xsd)
DependentUpon - Optional string. Specifies the file this file depends on to compile correctly.
AutoGen - Optional boolean. Indicates whether the file was generated for the project by the Visual Studio integrated development environment (IDE).
Generator - Required string. The name of any file generator that runs on this item.
Авторы
http://www.scitech.qut.edu.au/
QUT , Australian university, in collaboration with Microsoft.
Общие слова
GPPG generates a parser in C# language from a formal description of the grammar written in YACC
GPLEX generates a syntax analyzer (scanner) from the description of the language syntax in LEX