1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-24 20:32:39 +00:00

Implemented for() loops.

This commit is contained in:
jespergravgaard 2017-08-18 00:28:39 +02:00
parent 5a075a0ce4
commit 14dfaee552
21 changed files with 2129 additions and 163 deletions

View File

@ -0,0 +1 @@
// do nothing

View File

@ -0,0 +1,3 @@
sta $ff
cpx $ff
bne {la1}

View File

@ -0,0 +1,3 @@
sta $ff
cpy $ff
bne {la1}

View File

@ -23,7 +23,7 @@ public class StatementSequence {
public String toString(Program program) {
StringBuffer out = new StringBuffer();
for (Statement statement : statements) {
if(!(statement instanceof StatementLabel)) {
if(!(statement instanceof StatementLabel) ) { //&& !(statement instanceof StatementProcedureBegin) && !(statement instanceof StatementProcedureEnd)) {
out.append(" ");
}
out.append(statement.toString(program)+"\n");

View File

@ -28,7 +28,7 @@ forDeclaration
forIteration
: ';' expr ';' expr? # forClassic
| ':' expr ( '..' | '.+.' | '.-.' ) expr #forRange
| ':' expr ( '..' | '.++.' | '.--.' ) expr #forRange
;
parameterListDecl

View File

@ -73,8 +73,8 @@ COMMENT_BLOCK=60
'return'=13
':'=14
'..'=15
'.+.'=16
'.-.'=17
'.++.'=16
'.--.'=17
','=18
'*'=19
'['=20

View File

@ -48,7 +48,7 @@ public class KickCLexer extends Lexer {
private static final String[] _LITERAL_NAMES = {
null, "'{'", "'}'", "'('", "')'", "'const'", "'='", "';'", "'if'", "'else'",
"'while'", "'do'", "'for'", "'return'", "':'", "'..'", "'.+.'", "'.-.'",
"'while'", "'do'", "'for'", "'return'", "':'", "'..'", "'.++.'", "'.--.'",
"','", "'*'", "'['", "']'", "'--'", "'++'", "'+'", "'-'", "'not'", "'!'",
"'&'", "'>>'", "'<<'", "'/'", "'=='", "'!='", "'<>'", "'<'", "'<='", "'=<'",
"'>='", "'=>'", "'>'", "'and'", "'&&'", "'or'", "'||'"
@ -120,7 +120,7 @@ public class KickCLexer extends Lexer {
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2>\u01ca\b\1\4\2\t"+
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2>\u01cc\b\1\4\2\t"+
"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
@ -131,153 +131,154 @@ public class KickCLexer extends Lexer {
"\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6"+
"\3\6\3\6\3\6\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3\13"+
"\3\13\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3"+
"\16\3\16\3\16\3\16\3\17\3\17\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\22\3"+
"\22\3\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\26\3\26\3\27\3\27\3\27\3"+
"\30\3\30\3\30\3\31\3\31\3\32\3\32\3\33\3\33\3\33\3\33\3\34\3\34\3\35\3"+
"\35\3\36\3\36\3\36\3\37\3\37\3\37\3 \3 \3!\3!\3!\3\"\3\"\3\"\3#\3#\3#"+
"\3$\3$\3%\3%\3%\3&\3&\3&\3\'\3\'\3\'\3(\3(\3(\3)\3)\3*\3*\3*\3*\3+\3+"+
"\3+\3,\3,\3,\3-\3-\3-\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3."+
"\3.\3.\3.\3.\3.\3.\3.\3.\3.\5.\u0122\n.\3/\3/\3/\3/\7/\u0128\n/\f/\16"+
"/\u012b\13/\3/\3/\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\5\60\u0138"+
"\n\60\3\61\3\61\5\61\u013c\n\61\3\62\3\62\3\62\5\62\u0141\n\62\3\63\3"+
"\63\3\63\3\63\3\63\5\63\u0148\n\63\3\63\7\63\u014b\n\63\f\63\16\63\u014e"+
"\13\63\3\63\3\63\6\63\u0152\n\63\r\63\16\63\u0153\3\64\7\64\u0157\n\64"+
"\f\64\16\64\u015a\13\64\3\64\3\64\6\64\u015e\n\64\r\64\16\64\u015f\3\65"+
"\3\65\3\65\3\65\3\65\5\65\u0167\n\65\3\65\7\65\u016a\n\65\f\65\16\65\u016d"+
"\13\65\3\65\3\65\6\65\u0171\n\65\r\65\16\65\u0172\3\66\3\66\3\66\5\66"+
"\u0178\n\66\3\67\3\67\3\67\6\67\u017d\n\67\r\67\16\67\u017e\3\67\3\67"+
"\6\67\u0183\n\67\r\67\16\67\u0184\5\67\u0187\n\67\38\68\u018a\n8\r8\16"+
"8\u018b\39\39\39\39\39\59\u0193\n9\39\69\u0196\n9\r9\169\u0197\3:\3:\3"+
";\3;\3<\3<\3=\3=\7=\u01a2\n=\f=\16=\u01a5\13=\3>\3>\3?\3?\3@\6@\u01ac"+
"\n@\r@\16@\u01ad\3@\3@\3A\3A\3A\3A\7A\u01b6\nA\fA\16A\u01b9\13A\3A\3A"+
"\3B\3B\3B\3B\7B\u01c1\nB\fB\16B\u01c4\13B\3B\3B\3B\3B\3B\3\u01c2\2C\3"+
"\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37"+
"\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36;\37="+
" ?!A\"C#E$G%I&K\'M(O)Q*S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66k\67m8o9"+
"q:s\2u\2w\2y;{\2}\2\177<\u0081=\u0083>\3\2\13\3\2$$\4\2DDdd\3\2\62\63"+
"\3\2\62;\5\2\62;CHch\5\2C\\aac|\6\2\62;C\\aac|\5\2\13\f\17\17\"\"\4\2"+
"\f\f\17\17\2\u01e5\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13"+
"\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2"+
"\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2"+
"!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3"+
"\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2"+
"\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E"+
"\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2"+
"\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2"+
"\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2\2k"+
"\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2\2\2\2y\3\2\2\2\2\177\3\2\2\2\2\u0081"+
"\3\2\2\2\2\u0083\3\2\2\2\3\u0085\3\2\2\2\5\u0087\3\2\2\2\7\u0089\3\2\2"+
"\2\t\u008b\3\2\2\2\13\u008d\3\2\2\2\r\u0093\3\2\2\2\17\u0095\3\2\2\2\21"+
"\u0097\3\2\2\2\23\u009a\3\2\2\2\25\u009f\3\2\2\2\27\u00a5\3\2\2\2\31\u00a8"+
"\3\2\2\2\33\u00ac\3\2\2\2\35\u00b3\3\2\2\2\37\u00b5\3\2\2\2!\u00b8\3\2"+
"\2\2#\u00bc\3\2\2\2%\u00c0\3\2\2\2\'\u00c2\3\2\2\2)\u00c4\3\2\2\2+\u00c6"+
"\3\2\2\2-\u00c8\3\2\2\2/\u00cb\3\2\2\2\61\u00ce\3\2\2\2\63\u00d0\3\2\2"+
"\2\65\u00d2\3\2\2\2\67\u00d6\3\2\2\29\u00d8\3\2\2\2;\u00da\3\2\2\2=\u00dd"+
"\3\2\2\2?\u00e0\3\2\2\2A\u00e2\3\2\2\2C\u00e5\3\2\2\2E\u00e8\3\2\2\2G"+
"\u00eb\3\2\2\2I\u00ed\3\2\2\2K\u00f0\3\2\2\2M\u00f3\3\2\2\2O\u00f6\3\2"+
"\2\2Q\u00f9\3\2\2\2S\u00fb\3\2\2\2U\u00ff\3\2\2\2W\u0102\3\2\2\2Y\u0105"+
"\3\2\2\2[\u0121\3\2\2\2]\u0123\3\2\2\2_\u0137\3\2\2\2a\u013b\3\2\2\2c"+
"\u0140\3\2\2\2e\u0147\3\2\2\2g\u0158\3\2\2\2i\u0166\3\2\2\2k\u0177\3\2"+
"\2\2m\u0186\3\2\2\2o\u0189\3\2\2\2q\u0192\3\2\2\2s\u0199\3\2\2\2u\u019b"+
"\3\2\2\2w\u019d\3\2\2\2y\u019f\3\2\2\2{\u01a6\3\2\2\2}\u01a8\3\2\2\2\177"+
"\u01ab\3\2\2\2\u0081\u01b1\3\2\2\2\u0083\u01bc\3\2\2\2\u0085\u0086\7}"+
"\2\2\u0086\4\3\2\2\2\u0087\u0088\7\177\2\2\u0088\6\3\2\2\2\u0089\u008a"+
"\7*\2\2\u008a\b\3\2\2\2\u008b\u008c\7+\2\2\u008c\n\3\2\2\2\u008d\u008e"+
"\7e\2\2\u008e\u008f\7q\2\2\u008f\u0090\7p\2\2\u0090\u0091\7u\2\2\u0091"+
"\u0092\7v\2\2\u0092\f\3\2\2\2\u0093\u0094\7?\2\2\u0094\16\3\2\2\2\u0095"+
"\u0096\7=\2\2\u0096\20\3\2\2\2\u0097\u0098\7k\2\2\u0098\u0099\7h\2\2\u0099"+
"\22\3\2\2\2\u009a\u009b\7g\2\2\u009b\u009c\7n\2\2\u009c\u009d\7u\2\2\u009d"+
"\u009e\7g\2\2\u009e\24\3\2\2\2\u009f\u00a0\7y\2\2\u00a0\u00a1\7j\2\2\u00a1"+
"\u00a2\7k\2\2\u00a2\u00a3\7n\2\2\u00a3\u00a4\7g\2\2\u00a4\26\3\2\2\2\u00a5"+
"\u00a6\7f\2\2\u00a6\u00a7\7q\2\2\u00a7\30\3\2\2\2\u00a8\u00a9\7h\2\2\u00a9"+
"\u00aa\7q\2\2\u00aa\u00ab\7t\2\2\u00ab\32\3\2\2\2\u00ac\u00ad\7t\2\2\u00ad"+
"\u00ae\7g\2\2\u00ae\u00af\7v\2\2\u00af\u00b0\7w\2\2\u00b0\u00b1\7t\2\2"+
"\u00b1\u00b2\7p\2\2\u00b2\34\3\2\2\2\u00b3\u00b4\7<\2\2\u00b4\36\3\2\2"+
"\2\u00b5\u00b6\7\60\2\2\u00b6\u00b7\7\60\2\2\u00b7 \3\2\2\2\u00b8\u00b9"+
"\7\60\2\2\u00b9\u00ba\7-\2\2\u00ba\u00bb\7\60\2\2\u00bb\"\3\2\2\2\u00bc"+
"\u00bd\7\60\2\2\u00bd\u00be\7/\2\2\u00be\u00bf\7\60\2\2\u00bf$\3\2\2\2"+
"\u00c0\u00c1\7.\2\2\u00c1&\3\2\2\2\u00c2\u00c3\7,\2\2\u00c3(\3\2\2\2\u00c4"+
"\u00c5\7]\2\2\u00c5*\3\2\2\2\u00c6\u00c7\7_\2\2\u00c7,\3\2\2\2\u00c8\u00c9"+
"\7/\2\2\u00c9\u00ca\7/\2\2\u00ca.\3\2\2\2\u00cb\u00cc\7-\2\2\u00cc\u00cd"+
"\7-\2\2\u00cd\60\3\2\2\2\u00ce\u00cf\7-\2\2\u00cf\62\3\2\2\2\u00d0\u00d1"+
"\7/\2\2\u00d1\64\3\2\2\2\u00d2\u00d3\7p\2\2\u00d3\u00d4\7q\2\2\u00d4\u00d5"+
"\7v\2\2\u00d5\66\3\2\2\2\u00d6\u00d7\7#\2\2\u00d78\3\2\2\2\u00d8\u00d9"+
"\7(\2\2\u00d9:\3\2\2\2\u00da\u00db\7@\2\2\u00db\u00dc\7@\2\2\u00dc<\3"+
"\2\2\2\u00dd\u00de\7>\2\2\u00de\u00df\7>\2\2\u00df>\3\2\2\2\u00e0\u00e1"+
"\7\61\2\2\u00e1@\3\2\2\2\u00e2\u00e3\7?\2\2\u00e3\u00e4\7?\2\2\u00e4B"+
"\3\2\2\2\u00e5\u00e6\7#\2\2\u00e6\u00e7\7?\2\2\u00e7D\3\2\2\2\u00e8\u00e9"+
"\7>\2\2\u00e9\u00ea\7@\2\2\u00eaF\3\2\2\2\u00eb\u00ec\7>\2\2\u00ecH\3"+
"\2\2\2\u00ed\u00ee\7>\2\2\u00ee\u00ef\7?\2\2\u00efJ\3\2\2\2\u00f0\u00f1"+
"\7?\2\2\u00f1\u00f2\7>\2\2\u00f2L\3\2\2\2\u00f3\u00f4\7@\2\2\u00f4\u00f5"+
"\7?\2\2\u00f5N\3\2\2\2\u00f6\u00f7\7?\2\2\u00f7\u00f8\7@\2\2\u00f8P\3"+
"\2\2\2\u00f9\u00fa\7@\2\2\u00faR\3\2\2\2\u00fb\u00fc\7c\2\2\u00fc\u00fd"+
"\7p\2\2\u00fd\u00fe\7f\2\2\u00feT\3\2\2\2\u00ff\u0100\7(\2\2\u0100\u0101"+
"\7(\2\2\u0101V\3\2\2\2\u0102\u0103\7q\2\2\u0103\u0104\7t\2\2\u0104X\3"+
"\2\2\2\u0105\u0106\7~\2\2\u0106\u0107\7~\2\2\u0107Z\3\2\2\2\u0108\u0109"+
"\7d\2\2\u0109\u010a\7{\2\2\u010a\u010b\7v\2\2\u010b\u0122\7g\2\2\u010c"+
"\u010d\7y\2\2\u010d\u010e\7q\2\2\u010e\u010f\7t\2\2\u010f\u0122\7f\2\2"+
"\u0110\u0111\7u\2\2\u0111\u0112\7v\2\2\u0112\u0113\7t\2\2\u0113\u0114"+
"\7k\2\2\u0114\u0115\7p\2\2\u0115\u0122\7i\2\2\u0116\u0117\7d\2\2\u0117"+
"\u0118\7q\2\2\u0118\u0119\7q\2\2\u0119\u011a\7n\2\2\u011a\u011b\7g\2\2"+
"\u011b\u011c\7c\2\2\u011c\u0122\7p\2\2\u011d\u011e\7x\2\2\u011e\u011f"+
"\7q\2\2\u011f\u0120\7k\2\2\u0120\u0122\7f\2\2\u0121\u0108\3\2\2\2\u0121"+
"\u010c\3\2\2\2\u0121\u0110\3\2\2\2\u0121\u0116\3\2\2\2\u0121\u011d\3\2"+
"\2\2\u0122\\\3\2\2\2\u0123\u0129\7$\2\2\u0124\u0125\7^\2\2\u0125\u0128"+
"\7$\2\2\u0126\u0128\n\2\2\2\u0127\u0124\3\2\2\2\u0127\u0126\3\2\2\2\u0128"+
"\u012b\3\2\2\2\u0129\u0127\3\2\2\2\u0129\u012a\3\2\2\2\u012a\u012c\3\2"+
"\2\2\u012b\u0129\3\2\2\2\u012c\u012d\7$\2\2\u012d^\3\2\2\2\u012e\u012f"+
"\7v\2\2\u012f\u0130\7t\2\2\u0130\u0131\7w\2\2\u0131\u0138\7g\2\2\u0132"+
"\u0133\7h\2\2\u0133\u0134\7c\2\2\u0134\u0135\7n\2\2\u0135\u0136\7u\2\2"+
"\u0136\u0138\7g\2\2\u0137\u012e\3\2\2\2\u0137\u0132\3\2\2\2\u0138`\3\2"+
"\2\2\u0139\u013c\5c\62\2\u013a\u013c\5k\66\2\u013b\u0139\3\2\2\2\u013b"+
"\u013a\3\2\2\2\u013cb\3\2\2\2\u013d\u0141\5e\63\2\u013e\u0141\5g\64\2"+
"\u013f\u0141\5i\65\2\u0140\u013d\3\2\2\2\u0140\u013e\3\2\2\2\u0140\u013f"+
"\3\2\2\2\u0141d\3\2\2\2\u0142\u0148\7\'\2\2\u0143\u0144\7\62\2\2\u0144"+
"\u0148\7d\2\2\u0145\u0146\7\62\2\2\u0146\u0148\7D\2\2\u0147\u0142\3\2"+
"\2\2\u0147\u0143\3\2\2\2\u0147\u0145\3\2\2\2\u0148\u014c\3\2\2\2\u0149"+
"\u014b\5s:\2\u014a\u0149\3\2\2\2\u014b\u014e\3\2\2\2\u014c\u014a\3\2\2"+
"\2\u014c\u014d\3\2\2\2\u014d\u014f\3\2\2\2\u014e\u014c\3\2\2\2\u014f\u0151"+
"\7\60\2\2\u0150\u0152\5s:\2\u0151\u0150\3\2\2\2\u0152\u0153\3\2\2\2\u0153"+
"\u0151\3\2\2\2\u0153\u0154\3\2\2\2\u0154f\3\2\2\2\u0155\u0157\5u;\2\u0156"+
"\u0155\3\2\2\2\u0157\u015a\3\2\2\2\u0158\u0156\3\2\2\2\u0158\u0159\3\2"+
"\2\2\u0159\u015b\3\2\2\2\u015a\u0158\3\2\2\2\u015b\u015d\7\60\2\2\u015c"+
"\u015e\5u;\2\u015d\u015c\3\2\2\2\u015e\u015f\3\2\2\2\u015f\u015d\3\2\2"+
"\2\u015f\u0160\3\2\2\2\u0160h\3\2\2\2\u0161\u0167\7&\2\2\u0162\u0163\7"+
"\62\2\2\u0163\u0167\7z\2\2\u0164\u0165\7\62\2\2\u0165\u0167\7Z\2\2\u0166"+
"\u0161\3\2\2\2\u0166\u0162\3\2\2\2\u0166\u0164\3\2\2\2\u0167\u016b\3\2"+
"\2\2\u0168\u016a\5w<\2\u0169\u0168\3\2\2\2\u016a\u016d\3\2\2\2\u016b\u0169"+
"\3\2\2\2\u016b\u016c\3\2\2\2\u016c\u016e\3\2\2\2\u016d\u016b\3\2\2\2\u016e"+
"\u0170\7\60\2\2\u016f\u0171\5w<\2\u0170\u016f\3\2\2\2\u0171\u0172\3\2"+
"\2\2\u0172\u0170\3\2\2\2\u0172\u0173\3\2\2\2\u0173j\3\2\2\2\u0174\u0178"+
"\5o8\2\u0175\u0178\5q9\2\u0176\u0178\5m\67\2\u0177\u0174\3\2\2\2\u0177"+
"\u0175\3\2\2\2\u0177\u0176\3\2\2\2\u0178l\3\2\2\2\u0179\u017a\7\62\2\2"+
"\u017a\u017c\t\3\2\2\u017b\u017d\5s:\2\u017c\u017b\3\2\2\2\u017d\u017e"+
"\3\2\2\2\u017e\u017c\3\2\2\2\u017e\u017f\3\2\2\2\u017f\u0187\3\2\2\2\u0180"+
"\u0182\7\'\2\2\u0181\u0183\5s:\2\u0182\u0181\3\2\2\2\u0183\u0184\3\2\2"+
"\2\u0184\u0182\3\2\2\2\u0184\u0185\3\2\2\2\u0185\u0187\3\2\2\2\u0186\u0179"+
"\3\2\2\2\u0186\u0180\3\2\2\2\u0187n\3\2\2\2\u0188\u018a\5u;\2\u0189\u0188"+
"\3\2\2\2\u018a\u018b\3\2\2\2\u018b\u0189\3\2\2\2\u018b\u018c\3\2\2\2\u018c"+
"p\3\2\2\2\u018d\u0193\7&\2\2\u018e\u018f\7\62\2\2\u018f\u0193\7z\2\2\u0190"+
"\u0191\7\62\2\2\u0191\u0193\7Z\2\2\u0192\u018d\3\2\2\2\u0192\u018e\3\2"+
"\2\2\u0192\u0190\3\2\2\2\u0193\u0195\3\2\2\2\u0194\u0196\5w<\2\u0195\u0194"+
"\3\2\2\2\u0196\u0197\3\2\2\2\u0197\u0195\3\2\2\2\u0197\u0198\3\2\2\2\u0198"+
"r\3\2\2\2\u0199\u019a\t\4\2\2\u019at\3\2\2\2\u019b\u019c\t\5\2\2\u019c"+
"v\3\2\2\2\u019d\u019e\t\6\2\2\u019ex\3\2\2\2\u019f\u01a3\5{>\2\u01a0\u01a2"+
"\5}?\2\u01a1\u01a0\3\2\2\2\u01a2\u01a5\3\2\2\2\u01a3\u01a1\3\2\2\2\u01a3"+
"\u01a4\3\2\2\2\u01a4z\3\2\2\2\u01a5\u01a3\3\2\2\2\u01a6\u01a7\t\7\2\2"+
"\u01a7|\3\2\2\2\u01a8\u01a9\t\b\2\2\u01a9~\3\2\2\2\u01aa\u01ac\t\t\2\2"+
"\u01ab\u01aa\3\2\2\2\u01ac\u01ad\3\2\2\2\u01ad\u01ab\3\2\2\2\u01ad\u01ae"+
"\3\2\2\2\u01ae\u01af\3\2\2\2\u01af\u01b0\b@\2\2\u01b0\u0080\3\2\2\2\u01b1"+
"\u01b2\7\61\2\2\u01b2\u01b3\7\61\2\2\u01b3\u01b7\3\2\2\2\u01b4\u01b6\n"+
"\n\2\2\u01b5\u01b4\3\2\2\2\u01b6\u01b9\3\2\2\2\u01b7\u01b5\3\2\2\2\u01b7"+
"\u01b8\3\2\2\2\u01b8\u01ba\3\2\2\2\u01b9\u01b7\3\2\2\2\u01ba\u01bb\bA"+
"\2\2\u01bb\u0082\3\2\2\2\u01bc\u01bd\7\61\2\2\u01bd\u01be\7,\2\2\u01be"+
"\u01c2\3\2\2\2\u01bf\u01c1\13\2\2\2\u01c0\u01bf\3\2\2\2\u01c1\u01c4\3"+
"\2\2\2\u01c2\u01c3\3\2\2\2\u01c2\u01c0\3\2\2\2\u01c3\u01c5\3\2\2\2\u01c4"+
"\u01c2\3\2\2\2\u01c5\u01c6\7,\2\2\u01c6\u01c7\7\61\2\2\u01c7\u01c8\3\2"+
"\2\2\u01c8\u01c9\bB\2\2\u01c9\u0084\3\2\2\2\34\2\u0121\u0127\u0129\u0137"+
"\u013b\u0140\u0147\u014c\u0153\u0158\u015f\u0166\u016b\u0172\u0177\u017e"+
"\u0184\u0186\u018b\u0192\u0197\u01a3\u01ad\u01b7\u01c2\3\b\2\2";
"\16\3\16\3\16\3\16\3\17\3\17\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\21\3"+
"\22\3\22\3\22\3\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\26\3\26\3\27\3"+
"\27\3\27\3\30\3\30\3\30\3\31\3\31\3\32\3\32\3\33\3\33\3\33\3\33\3\34\3"+
"\34\3\35\3\35\3\36\3\36\3\36\3\37\3\37\3\37\3 \3 \3!\3!\3!\3\"\3\"\3\""+
"\3#\3#\3#\3$\3$\3%\3%\3%\3&\3&\3&\3\'\3\'\3\'\3(\3(\3(\3)\3)\3*\3*\3*"+
"\3*\3+\3+\3+\3,\3,\3,\3-\3-\3-\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3."+
"\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\5.\u0124\n.\3/\3/\3/\3/\7/\u012a"+
"\n/\f/\16/\u012d\13/\3/\3/\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60"+
"\5\60\u013a\n\60\3\61\3\61\5\61\u013e\n\61\3\62\3\62\3\62\5\62\u0143\n"+
"\62\3\63\3\63\3\63\3\63\3\63\5\63\u014a\n\63\3\63\7\63\u014d\n\63\f\63"+
"\16\63\u0150\13\63\3\63\3\63\6\63\u0154\n\63\r\63\16\63\u0155\3\64\7\64"+
"\u0159\n\64\f\64\16\64\u015c\13\64\3\64\3\64\6\64\u0160\n\64\r\64\16\64"+
"\u0161\3\65\3\65\3\65\3\65\3\65\5\65\u0169\n\65\3\65\7\65\u016c\n\65\f"+
"\65\16\65\u016f\13\65\3\65\3\65\6\65\u0173\n\65\r\65\16\65\u0174\3\66"+
"\3\66\3\66\5\66\u017a\n\66\3\67\3\67\3\67\6\67\u017f\n\67\r\67\16\67\u0180"+
"\3\67\3\67\6\67\u0185\n\67\r\67\16\67\u0186\5\67\u0189\n\67\38\68\u018c"+
"\n8\r8\168\u018d\39\39\39\39\39\59\u0195\n9\39\69\u0198\n9\r9\169\u0199"+
"\3:\3:\3;\3;\3<\3<\3=\3=\7=\u01a4\n=\f=\16=\u01a7\13=\3>\3>\3?\3?\3@\6"+
"@\u01ae\n@\r@\16@\u01af\3@\3@\3A\3A\3A\3A\7A\u01b8\nA\fA\16A\u01bb\13"+
"A\3A\3A\3B\3B\3B\3B\7B\u01c3\nB\fB\16B\u01c6\13B\3B\3B\3B\3B\3B\3\u01c4"+
"\2C\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35"+
"\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36"+
";\37= ?!A\"C#E$G%I&K\'M(O)Q*S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66k\67"+
"m8o9q:s\2u\2w\2y;{\2}\2\177<\u0081=\u0083>\3\2\13\3\2$$\4\2DDdd\3\2\62"+
"\63\3\2\62;\5\2\62;CHch\5\2C\\aac|\6\2\62;C\\aac|\5\2\13\f\17\17\"\"\4"+
"\2\f\f\17\17\2\u01e7\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2"+
"\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3"+
"\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2"+
"\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2"+
"\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2"+
"\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2"+
"\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q"+
"\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2"+
"\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2"+
"\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2\2\2\2y\3\2\2\2\2\177\3\2\2\2"+
"\2\u0081\3\2\2\2\2\u0083\3\2\2\2\3\u0085\3\2\2\2\5\u0087\3\2\2\2\7\u0089"+
"\3\2\2\2\t\u008b\3\2\2\2\13\u008d\3\2\2\2\r\u0093\3\2\2\2\17\u0095\3\2"+
"\2\2\21\u0097\3\2\2\2\23\u009a\3\2\2\2\25\u009f\3\2\2\2\27\u00a5\3\2\2"+
"\2\31\u00a8\3\2\2\2\33\u00ac\3\2\2\2\35\u00b3\3\2\2\2\37\u00b5\3\2\2\2"+
"!\u00b8\3\2\2\2#\u00bd\3\2\2\2%\u00c2\3\2\2\2\'\u00c4\3\2\2\2)\u00c6\3"+
"\2\2\2+\u00c8\3\2\2\2-\u00ca\3\2\2\2/\u00cd\3\2\2\2\61\u00d0\3\2\2\2\63"+
"\u00d2\3\2\2\2\65\u00d4\3\2\2\2\67\u00d8\3\2\2\29\u00da\3\2\2\2;\u00dc"+
"\3\2\2\2=\u00df\3\2\2\2?\u00e2\3\2\2\2A\u00e4\3\2\2\2C\u00e7\3\2\2\2E"+
"\u00ea\3\2\2\2G\u00ed\3\2\2\2I\u00ef\3\2\2\2K\u00f2\3\2\2\2M\u00f5\3\2"+
"\2\2O\u00f8\3\2\2\2Q\u00fb\3\2\2\2S\u00fd\3\2\2\2U\u0101\3\2\2\2W\u0104"+
"\3\2\2\2Y\u0107\3\2\2\2[\u0123\3\2\2\2]\u0125\3\2\2\2_\u0139\3\2\2\2a"+
"\u013d\3\2\2\2c\u0142\3\2\2\2e\u0149\3\2\2\2g\u015a\3\2\2\2i\u0168\3\2"+
"\2\2k\u0179\3\2\2\2m\u0188\3\2\2\2o\u018b\3\2\2\2q\u0194\3\2\2\2s\u019b"+
"\3\2\2\2u\u019d\3\2\2\2w\u019f\3\2\2\2y\u01a1\3\2\2\2{\u01a8\3\2\2\2}"+
"\u01aa\3\2\2\2\177\u01ad\3\2\2\2\u0081\u01b3\3\2\2\2\u0083\u01be\3\2\2"+
"\2\u0085\u0086\7}\2\2\u0086\4\3\2\2\2\u0087\u0088\7\177\2\2\u0088\6\3"+
"\2\2\2\u0089\u008a\7*\2\2\u008a\b\3\2\2\2\u008b\u008c\7+\2\2\u008c\n\3"+
"\2\2\2\u008d\u008e\7e\2\2\u008e\u008f\7q\2\2\u008f\u0090\7p\2\2\u0090"+
"\u0091\7u\2\2\u0091\u0092\7v\2\2\u0092\f\3\2\2\2\u0093\u0094\7?\2\2\u0094"+
"\16\3\2\2\2\u0095\u0096\7=\2\2\u0096\20\3\2\2\2\u0097\u0098\7k\2\2\u0098"+
"\u0099\7h\2\2\u0099\22\3\2\2\2\u009a\u009b\7g\2\2\u009b\u009c\7n\2\2\u009c"+
"\u009d\7u\2\2\u009d\u009e\7g\2\2\u009e\24\3\2\2\2\u009f\u00a0\7y\2\2\u00a0"+
"\u00a1\7j\2\2\u00a1\u00a2\7k\2\2\u00a2\u00a3\7n\2\2\u00a3\u00a4\7g\2\2"+
"\u00a4\26\3\2\2\2\u00a5\u00a6\7f\2\2\u00a6\u00a7\7q\2\2\u00a7\30\3\2\2"+
"\2\u00a8\u00a9\7h\2\2\u00a9\u00aa\7q\2\2\u00aa\u00ab\7t\2\2\u00ab\32\3"+
"\2\2\2\u00ac\u00ad\7t\2\2\u00ad\u00ae\7g\2\2\u00ae\u00af\7v\2\2\u00af"+
"\u00b0\7w\2\2\u00b0\u00b1\7t\2\2\u00b1\u00b2\7p\2\2\u00b2\34\3\2\2\2\u00b3"+
"\u00b4\7<\2\2\u00b4\36\3\2\2\2\u00b5\u00b6\7\60\2\2\u00b6\u00b7\7\60\2"+
"\2\u00b7 \3\2\2\2\u00b8\u00b9\7\60\2\2\u00b9\u00ba\7-\2\2\u00ba\u00bb"+
"\7-\2\2\u00bb\u00bc\7\60\2\2\u00bc\"\3\2\2\2\u00bd\u00be\7\60\2\2\u00be"+
"\u00bf\7/\2\2\u00bf\u00c0\7/\2\2\u00c0\u00c1\7\60\2\2\u00c1$\3\2\2\2\u00c2"+
"\u00c3\7.\2\2\u00c3&\3\2\2\2\u00c4\u00c5\7,\2\2\u00c5(\3\2\2\2\u00c6\u00c7"+
"\7]\2\2\u00c7*\3\2\2\2\u00c8\u00c9\7_\2\2\u00c9,\3\2\2\2\u00ca\u00cb\7"+
"/\2\2\u00cb\u00cc\7/\2\2\u00cc.\3\2\2\2\u00cd\u00ce\7-\2\2\u00ce\u00cf"+
"\7-\2\2\u00cf\60\3\2\2\2\u00d0\u00d1\7-\2\2\u00d1\62\3\2\2\2\u00d2\u00d3"+
"\7/\2\2\u00d3\64\3\2\2\2\u00d4\u00d5\7p\2\2\u00d5\u00d6\7q\2\2\u00d6\u00d7"+
"\7v\2\2\u00d7\66\3\2\2\2\u00d8\u00d9\7#\2\2\u00d98\3\2\2\2\u00da\u00db"+
"\7(\2\2\u00db:\3\2\2\2\u00dc\u00dd\7@\2\2\u00dd\u00de\7@\2\2\u00de<\3"+
"\2\2\2\u00df\u00e0\7>\2\2\u00e0\u00e1\7>\2\2\u00e1>\3\2\2\2\u00e2\u00e3"+
"\7\61\2\2\u00e3@\3\2\2\2\u00e4\u00e5\7?\2\2\u00e5\u00e6\7?\2\2\u00e6B"+
"\3\2\2\2\u00e7\u00e8\7#\2\2\u00e8\u00e9\7?\2\2\u00e9D\3\2\2\2\u00ea\u00eb"+
"\7>\2\2\u00eb\u00ec\7@\2\2\u00ecF\3\2\2\2\u00ed\u00ee\7>\2\2\u00eeH\3"+
"\2\2\2\u00ef\u00f0\7>\2\2\u00f0\u00f1\7?\2\2\u00f1J\3\2\2\2\u00f2\u00f3"+
"\7?\2\2\u00f3\u00f4\7>\2\2\u00f4L\3\2\2\2\u00f5\u00f6\7@\2\2\u00f6\u00f7"+
"\7?\2\2\u00f7N\3\2\2\2\u00f8\u00f9\7?\2\2\u00f9\u00fa\7@\2\2\u00faP\3"+
"\2\2\2\u00fb\u00fc\7@\2\2\u00fcR\3\2\2\2\u00fd\u00fe\7c\2\2\u00fe\u00ff"+
"\7p\2\2\u00ff\u0100\7f\2\2\u0100T\3\2\2\2\u0101\u0102\7(\2\2\u0102\u0103"+
"\7(\2\2\u0103V\3\2\2\2\u0104\u0105\7q\2\2\u0105\u0106\7t\2\2\u0106X\3"+
"\2\2\2\u0107\u0108\7~\2\2\u0108\u0109\7~\2\2\u0109Z\3\2\2\2\u010a\u010b"+
"\7d\2\2\u010b\u010c\7{\2\2\u010c\u010d\7v\2\2\u010d\u0124\7g\2\2\u010e"+
"\u010f\7y\2\2\u010f\u0110\7q\2\2\u0110\u0111\7t\2\2\u0111\u0124\7f\2\2"+
"\u0112\u0113\7u\2\2\u0113\u0114\7v\2\2\u0114\u0115\7t\2\2\u0115\u0116"+
"\7k\2\2\u0116\u0117\7p\2\2\u0117\u0124\7i\2\2\u0118\u0119\7d\2\2\u0119"+
"\u011a\7q\2\2\u011a\u011b\7q\2\2\u011b\u011c\7n\2\2\u011c\u011d\7g\2\2"+
"\u011d\u011e\7c\2\2\u011e\u0124\7p\2\2\u011f\u0120\7x\2\2\u0120\u0121"+
"\7q\2\2\u0121\u0122\7k\2\2\u0122\u0124\7f\2\2\u0123\u010a\3\2\2\2\u0123"+
"\u010e\3\2\2\2\u0123\u0112\3\2\2\2\u0123\u0118\3\2\2\2\u0123\u011f\3\2"+
"\2\2\u0124\\\3\2\2\2\u0125\u012b\7$\2\2\u0126\u0127\7^\2\2\u0127\u012a"+
"\7$\2\2\u0128\u012a\n\2\2\2\u0129\u0126\3\2\2\2\u0129\u0128\3\2\2\2\u012a"+
"\u012d\3\2\2\2\u012b\u0129\3\2\2\2\u012b\u012c\3\2\2\2\u012c\u012e\3\2"+
"\2\2\u012d\u012b\3\2\2\2\u012e\u012f\7$\2\2\u012f^\3\2\2\2\u0130\u0131"+
"\7v\2\2\u0131\u0132\7t\2\2\u0132\u0133\7w\2\2\u0133\u013a\7g\2\2\u0134"+
"\u0135\7h\2\2\u0135\u0136\7c\2\2\u0136\u0137\7n\2\2\u0137\u0138\7u\2\2"+
"\u0138\u013a\7g\2\2\u0139\u0130\3\2\2\2\u0139\u0134\3\2\2\2\u013a`\3\2"+
"\2\2\u013b\u013e\5c\62\2\u013c\u013e\5k\66\2\u013d\u013b\3\2\2\2\u013d"+
"\u013c\3\2\2\2\u013eb\3\2\2\2\u013f\u0143\5e\63\2\u0140\u0143\5g\64\2"+
"\u0141\u0143\5i\65\2\u0142\u013f\3\2\2\2\u0142\u0140\3\2\2\2\u0142\u0141"+
"\3\2\2\2\u0143d\3\2\2\2\u0144\u014a\7\'\2\2\u0145\u0146\7\62\2\2\u0146"+
"\u014a\7d\2\2\u0147\u0148\7\62\2\2\u0148\u014a\7D\2\2\u0149\u0144\3\2"+
"\2\2\u0149\u0145\3\2\2\2\u0149\u0147\3\2\2\2\u014a\u014e\3\2\2\2\u014b"+
"\u014d\5s:\2\u014c\u014b\3\2\2\2\u014d\u0150\3\2\2\2\u014e\u014c\3\2\2"+
"\2\u014e\u014f\3\2\2\2\u014f\u0151\3\2\2\2\u0150\u014e\3\2\2\2\u0151\u0153"+
"\7\60\2\2\u0152\u0154\5s:\2\u0153\u0152\3\2\2\2\u0154\u0155\3\2\2\2\u0155"+
"\u0153\3\2\2\2\u0155\u0156\3\2\2\2\u0156f\3\2\2\2\u0157\u0159\5u;\2\u0158"+
"\u0157\3\2\2\2\u0159\u015c\3\2\2\2\u015a\u0158\3\2\2\2\u015a\u015b\3\2"+
"\2\2\u015b\u015d\3\2\2\2\u015c\u015a\3\2\2\2\u015d\u015f\7\60\2\2\u015e"+
"\u0160\5u;\2\u015f\u015e\3\2\2\2\u0160\u0161\3\2\2\2\u0161\u015f\3\2\2"+
"\2\u0161\u0162\3\2\2\2\u0162h\3\2\2\2\u0163\u0169\7&\2\2\u0164\u0165\7"+
"\62\2\2\u0165\u0169\7z\2\2\u0166\u0167\7\62\2\2\u0167\u0169\7Z\2\2\u0168"+
"\u0163\3\2\2\2\u0168\u0164\3\2\2\2\u0168\u0166\3\2\2\2\u0169\u016d\3\2"+
"\2\2\u016a\u016c\5w<\2\u016b\u016a\3\2\2\2\u016c\u016f\3\2\2\2\u016d\u016b"+
"\3\2\2\2\u016d\u016e\3\2\2\2\u016e\u0170\3\2\2\2\u016f\u016d\3\2\2\2\u0170"+
"\u0172\7\60\2\2\u0171\u0173\5w<\2\u0172\u0171\3\2\2\2\u0173\u0174\3\2"+
"\2\2\u0174\u0172\3\2\2\2\u0174\u0175\3\2\2\2\u0175j\3\2\2\2\u0176\u017a"+
"\5o8\2\u0177\u017a\5q9\2\u0178\u017a\5m\67\2\u0179\u0176\3\2\2\2\u0179"+
"\u0177\3\2\2\2\u0179\u0178\3\2\2\2\u017al\3\2\2\2\u017b\u017c\7\62\2\2"+
"\u017c\u017e\t\3\2\2\u017d\u017f\5s:\2\u017e\u017d\3\2\2\2\u017f\u0180"+
"\3\2\2\2\u0180\u017e\3\2\2\2\u0180\u0181\3\2\2\2\u0181\u0189\3\2\2\2\u0182"+
"\u0184\7\'\2\2\u0183\u0185\5s:\2\u0184\u0183\3\2\2\2\u0185\u0186\3\2\2"+
"\2\u0186\u0184\3\2\2\2\u0186\u0187\3\2\2\2\u0187\u0189\3\2\2\2\u0188\u017b"+
"\3\2\2\2\u0188\u0182\3\2\2\2\u0189n\3\2\2\2\u018a\u018c\5u;\2\u018b\u018a"+
"\3\2\2\2\u018c\u018d\3\2\2\2\u018d\u018b\3\2\2\2\u018d\u018e\3\2\2\2\u018e"+
"p\3\2\2\2\u018f\u0195\7&\2\2\u0190\u0191\7\62\2\2\u0191\u0195\7z\2\2\u0192"+
"\u0193\7\62\2\2\u0193\u0195\7Z\2\2\u0194\u018f\3\2\2\2\u0194\u0190\3\2"+
"\2\2\u0194\u0192\3\2\2\2\u0195\u0197\3\2\2\2\u0196\u0198\5w<\2\u0197\u0196"+
"\3\2\2\2\u0198\u0199\3\2\2\2\u0199\u0197\3\2\2\2\u0199\u019a\3\2\2\2\u019a"+
"r\3\2\2\2\u019b\u019c\t\4\2\2\u019ct\3\2\2\2\u019d\u019e\t\5\2\2\u019e"+
"v\3\2\2\2\u019f\u01a0\t\6\2\2\u01a0x\3\2\2\2\u01a1\u01a5\5{>\2\u01a2\u01a4"+
"\5}?\2\u01a3\u01a2\3\2\2\2\u01a4\u01a7\3\2\2\2\u01a5\u01a3\3\2\2\2\u01a5"+
"\u01a6\3\2\2\2\u01a6z\3\2\2\2\u01a7\u01a5\3\2\2\2\u01a8\u01a9\t\7\2\2"+
"\u01a9|\3\2\2\2\u01aa\u01ab\t\b\2\2\u01ab~\3\2\2\2\u01ac\u01ae\t\t\2\2"+
"\u01ad\u01ac\3\2\2\2\u01ae\u01af\3\2\2\2\u01af\u01ad\3\2\2\2\u01af\u01b0"+
"\3\2\2\2\u01b0\u01b1\3\2\2\2\u01b1\u01b2\b@\2\2\u01b2\u0080\3\2\2\2\u01b3"+
"\u01b4\7\61\2\2\u01b4\u01b5\7\61\2\2\u01b5\u01b9\3\2\2\2\u01b6\u01b8\n"+
"\n\2\2\u01b7\u01b6\3\2\2\2\u01b8\u01bb\3\2\2\2\u01b9\u01b7\3\2\2\2\u01b9"+
"\u01ba\3\2\2\2\u01ba\u01bc\3\2\2\2\u01bb\u01b9\3\2\2\2\u01bc\u01bd\bA"+
"\2\2\u01bd\u0082\3\2\2\2\u01be\u01bf\7\61\2\2\u01bf\u01c0\7,\2\2\u01c0"+
"\u01c4\3\2\2\2\u01c1\u01c3\13\2\2\2\u01c2\u01c1\3\2\2\2\u01c3\u01c6\3"+
"\2\2\2\u01c4\u01c5\3\2\2\2\u01c4\u01c2\3\2\2\2\u01c5\u01c7\3\2\2\2\u01c6"+
"\u01c4\3\2\2\2\u01c7\u01c8\7,\2\2\u01c8\u01c9\7\61\2\2\u01c9\u01ca\3\2"+
"\2\2\u01ca\u01cb\bB\2\2\u01cb\u0084\3\2\2\2\34\2\u0123\u0129\u012b\u0139"+
"\u013d\u0142\u0149\u014e\u0155\u015a\u0161\u0168\u016d\u0174\u0179\u0180"+
"\u0186\u0188\u018d\u0194\u0199\u01a5\u01af\u01b9\u01c4\3\b\2\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {

View File

@ -73,8 +73,8 @@ COMMENT_BLOCK=60
'return'=13
':'=14
'..'=15
'.+.'=16
'.-.'=17
'.++.'=16
'.--.'=17
','=18
'*'=19
'['=20

View File

@ -38,7 +38,7 @@ public class KickCParser extends Parser {
private static final String[] _LITERAL_NAMES = {
null, "'{'", "'}'", "'('", "')'", "'const'", "'='", "';'", "'if'", "'else'",
"'while'", "'do'", "'for'", "'return'", "':'", "'..'", "'.+.'", "'.-.'",
"'while'", "'do'", "'for'", "'return'", "':'", "'..'", "'.++.'", "'.--.'",
"','", "'*'", "'['", "']'", "'--'", "'++'", "'+'", "'-'", "'not'", "'!'",
"'&'", "'>>'", "'<<'", "'/'", "'=='", "'!='", "'<>'", "'<'", "'<='", "'=<'",
"'>='", "'=>'", "'>'", "'and'", "'&&'", "'or'", "'||'"

View File

@ -151,6 +151,118 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
return null;
}
@Override
public Object visitStmtFor(KickCParser.StmtForContext ctx) {
this.visit(ctx.forIteration());
return null;
}
@Override
public Object visitForDecl(KickCParser.ForDeclContext ctx) {
return super.visitForDecl(ctx);
}
@Override
public Object visitForClassic(KickCParser.ForClassicContext ctx) {
KickCParser.StmtForContext stmtForCtx = (KickCParser.StmtForContext) ctx.getParent();
KickCParser.ForDeclContext forDeclCtx = (KickCParser.ForDeclContext) stmtForCtx.forDeclaration();
// Create and assign declared loop variable
String varName = forDeclCtx.NAME().getText();
Variable lValue;
if(forDeclCtx.typeDecl()!=null) {
SymbolType type = (SymbolType) visit(forDeclCtx.typeDecl());
lValue = getCurrentSymbols().addVariable(varName, type);
} else {
lValue = getCurrentSymbols().getVariable(varName);
}
KickCParser.InitializerContext initializer = forDeclCtx.initializer();
if (initializer != null) {
addInitialAssignment(initializer, lValue);
}
// Add label
Label repeatLabel = getCurrentSymbols().addLabelIntermediate();
StatementLabel repeatTarget = new StatementLabel(repeatLabel.getRef());
sequence.addStatement(repeatTarget);
// Add body
if (stmtForCtx.stmt() != null) {
this.visit(stmtForCtx.stmt());
}
// Add increment
PrePostModifierHandler.addPreModifiers(this, ctx.expr(1));
this.visit(ctx.expr(1));
PrePostModifierHandler.addPostModifiers(this, ctx.expr(1));
// Add condition
PrePostModifierHandler.addPreModifiers(this, ctx.expr(0));
RValue rValue = (RValue) this.visit(ctx.expr(0));
PrePostModifierHandler.addPostModifiers(this, ctx.expr(0));
// Add jump if condition was met
Statement doJmpStmt = new StatementConditionalJump(rValue, repeatLabel.getRef());
sequence.addStatement(doJmpStmt);
return null;
}
@Override
public Object visitForRange(KickCParser.ForRangeContext ctx) {
KickCParser.StmtForContext stmtForCtx = (KickCParser.StmtForContext) ctx.getParent();
KickCParser.ForDeclContext forDeclCtx = (KickCParser.ForDeclContext) stmtForCtx.forDeclaration();
// Create declared loop variable
String varName = forDeclCtx.NAME().getText();
Variable lValue;
if(forDeclCtx.typeDecl()!=null) {
SymbolType type = (SymbolType) visit(forDeclCtx.typeDecl());
lValue = getCurrentSymbols().addVariable(varName, type);
} else {
lValue = getCurrentSymbols().getVariable(varName);
}
String rangeOp = ((TerminalNode) ctx.getChild(2)).getSymbol().getText();
KickCParser.ExprContext rangeFirstCtx = ctx.expr(0);
KickCParser.ExprContext rangeLastCtx = ctx.expr(1);
// If iteration direction is not explicit - find it automatically by evaluating first/last as constants
if(rangeOp.equals("..")) {
ConstantInteger rangeFirst = (ConstantInteger) ParseTreeConstantEvaluator.evaluate(rangeFirstCtx);
ConstantInteger rangeLast = (ConstantInteger) ParseTreeConstantEvaluator.evaluate(rangeLastCtx);
if(rangeFirst.getNumber()<rangeLast.getNumber()) {
rangeOp = ".++.";
} else {
rangeOp = ".--.";
}
}
// Assign loop variable with first value
PrePostModifierHandler.addPreModifiers(this, rangeFirstCtx);
RValue rValue = (RValue) visit(rangeFirstCtx);
Statement stmtInit = new StatementAssignment(lValue, rValue);
sequence.addStatement(stmtInit);
PrePostModifierHandler.addPostModifiers(this, rangeFirstCtx);
// Add label
Label repeatLabel = getCurrentSymbols().addLabelIntermediate();
StatementLabel repeatTarget = new StatementLabel(repeatLabel.getRef());
sequence.addStatement(repeatTarget);
// Add body
if (stmtForCtx.stmt() != null) {
this.visit(stmtForCtx.stmt());
}
// Add increment
if(rangeOp.equals(".--.")) {
Statement stmtInc = new StatementAssignment(lValue.getRef(), new Operator("--"), lValue.getRef());
sequence.addStatement(stmtInc);
} else {
Statement stmtInc = new StatementAssignment(lValue.getRef(), new Operator("++"), lValue.getRef());
sequence.addStatement(stmtInc);
}
// Add condition
PrePostModifierHandler.addPreModifiers(this, rangeLastCtx);
RValue rValueLast = (RValue) this.visit(rangeLastCtx);
PrePostModifierHandler.addPostModifiers(this, rangeLastCtx);
VariableIntermediate tmpVar = getCurrentSymbols().addVariableIntermediate();
VariableRef tmpVarRef = tmpVar.getRef();
Statement stmtTmpVar = new StatementAssignment(tmpVarRef, lValue.getRef(), new Operator("!="), rValueLast);
sequence.addStatement(stmtTmpVar);
// Add jump if condition was met
Statement doJmpStmt = new StatementConditionalJump(tmpVarRef, repeatLabel.getRef());
sequence.addStatement(doJmpStmt);
return null;
}
@Override
public Void visitStmtFunction(KickCParser.StmtFunctionContext ctx) {
SymbolType type = (SymbolType) visit(ctx.typeDecl());
@ -223,17 +335,23 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
program.getLog().append("Const!" + ctx.getText());
}
SymbolType type = (SymbolType) visit(ctx.typeDecl());
VariableUnversioned lValue = getCurrentSymbols().addVariable(ctx.NAME().getText(), type);
if (ctx.initializer() != null) {
PrePostModifierHandler.addPreModifiers(this, ctx.initializer());
RValue rValue = (RValue) visit(ctx.initializer());
Statement stmt = new StatementAssignment(lValue, rValue);
sequence.addStatement(stmt);
PrePostModifierHandler.addPostModifiers(this, ctx.initializer());
String varName = ctx.NAME().getText();
KickCParser.InitializerContext initializer = ctx.initializer();
VariableUnversioned lValue = getCurrentSymbols().addVariable(varName, type);
if (initializer != null) {
addInitialAssignment(initializer, lValue);
}
return null;
}
private void addInitialAssignment(KickCParser.InitializerContext initializer, Variable lValue) {
PrePostModifierHandler.addPreModifiers(this, initializer);
RValue rValue = (RValue) visit(initializer);
Statement stmt = new StatementAssignment(lValue, rValue);
sequence.addStatement(stmt);
PrePostModifierHandler.addPostModifiers(this, initializer);
}
@Override
public Void visitStmtAssignment(KickCParser.StmtAssignmentContext ctx) {
PrePostModifierHandler.addPreModifiers(this, ctx);

View File

@ -88,6 +88,14 @@ public class TestCompilationOutput extends TestCase {
compileAndCompare("ifmin");
}
public void testForClassicMin() throws IOException, URISyntaxException {
compileAndCompare("forclassicmin");
}
public void testForRangeMin() throws IOException, URISyntaxException {
compileAndCompare("forrangemin");
}
public void testUseUninitialized() throws IOException, URISyntaxException {
String filename = "useuninitialized";
compileAndCompare(filename);

View File

@ -0,0 +1,12 @@
// Minimal classic for() loop
byte* SCREEN = $0400;
void main() {
for(byte i=0; i!=100; i++) {
SCREEN[i] = i;
}
}
main();

View File

@ -0,0 +1,15 @@
// Minimal range based for() loop
byte* SCREEN = $0400;
void main() {
byte j;
for(byte i : 100..1) {
for(j : 0.++.i) {
SCREEN[i] = j;
}
}
}
main();

View File

@ -0,0 +1,11 @@
jsr main
main: {
ldx #$0
b1:
txa
sta $400,x
inx
cpx #$64
bne b1
rts
}

View File

@ -0,0 +1,17 @@
@begin: scope:[] from
to:@1
@1: scope:[] from @begin
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ]
[2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@1
[5] return [ ]
to:@return

View File

@ -0,0 +1,674 @@
// Minimal classic for() loop
byte* SCREEN = $0400;
void main() {
for(byte i=0; i!=100; i++) {
SCREEN[i] = i;
}
}
main();
Adding pre/post-modifier (byte) main::i ← ++ (byte) main::i
PROGRAM
(byte*) SCREEN ← (word) 1024
proc (void()) main()
(byte) main::i ← (byte) 0
main::@1:
*((byte*) SCREEN + (byte) main::i) ← (byte) main::i
(byte) main::i ← ++ (byte) main::i
(boolean~) main::$0 ← (byte) main::i != (byte) 100
if((boolean~) main::$0) goto main::@1
main::@return:
return
endproc // main()
(void~) $0 ← call main
SYMBOLS
(void~) $0
(byte*) SCREEN
(void()) main()
(boolean~) main::$0
(label) main::@1
(label) main::@return
(byte) main::i
INITIAL CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) SCREEN ← (word) 1024
to:@1
main: scope:[main] from
(byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@1
*((byte*) SCREEN + (byte) main::i) ← (byte) main::i
(byte) main::i ← ++ (byte) main::i
(boolean~) main::$0 ← (byte) main::i != (byte) 100
if((boolean~) main::$0) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
to:main::@return
main::@return: scope:[main] from main::@2
return
to:@return
@1: scope:[] from @begin
(void~) $0 ← call main
to:@end
@end: scope:[] from @1
Removing empty block main::@2
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) SCREEN ← (word) 1024
to:@1
main: scope:[main] from
(byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@1
*((byte*) SCREEN + (byte) main::i) ← (byte) main::i
(byte) main::i ← ++ (byte) main::i
(boolean~) main::$0 ← (byte) main::i != (byte) 100
if((boolean~) main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
(void~) $0 ← call main
to:@end
@end: scope:[] from @1
PROCEDURE MODIFY VARIABLE ANALYSIS
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
@begin: scope:[] from
(byte*) SCREEN ← (word) 1024
to:@1
main: scope:[main] from @1
(byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@1
*((byte*) SCREEN + (byte) main::i) ← (byte) main::i
(byte) main::i ← ++ (byte) main::i
(boolean~) main::$0 ← (byte) main::i != (byte) 100
if((boolean~) main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte*) SCREEN#0 ← (word) 1024
to:@1
main: scope:[main] from @1
(byte*) SCREEN#2 ← phi( @1/(byte*) SCREEN#3 )
(byte) main::i#0 ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#2 main::@1/(byte*) SCREEN#1 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) main::i#2
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte) 100
if((boolean~) main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
(byte*) SCREEN#3 ← phi( @begin/(byte*) SCREEN#0 )
call main param-assignment
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
@begin: scope:[] from
(byte*) SCREEN#0 ← (word) 1024
to:@1
main: scope:[main] from @1
(byte*) SCREEN#2 ← phi( @1/(byte*) SCREEN#3 )
(byte) main::i#0 ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#2 main::@1/(byte*) SCREEN#1 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) main::i#2
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte) 100
if((boolean~) main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
(byte*) SCREEN#3 ← phi( @begin/(byte*) SCREEN#0 )
call main param-assignment
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Culled Empty Block (label) @2
Succesful SSA optimization Pass2CullEmptyBlocks
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) SCREEN#0 ← (word) 1024
to:@1
main: scope:[main] from @1
(byte*) SCREEN#2 ← phi( @1/(byte*) SCREEN#3 )
(byte) main::i#0 ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#2 main::@1/(byte*) SCREEN#1 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) main::i#2
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte) 100
if((boolean~) main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
(byte*) SCREEN#3 ← phi( @begin/(byte*) SCREEN#0 )
call main param-assignment
to:@end
@end: scope:[] from @1
Constant (byte*) SCREEN#0 (word) 1024
Constant (byte) main::i#0 (byte) 0
Succesful SSA optimization Pass2ConstantPropagation
CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from @1
(byte*) SCREEN#2 ← phi( @1/(byte*) SCREEN#3 )
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#2 main::@1/(byte*) SCREEN#1 )
(byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) main::i#2
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte) 100
if((boolean~) main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
(byte*) SCREEN#3 ← phi( @begin/(word) 1024 )
call main param-assignment
to:@end
@end: scope:[] from @1
Alias (byte*) SCREEN#2 = (byte*) SCREEN#3
Succesful SSA optimization Pass2AliasElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#2 main::@1/(byte*) SCREEN#1 )
(byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) main::i#2
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte) 100
if((boolean~) main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
(byte*) SCREEN#2 ← phi( @begin/(word) 1024 )
call main param-assignment
to:@end
@end: scope:[] from @1
Redundant Phi (byte*) SCREEN#2 (word) 1024
Succesful SSA optimization Pass2RedundantPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(word) 1024 main::@1/(byte*) SCREEN#1 )
(byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) main::i#2
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte) 100
if((boolean~) main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
Self Phi Eliminated (byte*) SCREEN#1
Succesful SSA optimization Pass2SelfPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(word) 1024 )
(byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) main::i#2
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte) 100
if((boolean~) main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
Simple Condition (boolean~) main::$0 if((byte) main::i#1!=(byte) 100) goto main::@1
Succesful SSA optimization Pass2ConditionalJumpSimplification
CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(word) 1024 )
(byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) main::i#2
(byte) main::i#1 ← ++ (byte) main::i#2
if((byte) main::i#1!=(byte) 100) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
Constant (byte*) SCREEN#1 (word) 1024
Succesful SSA optimization Pass2ConstantPropagation
CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
*((word) 1024 + (byte) main::i#2) ← (byte) main::i#2
(byte) main::i#1 ← ++ (byte) main::i#2
if((byte) main::i#1!=(byte) 100) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
Multiple usages for variable. Not optimizing sub-constant (byte) main::i#2
Multiple usages for variable. Not optimizing sub-constant (byte) main::i#2
Block Sequence Planned @begin @1 @end main main::@1 main::@return
Added new block during phi lifting main::@3(between main::@1 and main::@1)
Block Sequence Planned @begin @1 @end main main::@1 main::@return main::@3
CONTROL FLOW GRAPH - PHI LIFTED
@begin: scope:[] from
to:@1
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@3
(byte) main::i#2 ← phi( main/(byte) 0 main::@3/(byte~) main::i#3 )
*((word) 1024 + (byte) main::i#2) ← (byte) main::i#2
(byte) main::i#1 ← ++ (byte) main::i#2
if((byte) main::i#1!=(byte) 100) goto main::@3
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
main::@3: scope:[main] from main::@1
(byte~) main::i#3 ← (byte) main::i#1
to:main::@1
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
@begin: scope:[] from
to:@1
@1: scope:[] from @begin
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@3
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@3/(byte~) main::i#3 ) [ main::i#2 ]
[2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1!=(byte) 100) goto main::@3 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@1
[5] return [ ]
to:@return
main::@3: scope:[main] from main::@1
[6] (byte~) main::i#3 ← (byte) main::i#1 [ main::i#3 ]
to:main::@1
Created 1 initial phi equivalence classes
Coalesced [6] main::i#3 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) main::@3
Block Sequence Planned @begin @1 @end main main::@1 main::@return
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
to:@1
@1: scope:[] from @begin
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ]
[2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@1
[5] return [ ]
to:@return
CALL GRAPH
Calls in [] to 0:main
DOMINATORS
@begin dominated by @begin
@1 dominated by @1 @begin
@end dominated by @1 @end @begin
main dominated by @1 @begin main
main::@1 dominated by @1 @begin main::@1 main
main::@return dominated by @1 main::@return @begin main::@1 main
Found back edge: Loop head: main::@1 tails: main::@1 blocks: null
Populated: Loop head: main::@1 tails: main::@1 blocks: main::@1
NATURAL LOOPS
Loop head: main::@1 tails: main::@1 blocks: main::@1
Found 0 loops in scope []
Found 1 loops in scope [main]
Loop head: main::@1 tails: main::@1 blocks: main::@1
NATURAL LOOPS WITH DEPTH
Loop head: main::@1 tails: main::@1 blocks: main::@1 depth: 1
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 22.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
Allocated zp byte:2 to zp byte:2 [ main::i#2 main::i#1 ]
INITIAL ASM
//SEG0 @begin
bbegin:
jmp b1
//SEG1 @1
b1:
//SEG2 [0] call main param-assignment [ ]
jsr main
jmp bend
//SEG3 @end
bend:
//SEG4 main
main: {
//SEG5 [1] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta $2
jmp b1
//SEG7 [1] phi from main::@1 to main::@1
b1_from_b1:
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
//SEG9 main::@1
b1:
//SEG10 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby1
ldx $2
txa
sta $400,x
//SEG11 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1
inc $2
//SEG12 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- zpby1_neq_coby1_then_la1
lda $2
cmp #$64
bne b1_from_b1
jmp breturn
//SEG13 main::@return
breturn:
//SEG14 [5] return [ ]
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp byte:2 [ main::i#2 main::i#1 ] : zp byte:2 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 38.5: zp byte:2 [ main::i#2 main::i#1 ]
Uplift Scope []
Uplifting [main] best 290 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 290 combination
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
ASSEMBLER
//SEG0 @begin
bbegin:
//SEG1 @1
b1:
//SEG2 [0] call main param-assignment [ ]
jsr main
//SEG3 @end
bend:
//SEG4 main
main: {
//SEG5 [1] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG7 [1] phi from main::@1 to main::@1
b1_from_b1:
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
b1:
//SEG10 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG11 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG12 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
cpx #$64
bne b1_from_b1
//SEG13 main::@return
breturn:
//SEG14 [5] return [ ]
rts
}
Replacing label b1_from_b1 with b1
Removing instruction bbegin:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
//SEG0 @begin
//SEG1 @1
b1:
//SEG2 [0] call main param-assignment [ ]
jsr main
//SEG3 @end
bend:
//SEG4 main
main: {
//SEG5 [1] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG7 [1] phi from main::@1 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
b1:
//SEG10 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG11 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG12 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
cpx #$64
bne b1
//SEG13 main::@return
breturn:
//SEG14 [5] return [ ]
rts
}
Removing instruction b1:
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
ASSEMBLER
//SEG0 @begin
//SEG1 @1
//SEG2 [0] call main param-assignment [ ]
jsr main
//SEG3 @end
//SEG4 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG7 [1] phi from main::@1 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
b1:
//SEG10 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG11 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG12 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
cpx #$64
bne b1
//SEG13 main::@return
//SEG14 [5] return [ ]
rts
}
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
ASSEMBLER
//SEG0 @begin
//SEG1 @1
//SEG2 [0] call main param-assignment [ ]
jsr main
//SEG3 @end
//SEG4 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
//SEG7 [1] phi from main::@1 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
b1:
//SEG10 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG11 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG12 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
cpx #$64
bne b1
//SEG13 main::@return
//SEG14 [5] return [ ]
rts
}
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(void()) main()
(label) main::@1
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 22.0
reg byte x [ main::i#2 main::i#1 ]
FINAL CODE
//SEG0 @begin
//SEG1 @1
//SEG2 [0] call main param-assignment [ ]
jsr main
//SEG3 @end
//SEG4 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
//SEG7 [1] phi from main::@1 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
b1:
//SEG10 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG11 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG12 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
cpx #$64
bne b1
//SEG13 main::@return
//SEG14 [5] return [ ]
rts
}

View File

@ -0,0 +1,12 @@
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(void()) main()
(label) main::@1
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 22.0
reg byte x [ main::i#2 main::i#1 ]

View File

@ -0,0 +1,17 @@
jsr main
main: {
ldx #$64
b1:
lda #$0
b2:
sta $400,x
clc
adc #$1
sta $ff
cpx $ff
bne b2
dex
cpx #$1
bne b1
rts
}

View File

@ -0,0 +1,24 @@
@begin: scope:[] from
to:@1
@1: scope:[] from @begin
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@3
[1] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ]
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
[2] (byte) main::j#2 ← phi( main::@1/(byte) 0 main::@2/(byte) main::j#1 ) [ main::i#2 main::j#2 ]
[3] *((word) 1024 + (byte) main::i#2) ← (byte) main::j#2 [ main::i#2 main::j#2 ]
[4] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::j#1 main::i#2 ]
[5] if((byte) main::j#1!=(byte) main::i#2) goto main::@2 [ main::j#1 main::i#2 ]
to:main::@3
main::@3: scope:[main] from main::@2
[6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ]
[7] if((byte) main::i#1!=(byte) 1) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@3
[8] return [ ]
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 44.8
(byte) main::j
(byte) main::j#1 reg byte a 151.5
(byte) main::j#2 reg byte a 151.5
reg byte x [ main::i#2 main::i#1 ]
reg byte a [ main::j#2 main::j#1 ]