diff --git a/makina-compiler/gen/xyz/colinholzman/makina/makina.interp b/makina-compiler/gen/xyz/colinholzman/makina/makina.interp index 1778d52..7f9f935 100644 --- a/makina-compiler/gen/xyz/colinholzman/makina/makina.interp +++ b/makina-compiler/gen/xyz/colinholzman/makina/makina.interp @@ -3,6 +3,7 @@ null 'machine' ';' 'initial' +'final' 'state' '{' '}' @@ -34,6 +35,7 @@ null null null null +null ID WHITESPACE COMMENT @@ -49,4 +51,4 @@ target atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 19, 88, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 21, 10, 2, 12, 2, 14, 2, 24, 11, 2, 3, 2, 3, 2, 3, 3, 5, 3, 29, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 36, 10, 3, 12, 3, 14, 3, 39, 11, 3, 3, 3, 3, 3, 3, 4, 5, 4, 44, 10, 4, 3, 4, 3, 4, 3, 4, 7, 4, 49, 10, 4, 12, 4, 14, 4, 52, 11, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 65, 10, 5, 3, 5, 5, 5, 68, 10, 5, 3, 5, 5, 5, 71, 10, 5, 3, 5, 5, 5, 74, 10, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 86, 10, 8, 3, 8, 2, 2, 9, 2, 4, 6, 8, 10, 12, 14, 2, 2, 2, 92, 2, 16, 3, 2, 2, 2, 4, 28, 3, 2, 2, 2, 6, 43, 3, 2, 2, 2, 8, 73, 3, 2, 2, 2, 10, 75, 3, 2, 2, 2, 12, 77, 3, 2, 2, 2, 14, 85, 3, 2, 2, 2, 16, 17, 7, 3, 2, 2, 17, 18, 7, 17, 2, 2, 18, 22, 7, 4, 2, 2, 19, 21, 5, 4, 3, 2, 20, 19, 3, 2, 2, 2, 21, 24, 3, 2, 2, 2, 22, 20, 3, 2, 2, 2, 22, 23, 3, 2, 2, 2, 23, 25, 3, 2, 2, 2, 24, 22, 3, 2, 2, 2, 25, 26, 7, 2, 2, 3, 26, 3, 3, 2, 2, 2, 27, 29, 7, 5, 2, 2, 28, 27, 3, 2, 2, 2, 28, 29, 3, 2, 2, 2, 29, 30, 3, 2, 2, 2, 30, 31, 7, 6, 2, 2, 31, 32, 5, 6, 4, 2, 32, 37, 7, 7, 2, 2, 33, 36, 5, 8, 5, 2, 34, 36, 5, 4, 3, 2, 35, 33, 3, 2, 2, 2, 35, 34, 3, 2, 2, 2, 36, 39, 3, 2, 2, 2, 37, 35, 3, 2, 2, 2, 37, 38, 3, 2, 2, 2, 38, 40, 3, 2, 2, 2, 39, 37, 3, 2, 2, 2, 40, 41, 7, 8, 2, 2, 41, 5, 3, 2, 2, 2, 42, 44, 7, 9, 2, 2, 43, 42, 3, 2, 2, 2, 43, 44, 3, 2, 2, 2, 44, 45, 3, 2, 2, 2, 45, 50, 7, 17, 2, 2, 46, 47, 7, 9, 2, 2, 47, 49, 7, 17, 2, 2, 48, 46, 3, 2, 2, 2, 49, 52, 3, 2, 2, 2, 50, 48, 3, 2, 2, 2, 50, 51, 3, 2, 2, 2, 51, 7, 3, 2, 2, 2, 52, 50, 3, 2, 2, 2, 53, 54, 7, 10, 2, 2, 54, 55, 5, 10, 6, 2, 55, 56, 7, 4, 2, 2, 56, 74, 3, 2, 2, 2, 57, 58, 7, 11, 2, 2, 58, 59, 5, 10, 6, 2, 59, 60, 7, 4, 2, 2, 60, 74, 3, 2, 2, 2, 61, 62, 7, 12, 2, 2, 62, 64, 7, 17, 2, 2, 63, 65, 5, 12, 7, 2, 64, 63, 3, 2, 2, 2, 64, 65, 3, 2, 2, 2, 65, 67, 3, 2, 2, 2, 66, 68, 5, 10, 6, 2, 67, 66, 3, 2, 2, 2, 67, 68, 3, 2, 2, 2, 68, 70, 3, 2, 2, 2, 69, 71, 5, 14, 8, 2, 70, 69, 3, 2, 2, 2, 70, 71, 3, 2, 2, 2, 71, 72, 3, 2, 2, 2, 72, 74, 7, 4, 2, 2, 73, 53, 3, 2, 2, 2, 73, 57, 3, 2, 2, 2, 73, 61, 3, 2, 2, 2, 74, 9, 3, 2, 2, 2, 75, 76, 7, 17, 2, 2, 76, 11, 3, 2, 2, 2, 77, 78, 7, 13, 2, 2, 78, 79, 7, 17, 2, 2, 79, 80, 7, 14, 2, 2, 80, 13, 3, 2, 2, 2, 81, 82, 7, 15, 2, 2, 82, 86, 5, 6, 4, 2, 83, 84, 7, 16, 2, 2, 84, 86, 5, 6, 4, 2, 85, 81, 3, 2, 2, 2, 85, 83, 3, 2, 2, 2, 86, 15, 3, 2, 2, 2, 13, 22, 28, 35, 37, 43, 50, 64, 67, 70, 73, 85] \ No newline at end of file +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 20, 93, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 21, 10, 2, 12, 2, 14, 2, 24, 11, 2, 3, 2, 3, 2, 3, 3, 5, 3, 29, 10, 3, 3, 3, 5, 3, 32, 10, 3, 5, 3, 34, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 41, 10, 3, 12, 3, 14, 3, 44, 11, 3, 3, 3, 3, 3, 3, 4, 5, 4, 49, 10, 4, 3, 4, 3, 4, 3, 4, 7, 4, 54, 10, 4, 12, 4, 14, 4, 57, 11, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 70, 10, 5, 3, 5, 5, 5, 73, 10, 5, 3, 5, 5, 5, 76, 10, 5, 3, 5, 5, 5, 79, 10, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 91, 10, 8, 3, 8, 2, 2, 9, 2, 4, 6, 8, 10, 12, 14, 2, 2, 2, 99, 2, 16, 3, 2, 2, 2, 4, 33, 3, 2, 2, 2, 6, 48, 3, 2, 2, 2, 8, 78, 3, 2, 2, 2, 10, 80, 3, 2, 2, 2, 12, 82, 3, 2, 2, 2, 14, 90, 3, 2, 2, 2, 16, 17, 7, 3, 2, 2, 17, 18, 7, 18, 2, 2, 18, 22, 7, 4, 2, 2, 19, 21, 5, 4, 3, 2, 20, 19, 3, 2, 2, 2, 21, 24, 3, 2, 2, 2, 22, 20, 3, 2, 2, 2, 22, 23, 3, 2, 2, 2, 23, 25, 3, 2, 2, 2, 24, 22, 3, 2, 2, 2, 25, 26, 7, 2, 2, 3, 26, 3, 3, 2, 2, 2, 27, 29, 7, 5, 2, 2, 28, 27, 3, 2, 2, 2, 28, 29, 3, 2, 2, 2, 29, 34, 3, 2, 2, 2, 30, 32, 7, 6, 2, 2, 31, 30, 3, 2, 2, 2, 31, 32, 3, 2, 2, 2, 32, 34, 3, 2, 2, 2, 33, 28, 3, 2, 2, 2, 33, 31, 3, 2, 2, 2, 34, 35, 3, 2, 2, 2, 35, 36, 7, 7, 2, 2, 36, 37, 5, 6, 4, 2, 37, 42, 7, 8, 2, 2, 38, 41, 5, 8, 5, 2, 39, 41, 5, 4, 3, 2, 40, 38, 3, 2, 2, 2, 40, 39, 3, 2, 2, 2, 41, 44, 3, 2, 2, 2, 42, 40, 3, 2, 2, 2, 42, 43, 3, 2, 2, 2, 43, 45, 3, 2, 2, 2, 44, 42, 3, 2, 2, 2, 45, 46, 7, 9, 2, 2, 46, 5, 3, 2, 2, 2, 47, 49, 7, 10, 2, 2, 48, 47, 3, 2, 2, 2, 48, 49, 3, 2, 2, 2, 49, 50, 3, 2, 2, 2, 50, 55, 7, 18, 2, 2, 51, 52, 7, 10, 2, 2, 52, 54, 7, 18, 2, 2, 53, 51, 3, 2, 2, 2, 54, 57, 3, 2, 2, 2, 55, 53, 3, 2, 2, 2, 55, 56, 3, 2, 2, 2, 56, 7, 3, 2, 2, 2, 57, 55, 3, 2, 2, 2, 58, 59, 7, 11, 2, 2, 59, 60, 5, 10, 6, 2, 60, 61, 7, 4, 2, 2, 61, 79, 3, 2, 2, 2, 62, 63, 7, 12, 2, 2, 63, 64, 5, 10, 6, 2, 64, 65, 7, 4, 2, 2, 65, 79, 3, 2, 2, 2, 66, 67, 7, 13, 2, 2, 67, 69, 7, 18, 2, 2, 68, 70, 5, 12, 7, 2, 69, 68, 3, 2, 2, 2, 69, 70, 3, 2, 2, 2, 70, 72, 3, 2, 2, 2, 71, 73, 5, 10, 6, 2, 72, 71, 3, 2, 2, 2, 72, 73, 3, 2, 2, 2, 73, 75, 3, 2, 2, 2, 74, 76, 5, 14, 8, 2, 75, 74, 3, 2, 2, 2, 75, 76, 3, 2, 2, 2, 76, 77, 3, 2, 2, 2, 77, 79, 7, 4, 2, 2, 78, 58, 3, 2, 2, 2, 78, 62, 3, 2, 2, 2, 78, 66, 3, 2, 2, 2, 79, 9, 3, 2, 2, 2, 80, 81, 7, 18, 2, 2, 81, 11, 3, 2, 2, 2, 82, 83, 7, 14, 2, 2, 83, 84, 7, 18, 2, 2, 84, 85, 7, 15, 2, 2, 85, 13, 3, 2, 2, 2, 86, 87, 7, 16, 2, 2, 87, 91, 5, 6, 4, 2, 88, 89, 7, 17, 2, 2, 89, 91, 5, 6, 4, 2, 90, 86, 3, 2, 2, 2, 90, 88, 3, 2, 2, 2, 91, 15, 3, 2, 2, 2, 15, 22, 28, 31, 33, 40, 42, 48, 55, 69, 72, 75, 78, 90] \ No newline at end of file diff --git a/makina-compiler/gen/xyz/colinholzman/makina/makina.tokens b/makina-compiler/gen/xyz/colinholzman/makina/makina.tokens index cff27c7..28b6f07 100644 --- a/makina-compiler/gen/xyz/colinholzman/makina/makina.tokens +++ b/makina-compiler/gen/xyz/colinholzman/makina/makina.tokens @@ -12,20 +12,22 @@ T__10=11 T__11=12 T__12=13 T__13=14 -ID=15 -WHITESPACE=16 -COMMENT=17 +T__14=15 +ID=16 +WHITESPACE=17 +COMMENT=18 'machine'=1 ';'=2 'initial'=3 -'state'=4 -'{'=5 -'}'=6 -'.'=7 -'entry'=8 -'exit'=9 -'on'=10 -'('=11 -')'=12 -'->'=13 -'-->'=14 +'final'=4 +'state'=5 +'{'=6 +'}'=7 +'.'=8 +'entry'=9 +'exit'=10 +'on'=11 +'('=12 +')'=13 +'->'=14 +'-->'=15 diff --git a/makina-compiler/gen/xyz/colinholzman/makina/makinaBaseListener.java b/makina-compiler/gen/xyz/colinholzman/makina/makinaBaseListener.java index d5d9d74..1c50a90 100644 --- a/makina-compiler/gen/xyz/colinholzman/makina/makinaBaseListener.java +++ b/makina-compiler/gen/xyz/colinholzman/makina/makinaBaseListener.java @@ -1,4 +1,4 @@ -// Generated from C:/Users/Colin/Documents/makina/makina-compiler/src\makina.g4 by ANTLR 4.9.1 +// Generated from /Users/colinholzman/makina/makina-compiler/src/makina.g4 by ANTLR 4.9.1 package xyz.colinholzman.makina; import org.antlr.v4.runtime.ParserRuleContext; diff --git a/makina-compiler/gen/xyz/colinholzman/makina/makinaBaseVisitor.java b/makina-compiler/gen/xyz/colinholzman/makina/makinaBaseVisitor.java index 1d5a97e..3fb771b 100644 --- a/makina-compiler/gen/xyz/colinholzman/makina/makinaBaseVisitor.java +++ b/makina-compiler/gen/xyz/colinholzman/makina/makinaBaseVisitor.java @@ -1,4 +1,4 @@ -// Generated from C:/Users/Colin/Documents/makina/makina-compiler/src\makina.g4 by ANTLR 4.9.1 +// Generated from /Users/colinholzman/makina/makina-compiler/src/makina.g4 by ANTLR 4.9.1 package xyz.colinholzman.makina; import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; diff --git a/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.interp b/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.interp index 4ce64bd..37a4ba5 100644 --- a/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.interp +++ b/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.interp @@ -3,6 +3,7 @@ null 'machine' ';' 'initial' +'final' 'state' '{' '}' @@ -34,6 +35,7 @@ null null null null +null ID WHITESPACE COMMENT @@ -53,6 +55,7 @@ T__10 T__11 T__12 T__13 +T__14 ID WHITESPACE COMMENT @@ -65,4 +68,4 @@ mode names: DEFAULT_MODE atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 19, 128, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 7, 16, 95, 10, 16, 12, 16, 14, 16, 98, 11, 16, 3, 16, 3, 16, 6, 16, 102, 10, 16, 13, 16, 14, 16, 103, 3, 16, 5, 16, 107, 10, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 7, 18, 117, 10, 18, 12, 18, 14, 18, 120, 11, 18, 3, 18, 5, 18, 123, 10, 18, 3, 18, 3, 18, 3, 18, 3, 18, 2, 2, 19, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 3, 2, 7, 5, 2, 67, 92, 97, 97, 99, 124, 6, 2, 50, 59, 67, 92, 97, 97, 99, 124, 3, 2, 98, 98, 5, 2, 11, 12, 14, 15, 34, 34, 4, 2, 12, 12, 15, 15, 2, 132, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 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, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 3, 37, 3, 2, 2, 2, 5, 45, 3, 2, 2, 2, 7, 47, 3, 2, 2, 2, 9, 55, 3, 2, 2, 2, 11, 61, 3, 2, 2, 2, 13, 63, 3, 2, 2, 2, 15, 65, 3, 2, 2, 2, 17, 67, 3, 2, 2, 2, 19, 73, 3, 2, 2, 2, 21, 78, 3, 2, 2, 2, 23, 81, 3, 2, 2, 2, 25, 83, 3, 2, 2, 2, 27, 85, 3, 2, 2, 2, 29, 88, 3, 2, 2, 2, 31, 106, 3, 2, 2, 2, 33, 108, 3, 2, 2, 2, 35, 112, 3, 2, 2, 2, 37, 38, 7, 111, 2, 2, 38, 39, 7, 99, 2, 2, 39, 40, 7, 101, 2, 2, 40, 41, 7, 106, 2, 2, 41, 42, 7, 107, 2, 2, 42, 43, 7, 112, 2, 2, 43, 44, 7, 103, 2, 2, 44, 4, 3, 2, 2, 2, 45, 46, 7, 61, 2, 2, 46, 6, 3, 2, 2, 2, 47, 48, 7, 107, 2, 2, 48, 49, 7, 112, 2, 2, 49, 50, 7, 107, 2, 2, 50, 51, 7, 118, 2, 2, 51, 52, 7, 107, 2, 2, 52, 53, 7, 99, 2, 2, 53, 54, 7, 110, 2, 2, 54, 8, 3, 2, 2, 2, 55, 56, 7, 117, 2, 2, 56, 57, 7, 118, 2, 2, 57, 58, 7, 99, 2, 2, 58, 59, 7, 118, 2, 2, 59, 60, 7, 103, 2, 2, 60, 10, 3, 2, 2, 2, 61, 62, 7, 125, 2, 2, 62, 12, 3, 2, 2, 2, 63, 64, 7, 127, 2, 2, 64, 14, 3, 2, 2, 2, 65, 66, 7, 48, 2, 2, 66, 16, 3, 2, 2, 2, 67, 68, 7, 103, 2, 2, 68, 69, 7, 112, 2, 2, 69, 70, 7, 118, 2, 2, 70, 71, 7, 116, 2, 2, 71, 72, 7, 123, 2, 2, 72, 18, 3, 2, 2, 2, 73, 74, 7, 103, 2, 2, 74, 75, 7, 122, 2, 2, 75, 76, 7, 107, 2, 2, 76, 77, 7, 118, 2, 2, 77, 20, 3, 2, 2, 2, 78, 79, 7, 113, 2, 2, 79, 80, 7, 112, 2, 2, 80, 22, 3, 2, 2, 2, 81, 82, 7, 42, 2, 2, 82, 24, 3, 2, 2, 2, 83, 84, 7, 43, 2, 2, 84, 26, 3, 2, 2, 2, 85, 86, 7, 47, 2, 2, 86, 87, 7, 64, 2, 2, 87, 28, 3, 2, 2, 2, 88, 89, 7, 47, 2, 2, 89, 90, 7, 47, 2, 2, 90, 91, 7, 64, 2, 2, 91, 30, 3, 2, 2, 2, 92, 96, 9, 2, 2, 2, 93, 95, 9, 3, 2, 2, 94, 93, 3, 2, 2, 2, 95, 98, 3, 2, 2, 2, 96, 94, 3, 2, 2, 2, 96, 97, 3, 2, 2, 2, 97, 107, 3, 2, 2, 2, 98, 96, 3, 2, 2, 2, 99, 101, 7, 98, 2, 2, 100, 102, 10, 4, 2, 2, 101, 100, 3, 2, 2, 2, 102, 103, 3, 2, 2, 2, 103, 101, 3, 2, 2, 2, 103, 104, 3, 2, 2, 2, 104, 105, 3, 2, 2, 2, 105, 107, 7, 98, 2, 2, 106, 92, 3, 2, 2, 2, 106, 99, 3, 2, 2, 2, 107, 32, 3, 2, 2, 2, 108, 109, 9, 5, 2, 2, 109, 110, 3, 2, 2, 2, 110, 111, 8, 17, 2, 2, 111, 34, 3, 2, 2, 2, 112, 113, 7, 49, 2, 2, 113, 114, 7, 49, 2, 2, 114, 118, 3, 2, 2, 2, 115, 117, 10, 6, 2, 2, 116, 115, 3, 2, 2, 2, 117, 120, 3, 2, 2, 2, 118, 116, 3, 2, 2, 2, 118, 119, 3, 2, 2, 2, 119, 122, 3, 2, 2, 2, 120, 118, 3, 2, 2, 2, 121, 123, 7, 15, 2, 2, 122, 121, 3, 2, 2, 2, 122, 123, 3, 2, 2, 2, 123, 124, 3, 2, 2, 2, 124, 125, 7, 12, 2, 2, 125, 126, 3, 2, 2, 2, 126, 127, 8, 18, 2, 2, 127, 36, 3, 2, 2, 2, 8, 2, 96, 103, 106, 118, 122, 3, 8, 2, 2] \ No newline at end of file +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 20, 136, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 7, 17, 103, 10, 17, 12, 17, 14, 17, 106, 11, 17, 3, 17, 3, 17, 6, 17, 110, 10, 17, 13, 17, 14, 17, 111, 3, 17, 5, 17, 115, 10, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, 7, 19, 125, 10, 19, 12, 19, 14, 19, 128, 11, 19, 3, 19, 5, 19, 131, 10, 19, 3, 19, 3, 19, 3, 19, 3, 19, 2, 2, 20, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 3, 2, 7, 5, 2, 67, 92, 97, 97, 99, 124, 6, 2, 50, 59, 67, 92, 97, 97, 99, 124, 3, 2, 98, 98, 5, 2, 11, 12, 14, 15, 34, 34, 4, 2, 12, 12, 15, 15, 2, 140, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 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, 29, 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, 3, 39, 3, 2, 2, 2, 5, 47, 3, 2, 2, 2, 7, 49, 3, 2, 2, 2, 9, 57, 3, 2, 2, 2, 11, 63, 3, 2, 2, 2, 13, 69, 3, 2, 2, 2, 15, 71, 3, 2, 2, 2, 17, 73, 3, 2, 2, 2, 19, 75, 3, 2, 2, 2, 21, 81, 3, 2, 2, 2, 23, 86, 3, 2, 2, 2, 25, 89, 3, 2, 2, 2, 27, 91, 3, 2, 2, 2, 29, 93, 3, 2, 2, 2, 31, 96, 3, 2, 2, 2, 33, 114, 3, 2, 2, 2, 35, 116, 3, 2, 2, 2, 37, 120, 3, 2, 2, 2, 39, 40, 7, 111, 2, 2, 40, 41, 7, 99, 2, 2, 41, 42, 7, 101, 2, 2, 42, 43, 7, 106, 2, 2, 43, 44, 7, 107, 2, 2, 44, 45, 7, 112, 2, 2, 45, 46, 7, 103, 2, 2, 46, 4, 3, 2, 2, 2, 47, 48, 7, 61, 2, 2, 48, 6, 3, 2, 2, 2, 49, 50, 7, 107, 2, 2, 50, 51, 7, 112, 2, 2, 51, 52, 7, 107, 2, 2, 52, 53, 7, 118, 2, 2, 53, 54, 7, 107, 2, 2, 54, 55, 7, 99, 2, 2, 55, 56, 7, 110, 2, 2, 56, 8, 3, 2, 2, 2, 57, 58, 7, 104, 2, 2, 58, 59, 7, 107, 2, 2, 59, 60, 7, 112, 2, 2, 60, 61, 7, 99, 2, 2, 61, 62, 7, 110, 2, 2, 62, 10, 3, 2, 2, 2, 63, 64, 7, 117, 2, 2, 64, 65, 7, 118, 2, 2, 65, 66, 7, 99, 2, 2, 66, 67, 7, 118, 2, 2, 67, 68, 7, 103, 2, 2, 68, 12, 3, 2, 2, 2, 69, 70, 7, 125, 2, 2, 70, 14, 3, 2, 2, 2, 71, 72, 7, 127, 2, 2, 72, 16, 3, 2, 2, 2, 73, 74, 7, 48, 2, 2, 74, 18, 3, 2, 2, 2, 75, 76, 7, 103, 2, 2, 76, 77, 7, 112, 2, 2, 77, 78, 7, 118, 2, 2, 78, 79, 7, 116, 2, 2, 79, 80, 7, 123, 2, 2, 80, 20, 3, 2, 2, 2, 81, 82, 7, 103, 2, 2, 82, 83, 7, 122, 2, 2, 83, 84, 7, 107, 2, 2, 84, 85, 7, 118, 2, 2, 85, 22, 3, 2, 2, 2, 86, 87, 7, 113, 2, 2, 87, 88, 7, 112, 2, 2, 88, 24, 3, 2, 2, 2, 89, 90, 7, 42, 2, 2, 90, 26, 3, 2, 2, 2, 91, 92, 7, 43, 2, 2, 92, 28, 3, 2, 2, 2, 93, 94, 7, 47, 2, 2, 94, 95, 7, 64, 2, 2, 95, 30, 3, 2, 2, 2, 96, 97, 7, 47, 2, 2, 97, 98, 7, 47, 2, 2, 98, 99, 7, 64, 2, 2, 99, 32, 3, 2, 2, 2, 100, 104, 9, 2, 2, 2, 101, 103, 9, 3, 2, 2, 102, 101, 3, 2, 2, 2, 103, 106, 3, 2, 2, 2, 104, 102, 3, 2, 2, 2, 104, 105, 3, 2, 2, 2, 105, 115, 3, 2, 2, 2, 106, 104, 3, 2, 2, 2, 107, 109, 7, 98, 2, 2, 108, 110, 10, 4, 2, 2, 109, 108, 3, 2, 2, 2, 110, 111, 3, 2, 2, 2, 111, 109, 3, 2, 2, 2, 111, 112, 3, 2, 2, 2, 112, 113, 3, 2, 2, 2, 113, 115, 7, 98, 2, 2, 114, 100, 3, 2, 2, 2, 114, 107, 3, 2, 2, 2, 115, 34, 3, 2, 2, 2, 116, 117, 9, 5, 2, 2, 117, 118, 3, 2, 2, 2, 118, 119, 8, 18, 2, 2, 119, 36, 3, 2, 2, 2, 120, 121, 7, 49, 2, 2, 121, 122, 7, 49, 2, 2, 122, 126, 3, 2, 2, 2, 123, 125, 10, 6, 2, 2, 124, 123, 3, 2, 2, 2, 125, 128, 3, 2, 2, 2, 126, 124, 3, 2, 2, 2, 126, 127, 3, 2, 2, 2, 127, 130, 3, 2, 2, 2, 128, 126, 3, 2, 2, 2, 129, 131, 7, 15, 2, 2, 130, 129, 3, 2, 2, 2, 130, 131, 3, 2, 2, 2, 131, 132, 3, 2, 2, 2, 132, 133, 7, 12, 2, 2, 133, 134, 3, 2, 2, 2, 134, 135, 8, 19, 2, 2, 135, 38, 3, 2, 2, 2, 8, 2, 104, 111, 114, 126, 130, 3, 8, 2, 2] \ No newline at end of file diff --git a/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.java b/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.java index ebc4d19..6df21b8 100644 --- a/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.java +++ b/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.java @@ -1,4 +1,4 @@ -// Generated from C:/Users/Colin/Documents/makina/makina-compiler/src\makina.g4 by ANTLR 4.9.1 +// Generated from /Users/colinholzman/makina/makina-compiler/src/makina.g4 by ANTLR 4.9.1 package xyz.colinholzman.makina; import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.CharStream; @@ -18,8 +18,8 @@ public class makinaLexer extends Lexer { new PredictionContextCache(); public static final int T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, - T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, ID=15, WHITESPACE=16, - COMMENT=17; + T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, ID=16, WHITESPACE=17, + COMMENT=18; public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; @@ -31,22 +31,23 @@ public class makinaLexer extends Lexer { private static String[] makeRuleNames() { return new String[] { "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8", - "T__9", "T__10", "T__11", "T__12", "T__13", "ID", "WHITESPACE", "COMMENT" + "T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "ID", "WHITESPACE", + "COMMENT" }; } public static final String[] ruleNames = makeRuleNames(); private static String[] makeLiteralNames() { return new String[] { - null, "'machine'", "';'", "'initial'", "'state'", "'{'", "'}'", "'.'", - "'entry'", "'exit'", "'on'", "'('", "')'", "'->'", "'-->'" + null, "'machine'", "';'", "'initial'", "'final'", "'state'", "'{'", "'}'", + "'.'", "'entry'", "'exit'", "'on'", "'('", "')'", "'->'", "'-->'" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, "ID", "WHITESPACE", "COMMENT" + null, null, null, null, "ID", "WHITESPACE", "COMMENT" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -108,38 +109,42 @@ public makinaLexer(CharStream input) { public ATN getATN() { return _ATN; } public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\23\u0080\b\1\4\2"+ + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\24\u0088\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\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4"+ - "\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\t\3"+ - "\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16"+ - "\3\16\3\17\3\17\3\17\3\17\3\20\3\20\7\20_\n\20\f\20\16\20b\13\20\3\20"+ - "\3\20\6\20f\n\20\r\20\16\20g\3\20\5\20k\n\20\3\21\3\21\3\21\3\21\3\22"+ - "\3\22\3\22\3\22\7\22u\n\22\f\22\16\22x\13\22\3\22\5\22{\n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M\7p\2\2MN\7v\2\2NO\7t\2\2OP\7{\2\2P\24\3\2\2\2QR\7g\2\2RS\7"+ + "z\2\2ST\7k\2\2TU\7v\2\2U\26\3\2\2\2VW\7q\2\2WX\7p\2\2X\30\3\2\2\2YZ\7"+ + "*\2\2Z\32\3\2\2\2[\\\7+\2\2\\\34\3\2\2\2]^\7/\2\2^_\7@\2\2_\36\3\2\2\2"+ + "`a\7/\2\2ab\7/\2\2bc\7@\2\2c \3\2\2\2dh\t\2\2\2eg\t\3\2\2fe\3\2\2\2gj"+ + "\3\2\2\2hf\3\2\2\2hi\3\2\2\2is\3\2\2\2jh\3\2\2\2km\7b\2\2ln\n\4\2\2ml"+ + "\3\2\2\2no\3\2\2\2om\3\2\2\2op\3\2\2\2pq\3\2\2\2qs\7b\2\2rd\3\2\2\2rk"+ + "\3\2\2\2s\"\3\2\2\2tu\t\5\2\2uv\3\2\2\2vw\b\22\2\2w$\3\2\2\2xy\7\61\2"+ + "\2yz\7\61\2\2z~\3\2\2\2{}\n\6\2\2|{\3\2\2\2}\u0080\3\2\2\2~|\3\2\2\2~"+ + "\177\3\2\2\2\177\u0082\3\2\2\2\u0080~\3\2\2\2\u0081\u0083\7\17\2\2\u0082"+ + "\u0081\3\2\2\2\u0082\u0083\3\2\2\2\u0083\u0084\3\2\2\2\u0084\u0085\7\f"+ + "\2\2\u0085\u0086\3\2\2\2\u0086\u0087\b\23\2\2\u0087&\3\2\2\2\b\2hor~\u0082"+ + "\3\b\2\2"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.tokens b/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.tokens index cff27c7..28b6f07 100644 --- a/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.tokens +++ b/makina-compiler/gen/xyz/colinholzman/makina/makinaLexer.tokens @@ -12,20 +12,22 @@ T__10=11 T__11=12 T__12=13 T__13=14 -ID=15 -WHITESPACE=16 -COMMENT=17 +T__14=15 +ID=16 +WHITESPACE=17 +COMMENT=18 'machine'=1 ';'=2 'initial'=3 -'state'=4 -'{'=5 -'}'=6 -'.'=7 -'entry'=8 -'exit'=9 -'on'=10 -'('=11 -')'=12 -'->'=13 -'-->'=14 +'final'=4 +'state'=5 +'{'=6 +'}'=7 +'.'=8 +'entry'=9 +'exit'=10 +'on'=11 +'('=12 +')'=13 +'->'=14 +'-->'=15 diff --git a/makina-compiler/gen/xyz/colinholzman/makina/makinaListener.java b/makina-compiler/gen/xyz/colinholzman/makina/makinaListener.java index 3ce81a0..397e62a 100644 --- a/makina-compiler/gen/xyz/colinholzman/makina/makinaListener.java +++ b/makina-compiler/gen/xyz/colinholzman/makina/makinaListener.java @@ -1,4 +1,4 @@ -// Generated from C:/Users/Colin/Documents/makina/makina-compiler/src\makina.g4 by ANTLR 4.9.1 +// Generated from /Users/colinholzman/makina/makina-compiler/src/makina.g4 by ANTLR 4.9.1 package xyz.colinholzman.makina; import org.antlr.v4.runtime.tree.ParseTreeListener; diff --git a/makina-compiler/gen/xyz/colinholzman/makina/makinaParser.java b/makina-compiler/gen/xyz/colinholzman/makina/makinaParser.java index d4c55f9..7c7604e 100644 --- a/makina-compiler/gen/xyz/colinholzman/makina/makinaParser.java +++ b/makina-compiler/gen/xyz/colinholzman/makina/makinaParser.java @@ -1,4 +1,4 @@ -// Generated from C:/Users/Colin/Documents/makina/makina-compiler/src\makina.g4 by ANTLR 4.9.1 +// Generated from /Users/colinholzman/makina/makina-compiler/src/makina.g4 by ANTLR 4.9.1 package xyz.colinholzman.makina; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; @@ -18,8 +18,8 @@ public class makinaParser extends Parser { new PredictionContextCache(); public static final int T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, - T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, ID=15, WHITESPACE=16, - COMMENT=17; + T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, ID=16, WHITESPACE=17, + COMMENT=18; public static final int RULE_file = 0, RULE_state = 1, RULE_id = 2, RULE_handler = 3, RULE_action = 4, RULE_guard = 5, RULE_target = 6; @@ -32,15 +32,15 @@ private static String[] makeRuleNames() { private static String[] makeLiteralNames() { return new String[] { - null, "'machine'", "';'", "'initial'", "'state'", "'{'", "'}'", "'.'", - "'entry'", "'exit'", "'on'", "'('", "')'", "'->'", "'-->'" + null, "'machine'", "';'", "'initial'", "'final'", "'state'", "'{'", "'}'", + "'.'", "'entry'", "'exit'", "'on'", "'('", "')'", "'->'", "'-->'" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, "ID", "WHITESPACE", "COMMENT" + null, null, null, null, "ID", "WHITESPACE", "COMMENT" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -138,7 +138,7 @@ public final FileContext file() throws RecognitionException { setState(20); _errHandler.sync(this); _la = _input.LA(1); - while (_la==T__2 || _la==T__3) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__3) | (1L << T__4))) != 0)) { { { setState(17); @@ -166,6 +166,7 @@ public final FileContext file() throws RecognitionException { public static class StateContext extends ParserRuleContext { public Token initial; + public Token final_; public IdContext id() { return getRuleContext(IdContext.class,0); } @@ -207,42 +208,65 @@ public final StateContext state() throws RecognitionException { try { enterOuterAlt(_localctx, 1); { - setState(26); + setState(31); _errHandler.sync(this); - _la = _input.LA(1); - if (_la==T__2) { + switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) { + case 1: { - setState(25); - ((StateContext)_localctx).initial = match(T__2); + setState(26); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==T__2) { + { + setState(25); + ((StateContext)_localctx).initial = match(T__2); + } } - } - setState(28); - match(T__3); - setState(29); - id(); - setState(30); + } + break; + case 2: + { + setState(29); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==T__3) { + { + setState(28); + ((StateContext)_localctx).final_ = match(T__3); + } + } + + } + break; + } + setState(33); match(T__4); + setState(34); + id(); setState(35); + match(T__5); + setState(40); _errHandler.sync(this); _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__3) | (1L << T__7) | (1L << T__8) | (1L << T__9))) != 0)) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__3) | (1L << T__4) | (1L << T__8) | (1L << T__9) | (1L << T__10))) != 0)) { { - setState(33); + setState(38); _errHandler.sync(this); switch (_input.LA(1)) { - case T__7: case T__8: case T__9: + case T__10: { - setState(31); + setState(36); handler(); } break; case T__2: case T__3: + case T__4: { - setState(32); + setState(37); state(); } break; @@ -250,12 +274,12 @@ public final StateContext state() throws RecognitionException { throw new NoViableAltException(this); } } - setState(37); + setState(42); _errHandler.sync(this); _la = _input.LA(1); } - setState(38); - match(T__5); + setState(43); + match(T__6); } } catch (RecognitionException re) { @@ -301,31 +325,31 @@ public final IdContext id() throws RecognitionException { try { enterOuterAlt(_localctx, 1); { - setState(41); + setState(46); _errHandler.sync(this); _la = _input.LA(1); - if (_la==T__6) { + if (_la==T__7) { { - setState(40); - ((IdContext)_localctx).root = match(T__6); + setState(45); + ((IdContext)_localctx).root = match(T__7); } } - setState(43); - match(ID); setState(48); + match(ID); + setState(53); _errHandler.sync(this); _la = _input.LA(1); - while (_la==T__6) { + while (_la==T__7) { { { - setState(44); - match(T__6); - setState(45); + setState(49); + match(T__7); + setState(50); match(ID); } } - setState(50); + setState(55); _errHandler.sync(this); _la = _input.LA(1); } @@ -423,72 +447,72 @@ public final HandlerContext handler() throws RecognitionException { enterRule(_localctx, 6, RULE_handler); int _la; try { - setState(71); + setState(76); _errHandler.sync(this); switch (_input.LA(1)) { - case T__7: + case T__8: _localctx = new EntryHandlerContext(_localctx); enterOuterAlt(_localctx, 1); { - setState(51); - match(T__7); - setState(52); + setState(56); + match(T__8); + setState(57); action(); - setState(53); + setState(58); match(T__1); } break; - case T__8: + case T__9: _localctx = new ExitHandlerContext(_localctx); enterOuterAlt(_localctx, 2); { - setState(55); - match(T__8); - setState(56); + setState(60); + match(T__9); + setState(61); action(); - setState(57); + setState(62); match(T__1); } break; - case T__9: + case T__10: _localctx = new EventHandlerContext(_localctx); enterOuterAlt(_localctx, 3); { - setState(59); - match(T__9); - setState(60); + setState(64); + match(T__10); + setState(65); match(ID); - setState(62); + setState(67); _errHandler.sync(this); _la = _input.LA(1); - if (_la==T__10) { + if (_la==T__11) { { - setState(61); + setState(66); guard(); } } - setState(65); + setState(70); _errHandler.sync(this); _la = _input.LA(1); if (_la==ID) { { - setState(64); + setState(69); action(); } } - setState(68); + setState(73); _errHandler.sync(this); _la = _input.LA(1); - if (_la==T__12 || _la==T__13) { + if (_la==T__13 || _la==T__14) { { - setState(67); + setState(72); target(); } } - setState(70); + setState(75); match(T__1); } break; @@ -534,7 +558,7 @@ public final ActionContext action() throws RecognitionException { try { enterOuterAlt(_localctx, 1); { - setState(73); + setState(78); match(ID); } } @@ -576,12 +600,12 @@ public final GuardContext guard() throws RecognitionException { try { enterOuterAlt(_localctx, 1); { - setState(75); - match(T__10); - setState(76); - match(ID); - setState(77); + setState(80); match(T__11); + setState(81); + match(ID); + setState(82); + match(T__12); } } catch (RecognitionException re) { @@ -649,26 +673,26 @@ public final TargetContext target() throws RecognitionException { TargetContext _localctx = new TargetContext(_ctx, getState()); enterRule(_localctx, 12, RULE_target); try { - setState(83); + setState(88); _errHandler.sync(this); switch (_input.LA(1)) { - case T__12: + case T__13: _localctx = new DefaultTransitionContext(_localctx); enterOuterAlt(_localctx, 1); { - setState(79); - match(T__12); - setState(80); + setState(84); + match(T__13); + setState(85); id(); } break; - case T__13: + case T__14: _localctx = new ExternalTransitionContext(_localctx); enterOuterAlt(_localctx, 2); { - setState(81); - match(T__13); - setState(82); + setState(86); + match(T__14); + setState(87); id(); } break; @@ -688,28 +712,30 @@ public final TargetContext target() throws RecognitionException { } public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\23X\4\2\t\2\4\3\t"+ + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\24]\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\3\2\3\2\3\2\3\2\7\2\25\n\2"+ - "\f\2\16\2\30\13\2\3\2\3\2\3\3\5\3\35\n\3\3\3\3\3\3\3\3\3\3\3\7\3$\n\3"+ - "\f\3\16\3\'\13\3\3\3\3\3\3\4\5\4,\n\4\3\4\3\4\3\4\7\4\61\n\4\f\4\16\4"+ - "\64\13\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\5\5A\n\5\3\5\5\5"+ - "D\n\5\3\5\5\5G\n\5\3\5\5\5J\n\5\3\6\3\6\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3"+ - "\b\5\bV\n\b\3\b\2\2\t\2\4\6\b\n\f\16\2\2\2\\\2\20\3\2\2\2\4\34\3\2\2\2"+ - "\6+\3\2\2\2\bI\3\2\2\2\nK\3\2\2\2\fM\3\2\2\2\16U\3\2\2\2\20\21\7\3\2\2"+ - "\21\22\7\21\2\2\22\26\7\4\2\2\23\25\5\4\3\2\24\23\3\2\2\2\25\30\3\2\2"+ - "\2\26\24\3\2\2\2\26\27\3\2\2\2\27\31\3\2\2\2\30\26\3\2\2\2\31\32\7\2\2"+ - "\3\32\3\3\2\2\2\33\35\7\5\2\2\34\33\3\2\2\2\34\35\3\2\2\2\35\36\3\2\2"+ - "\2\36\37\7\6\2\2\37 \5\6\4\2 %\7\7\2\2!$\5\b\5\2\"$\5\4\3\2#!\3\2\2\2"+ - "#\"\3\2\2\2$\'\3\2\2\2%#\3\2\2\2%&\3\2\2\2&(\3\2\2\2\'%\3\2\2\2()\7\b"+ - "\2\2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\4\2ZV\3\2\2\2ZX\3\2\2\2[\17\3\2\2"+ + "\2\17\26\34\37!(*\60\67EHKNZ"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/makina-compiler/gen/xyz/colinholzman/makina/makinaVisitor.java b/makina-compiler/gen/xyz/colinholzman/makina/makinaVisitor.java index 3f9e8f0..e0673df 100644 --- a/makina-compiler/gen/xyz/colinholzman/makina/makinaVisitor.java +++ b/makina-compiler/gen/xyz/colinholzman/makina/makinaVisitor.java @@ -1,4 +1,4 @@ -// Generated from C:/Users/Colin/Documents/makina/makina-compiler/src\makina.g4 by ANTLR 4.9.1 +// Generated from /Users/colinholzman/makina/makina-compiler/src/makina.g4 by ANTLR 4.9.1 package xyz.colinholzman.makina; import org.antlr.v4.runtime.tree.ParseTreeVisitor; diff --git a/makina-compiler/src/makina.g4 b/makina-compiler/src/makina.g4 index 2d2ec49..2c472f6 100644 --- a/makina-compiler/src/makina.g4 +++ b/makina-compiler/src/makina.g4 @@ -5,7 +5,7 @@ file ; state - : initial='initial'? 'state' id '{' (handler | state)* '}' + : (initial='initial'? | final_='final'?) 'state' id '{' (handler | state)* '}' ; id diff --git a/makina-compiler/src/xyz/colinholzman/makina/State.kt b/makina-compiler/src/xyz/colinholzman/makina/State.kt index 4b409b5..eead06d 100644 --- a/makina-compiler/src/xyz/colinholzman/makina/State.kt +++ b/makina-compiler/src/xyz/colinholzman/makina/State.kt @@ -4,6 +4,7 @@ class State(val id: String, val handlers: List = listOf(), val parentId: List = listOf("."), val initial: Boolean = false, + val final: Boolean = false, location: SourceLocation = SourceLocation.none): Node(location) { init { @@ -152,6 +153,7 @@ class State(val id: String, if (handlers != other.handlers) return false if (parentId != other.parentId) return false if (initial != other.initial) return false + if (final != other.final) return false return true } @@ -161,6 +163,7 @@ class State(val id: String, result = 31 * result + handlers.hashCode() result = 31 * result + parentId.hashCode() result = 31 * result + initial.hashCode() + result = 31 * result + final.hashCode() return result } diff --git a/makina-compiler/src/xyz/colinholzman/makina/StateVisitor.kt b/makina-compiler/src/xyz/colinholzman/makina/StateVisitor.kt index 36a8b20..dfa6e6d 100644 --- a/makina-compiler/src/xyz/colinholzman/makina/StateVisitor.kt +++ b/makina-compiler/src/xyz/colinholzman/makina/StateVisitor.kt @@ -22,10 +22,11 @@ class StateVisitor: makinaBaseVisitor>() { throw RuntimeException("invalid parent specified at ${SourceLocation.fromParseContext(ctx)}") val handlers = ctx.handler().map { it.accept(HandlerVisitor()) } val initial = ctx.initial != null + val final = ctx.final_ != null var childStates: List = emptyList() withNewParentId(id) { childStates = ctx.state().flatMap { it.accept(this) } } - return childStates + State(id, handlers, parentId, initial, SourceLocation.fromParseContext(ctx)) + return childStates + State(id, handlers, parentId, initial, final, SourceLocation.fromParseContext(ctx)) } } \ No newline at end of file