Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
yuca
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Valencia Vargas, Carlos
yuca
Commits
340239b8
Commit
340239b8
authored
1 year ago
by
Valencia Vargas, Carlos
Browse files
Options
Downloads
Patches
Plain Diff
Update file README.md
parent
87507c15
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+32
-1
32 additions, 1 deletion
README.md
with
32 additions
and
1 deletion
README.md
+
32
−
1
View file @
340239b8
# Yuca
A parser combinator library for Rust that supports a well done parsing DSL
A parser combinator library for Rust in the style of Parsec-DSL
# Abstract
Parsing is a fundamental concept in Computer Science, as it is the first building block to
implementing a compiler for any programming language. It is the act of reading and trans-
forming text into a specialised structure, usually an Abstract-Syntax Tree. Such transfor-
mations require two main concepts: capturing the syntactical structure that the grammar
should follow, formally expressed using BNF, and a rule to determine how the tokens de-
rived from the original text should be composed together to yield the desired structure.
Parser Combinator libraries link both notions into a single tool. They allow construct-
ing parsers in a straightforward and concise manner by providing partially applicable func-
tions, known as combinators, that can be composed together to form larger instances. Such
combinators form a Domain Specific Language to express and define how a parser should
function. By defining these combinators natively in a language it is possible for parser writ-
ten using such DSL to resemble BNF. This aids the end-to-end process of creating parsers
as the gap between what the grammar reads and how its parser is written narrows.
Devising this tool for the recently groundbreaking Rust is ideal, as it allows exploiting
it’s unique features. The problem is that Rust does not offer user-defined operators, meaning
that implementing a consistent DSL that mimics BNF is not possible natively. Traditional-
like combinator libraries in Rust such as Nom [1] do exist, but this restriction impedes
writing parsers that feel natural. Furthermore, the system offered by Nom does not fit the
requirements to be considered a Parsec-like library [2], which means it is unfit for certain
parsing constructs and optimisations.
This Project aims to bridge the divide between Rust structures and BNF by making use of
metaprogramming techniques via Rust macros to generate code for a new Parsec-like com-
binator library, Yuca. In the process, Yuca enables optimisation based on parser laws and
forces the user to write correct and fast parsers.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment