Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EBNF formal gramar #24

Open
clach04 opened this issue Dec 1, 2024 · 0 comments
Open

EBNF formal gramar #24

clach04 opened this issue Dec 1, 2024 · 0 comments

Comments

@clach04
Copy link
Contributor

clach04 commented Dec 1, 2024

Spun out of #5

Copy/paste:

TODO.txt Formal Grammar

The Grammar for a TODO.txt file is provided in Extended Backus-Naur Form (EBNF).
The grammar below uses the conventions defined in the W3C specification for EBNF.

The grammar below assumes that the digits and whitespace classes have been defined with their obvious definitions. The printable class includes all printable characters.


context ::= "@" printable+ ;
project ::= "+" printable+ ;
hashTag ::= "#" printable+ ;
kvpair ::= ( [^@+#:] printable* ) ":" printable+ ;
word ::= ( [^@+#] printable* ) | "@" | "+" | "#" ;

token ::= context | project | hashTag | kvpair | word ;

day ::= 2 * digits ;
month ::= 2 * digits ;
year ::= 4 * digits ;
date ::= year "-" month "-" day ;

createdDate ::= date ;
completedDate ::= date ;

priorityClass ::= [A-Z] ;
priority ::= "(" priorityClass ")" ;

space ::= whitespace + ;

completedMark ::= "x" ;

todoLine ::= ( completedMark space )?
             ( priority space )?
             ( ( completedDate space createdDate space ) | ( createdDate space ) )?
             word+
             whitespace* ;

todoFile ::= whitespace* todoLine* ;
@clach04 clach04 changed the title BNF formal gramar EBNF formal gramar Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant