# IT:AD:TinyPG:HowTo # * [[../|(UP)]] {{indexmenu>.#2|nsort tsort}} ## Process ## ## Define a grammar. * Open the app, * Write a grammar. * A grammar is defined as a extended-BNF notation file of `terminal` and `non-terminal` symbols. Example of `terminal symbols`: BOOLEANLITERAL -> @"true|false"; DECIMALINTEGERLITERAL-> @"[0-9]+(UL|Ul|uL|ul|LU|Lu|lU|lu|U|u|L|l)?"; REALLITERAL -> @"([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?([fFdDMm]?)?)|(\.[0-9]+([eE][+-]?[0-9]+)?([fFdDMm]?)?)|([0-9]+([eE][+-]?[0-9]+)([fFdDMm]?)?)|([0-9]+([fFdDMm]?))"; HEXINTEGERLITERAL -> @"0(x|X)[0-9a-fA-F]+"; STRINGLITERAL -> @"\""(\""\""|[^\""])*\"""; // shortcut implementation, not quite ready FUNCTION -> @"[a-zA-Z_][a-zA-Z0-9_]*(?=\s*\()"; // matches only when followed by ( VARIABLE -> @"[a-zA-Z_][a-zA-Z0-9_]*(?!\s*\()"; // matches only when NOT followed by ( CONSTANT -> @"(?i)pi|e"; BRACEOPEN -> @"{\s*"; BRACECLOSE -> @"\s*}"; BRACKETOPEN -> @"\(\s*"; BRACKETCLOSE -> @"\s*\)"; SEMICOLON -> @";"; PLUSPLUS -> @"\+\+"; MINUSMINUS -> @"--"; PIPEPIPE -> @"\|\|"; AMPAMP -> @"&&"; AMP -> @"&(?!&)"; // matches only when NOT followed by second & POWER -> @"\^"; PLUS -> @"\+"; MINUS -> @"-"; EQUAL -> @"=="; ASSIGN -> @"="; NOTEQUAL -> @"!=|<>"; NOT -> @"!"; ASTERIKS -> @"\*"; SLASH -> @"/"; PERCENT -> @"%"; QUESTIONMARK -> @"\?"; COMMA -> @","; LESSEQUAL -> @"<="; GREATEREQUAL -> @">="; LESSTHAN -> @"<(?!>)"; // matches only when not followed by > GREATERTHAN -> @">"; COLON -> @":"; EOF -> @"^$"; [Skip] WHITESPACE -> @"\s+";