Created
October 27, 2016 14:45
-
-
Save drojf/2701989d94df84e1fde6f8bb85b2742d 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
grammar template; | |
start: in_line out_line code_group (symbol code_group)*; | |
in_line: IN name_type* NEWLINE; | |
out_line: OUT name_type* NEWLINE; | |
name_type: name COLON type; | |
name: TEXT; | |
type: TEXT; | |
code_group: code*?; //lazy match | |
code: TEXT | ANY_CHAR | NEWLINE | IN | OUT | CLOSE_BRACKET | OPEN_BRACKET | COLON; | |
//symbols eg %{hello} | |
symbol: OPEN_BRACKET symbol_name CLOSE_BRACKET; | |
symbol_name: TEXT; | |
//only basic parts of language here (which are always true) | |
OPEN_BRACKET: '%{'; | |
CLOSE_BRACKET: '}'; | |
IN: 'in'; | |
OUT: 'out'; | |
COLON: ':'; | |
TEXT: [A-Za-z]+; | |
WS : [ \t]+ -> skip ; // skip spaces, tabs, newlines | |
NEWLINE: '\r' '\n' | '\n' | '\r'; | |
ANY_CHAR: .; | |
/* | |
Example: | |
in low:int hight:int asdf:string | |
out low:int hight:int asdf:string | |
aeina | |
class a%{definitions} | |
{ | |
dataout:::: | |
%{definitions} | |
artien%{definitions} | |
{function%{definitions}2} | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment