Nccc 1.0.0

.NET Standard 2.0
dotnet add package Nccc --version 1.0.0
NuGet\Install-Package Nccc -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nccc" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Nccc --version 1.0.0
#r "nuget: Nccc, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Nccc as a Cake Addin
#addin nuget:?package=Nccc&version=1.0.0

// Install Nccc as a Cake Tool
#tool nuget:?package=Nccc&version=1.0.0


.Net Compiler Compiler Combinator

Make Making Parser Easy


Parsec的意思是Parser Combinators。其思想是基于一些基础parser,使用parser组合子组合成复杂的parser。

这些基础parser都是一些简单的parser,简单到非常容易编程实现。 比如匹配字符串A的parser(记为'A'),匹配一个数字的parser(记为<number>)等。

Parser组合子类似正则表达式中的操作符。 比如将parser串成序列的序列操作@..,或操作@or,星号操作(零个或多个)@*


  • (@.. 'A' 'B')匹配字符串A和字符串B序列。如A B
  • (@or 'A' 'B')匹配字符串A或字符串B
  • (@? 'A')匹配空或者字符串A
  • (@* 'A')匹配零个或多个A。如AA A A A
  • (@* (@or 'A' 'B'))匹配由'A'和'B'组成的序列。如B BA AA BA B A A
  • (@or 'A' <number>)匹配由'A'或者一个数字。如A1.1
  • (@* (@or 'A' <number>))匹配由'A'和数字组成的序列。如A A1.1 2A 23A 1.2 A A

一个例子: 算术表达式


; 定义add为root parser,即最后得到的parser
:: add

; 设置参数
@set-delims '(' ')' '[' ']' '{' '}' '+' '-' '*' '/' '^'

; 下面开始组合

add = (@or add:(mul '+' add)
           sub:(mul'-' add)

mul = (@or mul:(pow '*' mul)
           div:(pow '/' mul)

pow = (@or pow:(primary '^' pow)

primary = (@or par:('(' add ')')
               par:('[' add ']')
               par:('{' add '}')
               neg:('-' pow)


private NcParser _parser = NcParser.LoadFromAssembly(Assembly.GetExecutingAssembly(), "Nccc.Tests.Calculator.calculator.grammer");


var pr = _parser.ScanAndParse("(5.1+2)*3+-2^3^2");


(((parser add))
 (success? True)
       (num[(1,2)-(1,5)] 5.1)
       (num[(1,6)-(1,7)] 2)))
     (num[(1,9)-(1,10)] 3))
      (num[(1,12)-(1,13)] 2)
       (num[(1,14)-(1,15)] 3)
       (num[(1,16)-(1,17)] 2)))))))



Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 551 11/28/2019
0.6.0 536 8/8/2019
0.5.0 522 8/8/2019
0.4.0 559 6/28/2019
0.3.0 658 12/29/2018