Created
June 25, 2020 14:15
-
-
Save prakhar-shukla-in/fc1a93bfd736ae5c32487292c987afab to your computer and use it in GitHub Desktop.
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
//parser | |
grammar drunkPeople; | |
root | |
: statement* EOF | |
; | |
statement | |
: I DRANK something | |
; | |
something | |
: BEER | WINE | VODKA | RUM | |
//lexer | |
fragment A : [aA] ; | |
fragment B : [bB] ; | |
fragment C : [cC] ; | |
fragment D : [dD] ; | |
fragment E : [eE] ; | |
fragment F : [fF] ; | |
fragment G : [gG] ; | |
fragment H : [hH] ; | |
fragment I : [iI] ; | |
fragment J : [jJ] ; | |
fragment K : [kK] ; | |
fragment L : [lL] ; | |
fragment M : [mM] ; | |
fragment N : [nN] ; | |
fragment O : [oO] ; | |
fragment P : [pP] ; | |
fragment Q : [qQ] ; | |
fragment R : [rR] ; | |
fragment S : [sS] ; | |
fragment T : [tT] ; | |
fragment U : [uU] ; | |
fragment V : [vV] ; | |
fragment W : [wW] ; | |
fragment X : [xX] ; | |
fragment Y : [yY] ; | |
fragment Z : [zZ] ; | |
BEER : B E E R; | |
WINE : W I N E; | |
VODKA : V O D K A; | |
RUM : R U M; | |
SPACE : [ \t\r\n]+ -> skip | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment