SlideShare ist ein Scribd-Unternehmen logo
1 von 93
Downloaden Sie, um offline zu lesen
Parsec
IM
do {
$ <- try <|> try <|> try <|> return
$ <- try <|> try <|> try <|> return
$ <- (Levenshtein Distance )
}
def order(content):
st = BasicState(content)
recipe = choices(attempt(string(" ")).then(pack((" ", today()))),
attempt(string(" ")).then(pack((" ", tommorrow()))),
attempt(string(" ")).then(pack((" ", after_tommorrow()))),
pack((" ", today())))
time = choices(attempt(string(" ")), attempt(string(" ")),
attempt(string(" ")), pack(" "))
order_one = many(one).over(eof)
…
…
@Parsec
def helper(state):
day, rcp = recipe(state)
skip(space)(state)
t = time(state)
skip(space)(state)
word = "".join(order_one(state)).rstrip()
item = request(rcp, word)
return day, t, item
return helper(st)
AI
AI
DSL
AI
DSL
Parsec
Parsec
Parsec
Haskell Parsec
Parsec
Haskell Parsec
Perl 6 Pugs
Parsec
Haskell Parsec
Perl 6 Pugs
Parsec
Haskell Parsec
Perl 6 Pugs
go/python/javascript/rust/swift
Why Parsec?
Why Parsec?
Why Parsec?
Why Parsec?
Why Parsec?
Why Parsec?
DSL
DSL
DSL
DSL
DSL
DSL
DSL
AI
AI
Parsec
State
State
State
EOF
State
EOF
Monad
Monad
Monad Haskell
Monad
Monad Haskell
Monad Bind >>=
Monad
Monad Haskell
Monad Bind >>=
Bind Then >>
Monad
Monad Haskell
Monad Bind >>=
Bind Then >>
Bind Over
eq/neq
eq/neq
one/eof
eq/neq
one/eof
one of / none of
eq/neq
one/eof
one of / none of
pack(return)/failed
try(attempt)
try(attempt)
either/choice/choices
try(attempt)
either/choice/choices
many/many1
try(attempt)
either/choice/choices
many/many1
sep/sep1/between
try(attempt)
either/choice/choices
many/many1
sep/sep1/between
skip/skip1
try(attempt)
either/choice/choices
many/many1
sep/sep1/between
skip/skip1
…
char/unicode char (one)
char/unicode char (one)
string
char/unicode char (one)
string
space / whitespace/newline …
char/unicode char (one)
string
space / whitespace/newline …
digit/unsigned int/int/unsigned float/float …
char/unicode char (one)
string
space / whitespace/newline …
digit/unsigned int/int/unsigned float/float …
…
Dwarfartisan Parsecs
Travel Tao
golang
golang
github.com/Dwarfartisan/goparsec2
golang
github.com/Dwarfartisan/goparsec2
golang
github.com/Dwarfartisan/goparsec2
golang
github.com/Dwarfartisan/goparsec2
gisp
golang
github.com/Dwarfartisan/goparsec2
gisp
http://github.com/Dwarfartisan/gisp
swift
swift
http://github.com/Dwarfartisan/sparsec
swift
http://github.com/Dwarfartisan/sparsec
swift
swift
http://github.com/Dwarfartisan/sparsec
swift
swift
swift
http://github.com/Dwarfartisan/sparsec
swift
swift
rust
rust
github.com/Dwafartisan/ruskell
rust
github.com/Dwafartisan/ruskell
rust
rust
github.com/Dwafartisan/ruskell
rust
traits Monad
rust
github.com/Dwafartisan/ruskell
rust
traits Monad
Result
rust
github.com/Dwafartisan/ruskell
rust
traits Monad
Result
closure abc !
rust
github.com/Dwafartisan/ruskell
rust
traits Monad
Result
closure abc !
Rust Haskell
rust
github.com/Dwafartisan/ruskell
rust
traits Monad
Result
closure abc !
Rust Haskell
javascript
javascript
github.com/Dwarfartisan/jsparsec
javascript
github.com/Dwarfartisan/jsparsec
javascript
javascript
github.com/Dwarfartisan/jsparsec
javascript
mocha
python
python
github.com/Dwarfartisan/pyparsec
python
github.com/Dwarfartisan/pyparsec
Monad
python
github.com/Dwarfartisan/pyparsec
Monad
python
github.com/Dwarfartisan/pyparsec
Monad
Demo
http://github.com/Dwarfartisan/BlackCookbook/python/takeout
http://tratao.com
http://aiysea.com

Weitere ähnliche Inhalte

Was ist angesagt?

Palestra sobre Collections com Python
Palestra sobre Collections com PythonPalestra sobre Collections com Python
Palestra sobre Collections com Python
pugpe
 
Clustering com numpy e cython
Clustering com numpy e cythonClustering com numpy e cython
Clustering com numpy e cython
Anderson Dantas
 
Functional Pattern Matching on Python
Functional Pattern Matching on PythonFunctional Pattern Matching on Python
Functional Pattern Matching on Python
Daker Fernandes
 

Was ist angesagt? (20)

Palestra sobre Collections com Python
Palestra sobre Collections com PythonPalestra sobre Collections com Python
Palestra sobre Collections com Python
 
Clustering com numpy e cython
Clustering com numpy e cythonClustering com numpy e cython
Clustering com numpy e cython
 
Shell and perl scripting classes in mumbai
Shell and perl scripting classes in mumbaiShell and perl scripting classes in mumbai
Shell and perl scripting classes in mumbai
 
List out of lambda
List out of lambdaList out of lambda
List out of lambda
 
Scala in a Java 8 World
Scala in a Java 8 WorldScala in a Java 8 World
Scala in a Java 8 World
 
Unit testing pig
Unit testing pigUnit testing pig
Unit testing pig
 
Getting property based testing to work after struggling for 3 years
Getting property based testing to work after struggling for 3 yearsGetting property based testing to work after struggling for 3 years
Getting property based testing to work after struggling for 3 years
 
Programação Funcional
Programação FuncionalProgramação Funcional
Programação Funcional
 
Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...
Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...
Marimba - A MapReduce-based Programming Model for Self-maintainable Aggregate...
 
Marimba - Ein MapReduce-basiertes Programmiermodell für selbstwartbare Aggreg...
Marimba - Ein MapReduce-basiertes Programmiermodell für selbstwartbare Aggreg...Marimba - Ein MapReduce-basiertes Programmiermodell für selbstwartbare Aggreg...
Marimba - Ein MapReduce-basiertes Programmiermodell für selbstwartbare Aggreg...
 
Functional Pattern Matching on Python
Functional Pattern Matching on PythonFunctional Pattern Matching on Python
Functional Pattern Matching on Python
 
Working with Groovy Collections
Working with Groovy CollectionsWorking with Groovy Collections
Working with Groovy Collections
 
My First Ruby
My First RubyMy First Ruby
My First Ruby
 
Frege is a Haskell for the JVM
Frege is a Haskell for the JVMFrege is a Haskell for the JVM
Frege is a Haskell for the JVM
 
PubNative Tracker
PubNative TrackerPubNative Tracker
PubNative Tracker
 
Queue in swift
Queue in swiftQueue in swift
Queue in swift
 
Prototypes
PrototypesPrototypes
Prototypes
 
Context
ContextContext
Context
 
Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기
 
1 the ruby way
1   the ruby way1   the ruby way
1 the ruby way
 

Ähnlich wie 轻量级文本工具集

Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)
jeffz
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
Lei Kang
 
深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscex
jeffz
 
Scala jeff
Scala jeffScala jeff
Scala jeff
jeff kit
 
The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)
GroovyPuzzlers
 
Cypher inside out: Como a linguagem de pesquisas em grafo do Neo4j foi constr...
Cypher inside out: Como a linguagem de pesquisas em grafo do Neo4j foi constr...Cypher inside out: Como a linguagem de pesquisas em grafo do Neo4j foi constr...
Cypher inside out: Como a linguagem de pesquisas em grafo do Neo4j foi constr...
adrianoalmeida7
 

Ähnlich wie 轻量级文本工具集 (20)

Metaprogramming in Haskell
Metaprogramming in HaskellMetaprogramming in Haskell
Metaprogramming in Haskell
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
 
Monadologie
MonadologieMonadologie
Monadologie
 
Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
 
Chap 3php array part4
Chap 3php array part4Chap 3php array part4
Chap 3php array part4
 
深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscex
 
Lispprograaming excercise
Lispprograaming excerciseLispprograaming excercise
Lispprograaming excercise
 
Spark_Documentation_Template1
Spark_Documentation_Template1Spark_Documentation_Template1
Spark_Documentation_Template1
 
A bit about Scala
A bit about ScalaA bit about Scala
A bit about Scala
 
Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2
 
Scala jeff
Scala jeffScala jeff
Scala jeff
 
(first '(Clojure.))
(first '(Clojure.))(first '(Clojure.))
(first '(Clojure.))
 
Term Rewriting
Term RewritingTerm Rewriting
Term Rewriting
 
ScalaBlitz
ScalaBlitzScalaBlitz
ScalaBlitz
 
Lisp
LispLisp
Lisp
 
The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)
 
Ecma script 5
Ecma script 5Ecma script 5
Ecma script 5
 
Cypher inside out: Como a linguagem de pesquisas em grafo do Neo4j foi constr...
Cypher inside out: Como a linguagem de pesquisas em grafo do Neo4j foi constr...Cypher inside out: Como a linguagem de pesquisas em grafo do Neo4j foi constr...
Cypher inside out: Como a linguagem de pesquisas em grafo do Neo4j foi constr...
 

Mehr von March Liu

PostgreSQL 9 1 新特性
PostgreSQL 9 1 新特性PostgreSQL 9 1 新特性
PostgreSQL 9 1 新特性
March Liu
 

Mehr von March Liu (20)

Jaskell Core Parsec
Jaskell Core ParsecJaskell Core Parsec
Jaskell Core Parsec
 
奇点与未来
奇点与未来奇点与未来
奇点与未来
 
尼尔盖曼的美国众神
尼尔盖曼的美国众神尼尔盖曼的美国众神
尼尔盖曼的美国众神
 
创业项目中常见的技术和管理债务
创业项目中常见的技术和管理债务创业项目中常见的技术和管理债务
创业项目中常见的技术和管理债务
 
It工程师的职业成长
It工程师的职业成长It工程师的职业成长
It工程师的职业成长
 
Xcode tutorial
Xcode tutorialXcode tutorial
Xcode tutorial
 
Socrates Used PostgreSQL and SQLAlchemy
Socrates Used PostgreSQL and SQLAlchemySocrates Used PostgreSQL and SQLAlchemy
Socrates Used PostgreSQL and SQLAlchemy
 
PostgreSQL 9 1 新特性
PostgreSQL 9 1 新特性PostgreSQL 9 1 新特性
PostgreSQL 9 1 新特性
 
Emacs Introduction
Emacs IntroductionEmacs Introduction
Emacs Introduction
 
软件开发工程化的个人体验
软件开发工程化的个人体验软件开发工程化的个人体验
软件开发工程化的个人体验
 
Python速成指南
Python速成指南Python速成指南
Python速成指南
 
Python 数据库技术第三讲
Python 数据库技术第三讲Python 数据库技术第三讲
Python 数据库技术第三讲
 
Python 数据库技术讲座(二)
Python 数据库技术讲座(二)Python 数据库技术讲座(二)
Python 数据库技术讲座(二)
 
Python 数据库技术讲座(一)
Python 数据库技术讲座(一)Python 数据库技术讲座(一)
Python 数据库技术讲座(一)
 
Python 数据库技术
Python 数据库技术Python 数据库技术
Python 数据库技术
 
PostgreSQL 9 的 standby 集群实践
PostgreSQL 9 的 standby 集群实践PostgreSQL 9 的 standby 集群实践
PostgreSQL 9 的 standby 集群实践
 
PostgreSQL 9 Standby
PostgreSQL 9 StandbyPostgreSQL 9 Standby
PostgreSQL 9 Standby
 
基于 PostgreSQL 的关系型数据库方案
基于 PostgreSQL 的关系型数据库方案基于 PostgreSQL 的关系型数据库方案
基于 PostgreSQL 的关系型数据库方案
 
About Me
About MeAbout Me
About Me
 
1 Python简介
1 Python简介1 Python简介
1 Python简介
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Kürzlich hochgeladen (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

轻量级文本工具集