Skip to content

Commit

Permalink
Added Target class to represent the kind of transition (external or l…
Browse files Browse the repository at this point in the history
…ocal). Also added generated antlr classes.

I need to figure out exactly what a local transition looks like for test cases.
  • Loading branch information
clnhlzmn committed Mar 26, 2021
1 parent 0a2e8e0 commit 1fd290e
Show file tree
Hide file tree
Showing 22 changed files with 1,579 additions and 28 deletions.
5 changes: 1 addition & 4 deletions makina-compiler/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,4 @@ fabric.properties
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# Generated sources
gen
.idea/caches/build_file_checksums.ser
52 changes: 52 additions & 0 deletions makina-compiler/gen/xyz/colinholzman/makina/makina.interp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
token literal names:
null
'machine'
';'
'initial'
'state'
'{'
'}'
'.'
'entry'
'exit'
'on'
'('
')'
'->'
'>'
null
null
null

token symbolic names:
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
ID
WHITESPACE
COMMENT

rule names:
file
state
id
handler
action
guard
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]
31 changes: 31 additions & 0 deletions makina-compiler/gen/xyz/colinholzman/makina/makina.tokens
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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
'machine'=1
';'=2
'initial'=3
'state'=4
'{'=5
'}'=6
'.'=7
'entry'=8
'exit'=9
'on'=10
'('=11
')'=12
'->'=13
'>'=14
159 changes: 159 additions & 0 deletions makina-compiler/gen/xyz/colinholzman/makina/makinaBaseListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// 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;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;

/**
* This class provides an empty implementation of {@link makinaListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
public class makinaBaseListener implements makinaListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterFile(makinaParser.FileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitFile(makinaParser.FileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterState(makinaParser.StateContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitState(makinaParser.StateContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterId(makinaParser.IdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitId(makinaParser.IdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEntryHandler(makinaParser.EntryHandlerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEntryHandler(makinaParser.EntryHandlerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterExitHandler(makinaParser.ExitHandlerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExitHandler(makinaParser.ExitHandlerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEventHandler(makinaParser.EventHandlerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEventHandler(makinaParser.EventHandlerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAction(makinaParser.ActionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAction(makinaParser.ActionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterGuard(makinaParser.GuardContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitGuard(makinaParser.GuardContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterExternalTransition(makinaParser.ExternalTransitionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExternalTransition(makinaParser.ExternalTransitionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLocalTransition(makinaParser.LocalTransitionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLocalTransition(makinaParser.LocalTransitionContext ctx) { }

/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
}
84 changes: 84 additions & 0 deletions makina-compiler/gen/xyz/colinholzman/makina/makinaBaseVisitor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// 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;

/**
* This class provides an empty implementation of {@link makinaVisitor},
* which can be extended to create a visitor which only needs to handle a subset
* of the available methods.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public class makinaBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements makinaVisitor<T> {
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitFile(makinaParser.FileContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitState(makinaParser.StateContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitId(makinaParser.IdContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEntryHandler(makinaParser.EntryHandlerContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitExitHandler(makinaParser.ExitHandlerContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEventHandler(makinaParser.EventHandlerContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitAction(makinaParser.ActionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGuard(makinaParser.GuardContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitExternalTransition(makinaParser.ExternalTransitionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLocalTransition(makinaParser.LocalTransitionContext ctx) { return visitChildren(ctx); }
}
Loading

0 comments on commit 1fd290e

Please sign in to comment.