Я новичок в Antlr. Я хочу использовать Antlr в C#, и я сделал все, что описано в https://github.com/sharwell/antlr4cs, но когда я строю свой проект, ничего не происходит.Antlr4cs ничего не делает
Часть моего файла проекта:
<ItemGroup>
<Antlr4 Include="Model\ScriptGrammar\ScriptGrammar.g4">
<Generator>MSBuild:Compile</Generator>
<CustomToolNamespace>Model.ScriptGrammar</CustomToolNamespace>
</Antlr4>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<!-- Folder containing Antlr4BuildTasks.dll -->
<Antlr4BuildTaskPath>..\..\External\Antlr</Antlr4BuildTaskPath>
<!-- Path to the ANTLR Tool itself. -->
<Antlr4ToolPath>..\..\External\Antlr\antlr4-csharp-4.0.1-SNAPSHOT-complete.jar</Antlr4ToolPath>
</PropertyGroup>
<Import Project="..\..\External\Antlr\Antlr4.targets" />
<PropertyGroup>
<PostBuildEvent>$(ProjectDir)\copyExternals.bat</PostBuildEvent>
</PropertyGroup>
Мой тестовый файл грамматики:
grammar ScriptGrammar;
options
{
language=CSharp_v4_5;
}
r : 'hello' ID ; // match keyword hello followed by an identifier
ID : [a-z]+ ; // match lower-case identifiers
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines, \r (Windows)
Я использую Visual Studio 2012 Professional
Спасибо! это работает. – user37337