Created
May 8, 2022 13:57
-
-
Save yhirose/0dab18e9a863cc5a16758913cb134439 to your computer and use it in GitHub Desktop.
Learn LLVM 12 - Chapter 03 - calc PEG grammar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calc <- decl expr | |
decl <- ('with' ident (',' ident)* ':')? | |
expr <- term (term_op term)* | |
term <- factor (factor_op factor)* | |
factor <- ident / number / '(' expr ')' | |
term_op <- < [+-] > | |
factor_op <- < [*/] > | |
ident <- < [a-zA-Z]+ > | |
number <- < [0-9]+ > | |
%whitespace <- [ \t\n]* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment