Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I don't think the those tools are included by default with the F# compiler that is installed with Visual Studio and so the tasks don't exist. I did the following with a Visual Studio 2012 project, but I expect it would be similar in VS 2013. Here were the steps I had to follow:</p> <ol> <li>Install FSharp.Powerpack from nuget. This has the fslex and fsyacc tools as well as build tasks and targets. </li> <li>Unload the project and edit the .fsproj file.</li> <li><p>Add an import statement for the FSharp.Powerpack.target file. This will add the <code>CallFsLex</code> and <code>CallFsYacc</code> build targets. I added this after the import for <code>Microsoft.FSharp.targets</code>:<br> <code>&lt;Import Project="$(ProjectDir)\..\packages\FSPowerPack.Community.3.0.0.0\Tools\FSharp.PowerPack.targets" /&gt;</code></p></li> <li><p>Add these three properties to main PropertyGroup at the top of the file: <code>&lt;FsYaccToolPath&gt;..\packages\FSPowerPack.Community.3.0.0.0\Tools&lt;/FsYaccToolPath&gt; &lt;FsLexToolPath&gt;..\packages\FSPowerPack.Community.3.0.0.0\Tools&lt;/FsLexToolPath&gt; &lt;FsLexUnicode&gt;true&lt;/FsLexUnicode&gt;</code> This tells the build tasks where to find the necessary tools and sets the unicode option for fslex. </p></li> <li>To use the targets we've imported, you need to define the FsLex and FsYacc item groups with the input files to use. You also need to add Compile items for the output .fs files. You end up with something like this in an ItemGroup section:<br> <code>&lt;Compile Include="Sql.fs" /&gt;<br> &lt;FsYacc Include="SqlParser.fsp"&gt;<br> &lt;Module&gt;SqlParser&lt;/Module&gt;<br> &lt;/FsYacc&gt;<br> &lt;Compile Include="SqlParser.fsi" /&gt;<br> &lt;Compile Include="SqlParser.fs" /&gt;<br> &lt;FsLex Include="SqlLexer.fsl" /&gt;<br> &lt;Compile Include="SqlLexer.fs" /&gt;</code></li> </ol> <p>You might be able to use the FsLex and FsYacc build tasks directly by referencing the FSharp.Powerpack.Build.Tasks.dll, but for me this was easier to get going.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload