Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Hera

< >

Hera is a grammar language created in 2021 by Daniel X Moore.

#2205on PLDB 3Years Old
Download source code:
git clone https://github.com/DanielXMoore/Hera
Source Code

Elegant parsing expression grammars


Example from the web:
# WIP Coffee-like lang Grammar Line* Line Indent Content EOL Indent EOL Indent " "* Content Statement Expression Expression Applied # Function application: # a b # a(b) # a b, c, d # a(b, c, d) Applied Operated Application? Application "()" __ "(" ArgumentList ")" Space+ ArgumentList ArgumentList Expression (__ "," __ Expression)* Operated Assigned (__ BinaryOp __ Assigned)* UnaryOp* Assigned Assigned (Accessed __ "=" __)+ Expression Accessed Accessed Primary Access* Access "?"? "." Name "?"? "[" Expression "]" Primary "(" Expression ")" Function Literal Name This "this" "@" Function Parameters "->" Literal StringValue Numeric "true" "false" "null" "undefined" Parameters "(" Name (Comma Name)+ ")" "(" Name ")" "" Comma Space* "," Space* Name [$a-zA-Z_][$a-zA-Z0-9_]* BinaryOp "+" "-" "*" "/" "and" "&&" "or" "||" # TODO: delete, void, typeof UnaryOp [!~+-] Statement Import Export Import /import[^\r\n]*/ Export /export[^\r\n]*/ Numeric /\d+(?:\.\d*)?/ StringValue "\"" $DoubleStringCharacter* "\"" -> $2 "\'" $SingleStringCharacter* "\'" -> $2 DoubleStringCharacter [^"\\]+ EscapeSequence SingleStringCharacter [^'\\]+ EscapeSequence EscapeSequence $( "\\" . ) # Required non-newline white space Space [\t ] # Whitespace including newlines __ /\s*/ # End of line EOL /\r\n|\n|\r/

- Build the next great programming language Add Issues About Search Keywords Livestreams Labs Resources Acknowledgements

Built with Scroll v154.3.0