Skip to content

YATTA: Yet Another Tool for Text Analysis - A toy bootstrapped parser generator

License

Notifications You must be signed in to change notification settings

maciejpirog/yatta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YATTA: Yet Another Tool for Text Analysis

A toy bootstrapped generator of recursive descent parsers.

This is an extraordinarily ancient project (AD 2006), completed as a part of the OO-programming course when I was a first-year student - please keep your expectations low!

YATTA is heavily inspired by ANTLR, the only parser generator I knew at the time. The name comes - of course! - from Green Leaves.

What is it?

YATTA is a parser generator, which means that it is a program that reads a definition of a context-free grammar and produces a piece of C++ code that is able to parse expressions accordingly. It is bootstrapped, that is, the parser used by YATTA to read grammar definitions has been generated by YATTA itself.

Example input

The definition of simple arithmetic expressions is as follows. I think it is sufficiently self-explanatory. The file extension is .yg for "yatta grammar".

LEXER:
priv digit ('0'..'9');
skip whitespace ('q' | '\t');
token number (digit)(digit)*;
token add ('+' | '-');
token mult ('*' | '/');
token lp ('(');
token rp (')');

PARSER:
rule main (add_expr ENDOFFILE);
rule add_expr (mult_expr)(add mult_expr)*;
rule mult_expr (base_expr)(mult base_expr)*;
rule base_expr (!lp add_expr !rp) | (^number);

About

YATTA: Yet Another Tool for Text Analysis - A toy bootstrapped parser generator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published