私はAntlrが初めてです。C# で Antlr を使用したいのですが、https://github.com/sharwell/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 を使用しています