fsyacc msbuild问题,调用词法生成器时出错

时间:2019-04-27 21:31:27

标签: msbuild fsyacc

我在理解如何设置fsproj文件以使其与带有VS(msbuild)的FSyacc词法分析器/解析器生成器库一起正常工作时遇到问题。我尝试遵循https://fsprojects.github.io/FsLexYacc/fslex.html

中的指南

但是我不认为我对fsproj文件足够了解。 “有趣”的部分是,我有一个可以在linux上运行的dummie项目,但是如果我尝试将其移植到Windows VS上,则它将无法构建。 (仅适用于Mono,不适用于msbuild)

尝试使用上面链接中给出的简单测试项目。

第一个问题是它找不到Lexer.fs和Parser.fs文件,我通过使用false解决了这个问题,但是当它尝试调用fslex.exe时失败了

我刚刚在下面转储了fsproj漏洞文件的内容。

返回以下错误

1>..\YaccParser\Lexer.fsl(14,32): error : Unexpected character '''
1>C:\Users\KAM\Desktop\Fasto2019\YaccParser\YaccParser\packages\FsLexYacc.7.0.6\build\FsLexYacc.targets(34,3): error MSB3073: The command ""C:\Users\KAM\Desktop\Fasto2019\YaccParser\YaccParser\packages\FsLexYacc.7.0.6\build\\fslex.exe"  -o "Lexer.fs" --unicode ..\YaccParser\Lexer.fsl" exited with code 1.
1>Done building project "YaccParser.fsproj" -- FAILED.
1>
1>Build FAILED.

我尝试在stackoverflow上遵循一些较旧的线程,但没有任何运气。因此,如果有什么可以帮助我指导我的fsproj文件可能出现的错误等,那将是很好的。

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{352CE065-7A61-460B-888B-B47F7E9FF8A3}</ProjectGuid>
    <UseStandardResourceNames>true</UseStandardResourceNames>
    <OutputType>Exe</OutputType>
    <RootNamespace>YaccParser</RootNamespace>
    <AssemblyName>YaccParser</AssemblyName>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug</OutputPath>
    <DefineConstants>DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <ExternalConsole>true</ExternalConsole>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <Optimize>true</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <DefineConstants>
    </DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <ExternalConsole>true</ExternalConsole>
    <GenerateTailCalls>true</GenerateTailCalls>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup>
    <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0' OR '$(VisualStudioVersion)' == '11.0'">
    <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
  </PropertyGroup>
  <Import Project="$(FSharpTargetsPath)" />
  <Import Project="..\packages\FsLexYacc.7.0.6\build\FsLexYacc.targets" Condition="Exists('..\packages\FsLexYacc.7.0.6\build\FsLexYacc.targets')" />
  <ItemGroup>
    <Compile Include="Parser.fs">
      <visible>false</visible>
        <link> Parser.fs</link>
    </Compile>
    <Compile Include="Lexer.fs">
      <visible>false</visible>
        <link> Lexer.fs</link>
    </Compile>
    <FsYacc Include="..\YaccParser\Parser.fsy">
      <OtherFlags>--module Parser</OtherFlags>
    </FsYacc>
    <FsLex Include="..\YaccParser\Lexer.fsl">
      <OtherFlags>--unicode</OtherFlags>
    </FsLex>
    <Compile Include="AssemblyInfo.fs" />
    <Compile Include="Program.fs" />
    <Content Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="FSharp.Core">
      <HintPath>packages\FSharp.Core.4.3.3\lib\net45\FSharp.Core.dll</HintPath>
    </Reference>
    <Reference Include="FsLexYacc.Runtime">
      <HintPath>packages\FsLexYacc.Runtime.7.0.6\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid10+MonoTouch10\FsLexYacc.Runtime.dll</HintPath>
    </Reference>
    <Reference Include="mscorlib" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Numerics" />
  </ItemGroup>
  <Import Project="packages\FsLexYacc.7.0.6\build\FsLexYacc.targets" Condition="Exists('packages\FsLexYacc.7.0.6\build\FsLexYacc.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('packages\FsLexYacc.7.0.6\build\FsLexYacc.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\FsLexYacc.7.0.6\build\FsLexYacc.targets'))" />
  </Target>
</Project>

0 个答案:

没有答案