Skip to content
Snippets Groups Projects
Commit 340239b8 authored by Valencia Vargas, Carlos's avatar Valencia Vargas, Carlos
Browse files

Update file README.md

parent 87507c15
No related branches found
No related tags found
No related merge requests found
# 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.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment