diff --git a/misc/asm_syntax.txt b/misc/asm_syntax.txt
index 596f8bc..17ec18e 100644
--- a/misc/asm_syntax.txt
+++ b/misc/asm_syntax.txt
@@ -225,7 +225,7 @@ bits:
sza = 0740200 " OPR: skip on zero AC
snl = 0740400 " OPR: skip on non-zero link
skp = 0741000 " OPR: skip unconditionally
- sna = 0741200 " OPR: skip on negative AC
+ sna = 0741200 " OPR: skip on non-zero AC
szl = 0741400 " OPR: skip on zero link
rtl = 0742010 " OPR: rotate two left
rtr = 0742020 " OPR: rotate two right
@@ -240,8 +240,8 @@ With some limitations, OPR instructions can be OR-ed together.
order in the source!!):
sna cla " skip on negative AC, clear AC
- sna spa " skip on negative or positive AC
- sna ral " skip on negative AC, rotate AC left
+ sna spa " skip on non-zero or positive AC(??)
+ sna ral " skip on non-zero AC, rotate AC left
cla cll sza " skip on AC zero, clear AC, clear LINK
The last "operate" instruction is not microcoded:
diff --git a/pdp7parse/.gitignore b/pdp7parse/.gitignore
new file mode 100644
index 0000000..b04c3c2
--- /dev/null
+++ b/pdp7parse/.gitignore
@@ -0,0 +1,8 @@
+/**/*.log
+/**/.DS_Store
+/**/.project
+/**/.classpath
+/**/.settings/
+/**/target
+/**/test-output
+ANTLRv4Lexer.g4
diff --git a/pdp7parse/README.md b/pdp7parse/README.md
new file mode 100644
index 0000000..091723c
--- /dev/null
+++ b/pdp7parse/README.md
@@ -0,0 +1,7 @@
+PDP7Parse
+---
+
+PDP7Parse is an example of parsing PDP7 using an [Antlr4](http://www.antlr.org/) grammar. The authoritative home of the grammar file is on Antlr4 [grammars-v4](https://github.com/antlr/grammars-v4) tree.
+
+PDP7Parse could be extended to implement a simple assembler for pdp7-unix.
+
diff --git a/pdp7parse/pom.xml b/pdp7parse/pom.xml
new file mode 100644
index 0000000..07bd220
--- /dev/null
+++ b/pdp7parse/pom.xml
@@ -0,0 +1,58 @@
+
+ 4.0.0
+ com.khubla.pdp7
+ pdp7parse
+ jar
+ khubla.com PDP7 Parser
+ 1.0
+
+ 4.5
+
+
+
+ commons-cli
+ commons-cli
+ 1.2
+ jar
+ compile
+
+
+ org.antlr
+ antlr4-runtime
+ ${antlr.version}
+ jar
+ compile
+
+
+ commons-io
+ commons-io
+ 2.4
+
+
+ junit
+ junit
+ 4.11
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.6
+ 1.6
+
+
+
+ org.antlr
+ antlr4-maven-plugin
+ ${antlr.version}
+
+ pdp7.g4
+ src/main/java
+
+
+
+
+
diff --git a/pdp7parse/src/main/antlr4/com/khubla/pdp7parse/antlr4/pdp7.g4 b/pdp7parse/src/main/antlr4/com/khubla/pdp7parse/antlr4/pdp7.g4
new file mode 100644
index 0000000..81c8713
--- /dev/null
+++ b/pdp7parse/src/main/antlr4/com/khubla/pdp7parse/antlr4/pdp7.g4
@@ -0,0 +1,281 @@
+/*
+BSD License
+
+Copyright (c) 2013, Tom Everett
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of Tom Everett nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+grammar pdp7;
+
+prog
+ : line +
+ ;
+
+line
+ : declarations? comment? eol
+ ;
+
+declarations
+ : declaration (';' declaration)*
+ ;
+
+// multiple labels can occur on the same line
+declaration
+ : label* (instruction | assignment | expression)*
+ ;
+
+instruction
+ : opcode argument*
+ ;
+
+argument
+ : expression
+ ;
+
+assignment
+ : (variable | LOC | RELOC) '=' expression
+ ;
+
+expression
+ : multiplyingExpression ((PLUS | MINUS) multiplyingExpression)*
+ ;
+
+multiplyingExpression
+ : atom ((TIMES | DIV) atom)*
+ ;
+
+atom
+ : variable
+ | LOC
+ | RELOC
+ | string
+ | DECIMAL
+ | DECIMAL_MINUS
+ | OCTAL
+ | signednumber
+ ;
+
+// string chars, then potentially more than 1 octal constant, then potentially '>'
+string
+ : STRING NUMERIC_LITERAL* '>'?
+ ;
+
+signednumber
+ : '-'? NUMERIC_LITERAL
+ ;
+
+eol
+ : EOL
+ ;
+
+comment
+ : COMMENT
+ ;
+
+label
+ : LABEL
+ ;
+
+variable
+ : IDENTIFIER
+ ;
+
+opcode
+ : 'dac'
+ | 'jms'
+ | 'dzm'
+ | 'lac'
+ | 'xor'
+ | 'add'
+ | 'tad'
+ | 'xct'
+ | 'isz'
+ | 'and'
+ | 'sad'
+ | 'jmp'
+ | 'nop'
+// | 'i'
+ | 'law'
+ | 'cma'
+ | 'las'
+ | 'ral'
+ | 'rar'
+ | 'hlt'
+ | 'sma'
+ | 'sza'
+ | 'snl'
+ | 'skp'
+ | 'sna'
+ | 'szl'
+ | 'rtl'
+ | 'rtr'
+ | 'cil'
+ | 'rcl'
+ | 'rcr'
+ | 'cia'
+ | 'lrs'
+ | 'lrss'
+ | 'lls'
+ | 'llss'
+ | 'als'
+ | 'alss'
+ | 'mul'
+ | 'idiv'
+ | 'lacq'
+ | 'clq'
+ | 'omq'
+ | 'cmq'
+ | 'lmq'
+ | 'dscs'
+ | 'dslw'
+ | 'dslm'
+ | 'dsld'
+ | 'dsls'
+ | 'dssf'
+ | 'dsrs'
+ | 'iof'
+ | 'ion'
+ | 'caf'
+ | 'clon'
+ | 'clsf'
+ | 'clof'
+ | 'ksf'
+ | 'krb'
+ | 'tsf'
+ | 'tcf'
+ | 'tls'
+ | 'sck'
+ | 'cck'
+ | 'lck'
+ | 'rsf'
+ | 'rsa'
+ | 'rrb'
+ | 'psf'
+ | 'pcf'
+ | 'psa'
+ | 'cdf'
+ | 'rlpd'
+ | 'lda'
+ | 'wcga'
+ | 'raef'
+ | 'rlpd'
+ | 'beg'
+ | 'spb'
+ | 'cpb'
+ | 'lpb'
+ | 'wbl'
+ | 'dprs'
+ | 'dpsf'
+ | 'dpcf'
+ | 'dprc'
+ | 'crsf'
+ | 'crrb'
+ | 'sys'
+ | 'czm'
+ | 'irss'
+ | 'dsm'
+ ;
+
+LOC
+ : '.'
+ ;
+
+
+RELOC
+ : '..'
+ ;
+
+
+PLUS
+ : '+'
+ ;
+
+
+MINUS
+ : '-'
+ ;
+
+
+TIMES
+ : '*'
+ ;
+
+
+DIV
+ : '/'
+ ;
+
+
+LABEL
+ : [a-zA-Z0-9.] + ':'
+ ;
+
+
+// the period is considered a letter
+IDENTIFIER
+ : [a-zA-Z] [a-zA-Z0-9.]*
+ ;
+
+
+NUMERIC_LITERAL
+ : [0-9][0-9a-f]*
+ ;
+
+DECIMAL
+ : 'd' [0-9] +
+ ;
+
+
+OCTAL
+ : 'o' [0-7] +
+ ;
+
+
+DECIMAL_MINUS
+ : 'dm' [0-9] +
+ ;
+
+
+STRING
+ : '<' [a-zA-Z0-9$*,%/]*
+ ;
+
+
+COMMENT
+ : '"' ~ [\r\n]*
+ ;
+
+
+EOL
+ : [\r\n]+
+ ;
+
+
+WS
+ : [ \t] -> skip
+ ;
diff --git a/pdp7parse/src/main/java/com/khubla/pdp7parse/PDP7Parse.java b/pdp7parse/src/main/java/com/khubla/pdp7parse/PDP7Parse.java
new file mode 100644
index 0000000..d12ebf1
--- /dev/null
+++ b/pdp7parse/src/main/java/com/khubla/pdp7parse/PDP7Parse.java
@@ -0,0 +1,62 @@
+package com.khubla.pdp7parse;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+
+/**
+ * @author tom
+ */
+public class PDP7Parse {
+ public static void main(String[] args) {
+ try {
+ System.out.println("khubla.com PDP7 Parser");
+ /*
+ * options
+ */
+ final Options options = new Options();
+ OptionBuilder.withArgName(INPUT_FILE_OPTION);
+ OptionBuilder.isRequired();
+ OptionBuilder.withType(String.class);
+ OptionBuilder.hasArg();
+ OptionBuilder.withDescription("file to read");
+ final Option ifo = OptionBuilder.create(INPUT_FILE_OPTION);
+ options.addOption(ifo);
+ /*
+ * parse
+ */
+ final CommandLineParser parser = new PosixParser();
+ CommandLine cmd = null;
+ try {
+ cmd = parser.parse(options, args);
+ } catch (final Exception e) {
+ e.printStackTrace();
+ final HelpFormatter formatter = new HelpFormatter();
+ formatter.printHelp("posix", options);
+ System.exit(0);
+ }
+ /*
+ * get file
+ */
+ final String inputFileName = cmd.getOptionValue(INPUT_FILE_OPTION);
+ final File inputFile = new File(inputFileName);
+ if (inputFile.exists()) {
+ PDP7Parser.parse(new FileInputStream(inputFile), System.out);
+ }
+ } catch (final Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * file option
+ */
+ private static final String INPUT_FILE_OPTION = "file";
+}
\ No newline at end of file
diff --git a/pdp7parse/src/main/java/com/khubla/pdp7parse/PDP7Parser.java b/pdp7parse/src/main/java/com/khubla/pdp7parse/PDP7Parser.java
new file mode 100644
index 0000000..62aac41
--- /dev/null
+++ b/pdp7parse/src/main/java/com/khubla/pdp7parse/PDP7Parser.java
@@ -0,0 +1,31 @@
+package com.khubla.pdp7parse;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+
+import org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.CommonTokenStream;
+
+import com.khubla.pdp7parse.antlr4.pdp7Lexer;
+import com.khubla.pdp7parse.antlr4.pdp7Parser;
+import com.khubla.pdp7parse.antlr4.pdp7Parser.ProgContext;
+
+public class PDP7Parser {
+ public static ProgContext parse(InputStream inputStream, OutputStream outputStream) throws Exception {
+ try {
+ if (null != inputStream) {
+ final Reader reader = new InputStreamReader(inputStream, "UTF-8");
+ final pdp7Lexer lexer = new pdp7Lexer(new ANTLRInputStream(reader));
+ final CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
+ final pdp7Parser parser = new pdp7Parser(commonTokenStream);
+ return parser.prog();
+ } else {
+ throw new IllegalArgumentException();
+ }
+ } catch (final Exception e) {
+ throw new Exception("Exception reading and parsing file", e);
+ }
+ }
+}
diff --git a/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7BaseListener.java b/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7BaseListener.java
new file mode 100644
index 0000000..803d80f
--- /dev/null
+++ b/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7BaseListener.java
@@ -0,0 +1,244 @@
+// Generated from com/khubla/pdp7parse/antlr4/pdp7.g4 by ANTLR 4.5
+package com.khubla.pdp7parse.antlr4;
+
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.antlr.v4.runtime.misc.NotNull;
+import org.antlr.v4.runtime.tree.ErrorNode;
+import org.antlr.v4.runtime.tree.TerminalNode;
+
+/**
+ * This class provides an empty implementation of {@link pdp7Listener},
+ * which can be extended to create a listener which only needs to handle a subset
+ * of the available methods.
+ */
+public class pdp7BaseListener implements pdp7Listener {
+ /**
+ * {@inheritDoc}
+ *
+ *
The default implementation does nothing.
+ */
+ @Override public void enterProg(pdp7Parser.ProgContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitProg(pdp7Parser.ProgContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLine(pdp7Parser.LineContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLine(pdp7Parser.LineContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterDeclarations(pdp7Parser.DeclarationsContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitDeclarations(pdp7Parser.DeclarationsContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterDeclaration(pdp7Parser.DeclarationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitDeclaration(pdp7Parser.DeclarationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterInstruction(pdp7Parser.InstructionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitInstruction(pdp7Parser.InstructionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterArgument(pdp7Parser.ArgumentContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitArgument(pdp7Parser.ArgumentContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterAssignment(pdp7Parser.AssignmentContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitAssignment(pdp7Parser.AssignmentContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterExpression(pdp7Parser.ExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitExpression(pdp7Parser.ExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterMultiplyingExpression(pdp7Parser.MultiplyingExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitMultiplyingExpression(pdp7Parser.MultiplyingExpressionContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterAtom(pdp7Parser.AtomContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitAtom(pdp7Parser.AtomContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterString(pdp7Parser.StringContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitString(pdp7Parser.StringContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterSignednumber(pdp7Parser.SignednumberContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitSignednumber(pdp7Parser.SignednumberContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterEol(pdp7Parser.EolContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitEol(pdp7Parser.EolContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterComment(pdp7Parser.CommentContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitComment(pdp7Parser.CommentContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterLabel(pdp7Parser.LabelContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitLabel(pdp7Parser.LabelContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterVariable(pdp7Parser.VariableContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitVariable(pdp7Parser.VariableContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterOpcode(pdp7Parser.OpcodeContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitOpcode(pdp7Parser.OpcodeContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterEveryRule(ParserRuleContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitEveryRule(ParserRuleContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void visitTerminal(TerminalNode node) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void visitErrorNode(ErrorNode node) { }
+}
\ No newline at end of file
diff --git a/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7Lexer.java b/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7Lexer.java
new file mode 100644
index 0000000..56725ff
--- /dev/null
+++ b/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7Lexer.java
@@ -0,0 +1,372 @@
+// Generated from com/khubla/pdp7parse/antlr4/pdp7.g4 by ANTLR 4.5
+package com.khubla.pdp7parse.antlr4;
+import org.antlr.v4.runtime.Lexer;
+import org.antlr.v4.runtime.CharStream;
+import org.antlr.v4.runtime.Token;
+import org.antlr.v4.runtime.TokenStream;
+import org.antlr.v4.runtime.*;
+import org.antlr.v4.runtime.atn.*;
+import org.antlr.v4.runtime.dfa.DFA;
+import org.antlr.v4.runtime.misc.*;
+
+@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
+public class pdp7Lexer extends Lexer {
+ static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
+
+ protected static final DFA[] _decisionToDFA;
+ protected static final PredictionContextCache _sharedContextCache =
+ 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, T__14=15, T__15=16, T__16=17,
+ T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
+ T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
+ T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, T__37=38,
+ T__38=39, T__39=40, T__40=41, T__41=42, T__42=43, T__43=44, T__44=45,
+ T__45=46, T__46=47, T__47=48, T__48=49, T__49=50, T__50=51, T__51=52,
+ T__52=53, T__53=54, T__54=55, T__55=56, T__56=57, T__57=58, T__58=59,
+ T__59=60, T__60=61, T__61=62, T__62=63, T__63=64, T__64=65, T__65=66,
+ T__66=67, T__67=68, T__68=69, T__69=70, T__70=71, T__71=72, T__72=73,
+ T__73=74, T__74=75, T__75=76, T__76=77, T__77=78, T__78=79, T__79=80,
+ T__80=81, T__81=82, T__82=83, T__83=84, T__84=85, T__85=86, T__86=87,
+ T__87=88, T__88=89, T__89=90, T__90=91, T__91=92, T__92=93, T__93=94,
+ LOC=95, RELOC=96, PLUS=97, MINUS=98, TIMES=99, DIV=100, LABEL=101, IDENTIFIER=102,
+ NUMERIC_LITERAL=103, DECIMAL=104, OCTAL=105, DECIMAL_MINUS=106, STRING=107,
+ COMMENT=108, EOL=109, WS=110;
+ public static String[] modeNames = {
+ "DEFAULT_MODE"
+ };
+
+ public static final String[] ruleNames = {
+ "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", "T__14", "T__15", "T__16",
+ "T__17", "T__18", "T__19", "T__20", "T__21", "T__22", "T__23", "T__24",
+ "T__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32",
+ "T__33", "T__34", "T__35", "T__36", "T__37", "T__38", "T__39", "T__40",
+ "T__41", "T__42", "T__43", "T__44", "T__45", "T__46", "T__47", "T__48",
+ "T__49", "T__50", "T__51", "T__52", "T__53", "T__54", "T__55", "T__56",
+ "T__57", "T__58", "T__59", "T__60", "T__61", "T__62", "T__63", "T__64",
+ "T__65", "T__66", "T__67", "T__68", "T__69", "T__70", "T__71", "T__72",
+ "T__73", "T__74", "T__75", "T__76", "T__77", "T__78", "T__79", "T__80",
+ "T__81", "T__82", "T__83", "T__84", "T__85", "T__86", "T__87", "T__88",
+ "T__89", "T__90", "T__91", "T__92", "T__93", "LOC", "RELOC", "PLUS", "MINUS",
+ "TIMES", "DIV", "LABEL", "IDENTIFIER", "NUMERIC_LITERAL", "DECIMAL", "OCTAL",
+ "DECIMAL_MINUS", "STRING", "COMMENT", "EOL", "WS"
+ };
+
+ private static final String[] _LITERAL_NAMES = {
+ null, "';'", "'='", "'>'", "'dac'", "'jms'", "'dzm'", "'lac'", "'xor'",
+ "'add'", "'tad'", "'xct'", "'isz'", "'and'", "'sad'", "'jmp'", "'nop'",
+ "'law'", "'cma'", "'las'", "'ral'", "'rar'", "'hlt'", "'sma'", "'sza'",
+ "'snl'", "'skp'", "'sna'", "'szl'", "'rtl'", "'rtr'", "'cil'", "'rcl'",
+ "'rcr'", "'cia'", "'lrs'", "'lrss'", "'lls'", "'llss'", "'als'", "'alss'",
+ "'mul'", "'idiv'", "'lacq'", "'clq'", "'omq'", "'cmq'", "'lmq'", "'dscs'",
+ "'dslw'", "'dslm'", "'dsld'", "'dsls'", "'dssf'", "'dsrs'", "'iof'", "'ion'",
+ "'caf'", "'clon'", "'clsf'", "'clof'", "'ksf'", "'krb'", "'tsf'", "'tcf'",
+ "'tls'", "'sck'", "'cck'", "'lck'", "'rsf'", "'rsa'", "'rrb'", "'psf'",
+ "'pcf'", "'psa'", "'cdf'", "'rlpd'", "'lda'", "'wcga'", "'raef'", "'beg'",
+ "'spb'", "'cpb'", "'lpb'", "'wbl'", "'dprs'", "'dpsf'", "'dpcf'", "'dprc'",
+ "'crsf'", "'crrb'", "'sys'", "'czm'", "'irss'", "'dsm'", "'.'", "'..'",
+ "'+'", "'-'", "'*'", "'/'"
+ };
+ private static final String[] _SYMBOLIC_NAMES = {
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, "LOC",
+ "RELOC", "PLUS", "MINUS", "TIMES", "DIV", "LABEL", "IDENTIFIER", "NUMERIC_LITERAL",
+ "DECIMAL", "OCTAL", "DECIMAL_MINUS", "STRING", "COMMENT", "EOL", "WS"
+ };
+ public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
+
+ /**
+ * @deprecated Use {@link #VOCABULARY} instead.
+ */
+ @Deprecated
+ public static final String[] tokenNames;
+ static {
+ tokenNames = new String[_SYMBOLIC_NAMES.length];
+ for (int i = 0; i < tokenNames.length; i++) {
+ tokenNames[i] = VOCABULARY.getLiteralName(i);
+ if (tokenNames[i] == null) {
+ tokenNames[i] = VOCABULARY.getSymbolicName(i);
+ }
+
+ if (tokenNames[i] == null) {
+ tokenNames[i] = "";
+ }
+ }
+ }
+
+ @Override
+ @Deprecated
+ public String[] getTokenNames() {
+ return tokenNames;
+ }
+
+ @Override
+
+ public Vocabulary getVocabulary() {
+ return VOCABULARY;
+ }
+
+
+ public pdp7Lexer(CharStream input) {
+ super(input);
+ _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+ }
+
+ @Override
+ public String getGrammarFileName() { return "pdp7.g4"; }
+
+ @Override
+ public String[] getRuleNames() { return ruleNames; }
+
+ @Override
+ public String getSerializedATN() { return _serializedATN; }
+
+ @Override
+ public String[] getModeNames() { return modeNames; }
+
+ @Override
+ public ATN getATN() { return _ATN; }
+
+ public static final String _serializedATN =
+ "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2p\u02b7\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"+
+ "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+
+ "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4"+
+ ",\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t"+
+ "\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t="+
+ "\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I"+
+ "\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT"+
+ "\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_\4"+
+ "`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k\t"+
+ "k\4l\tl\4m\tm\4n\tn\4o\to\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\5\3\5\3\6"+
+ "\3\6\3\6\3\6\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\n\3\n\3"+
+ "\n\3\n\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\16\3\16\3"+
+ "\16\3\16\3\17\3\17\3\17\3\17\3\20\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\23\3\23\3\24\3\24\3\24\3\24\3\25\3\25\3"+
+ "\25\3\25\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\27\3\30\3\30\3\30\3\30\3"+
+ "\31\3\31\3\31\3\31\3\32\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3\34\3\34\3"+
+ "\34\3\34\3\35\3\35\3\35\3\35\3\36\3\36\3\36\3\36\3\37\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.\3/\3/"+
+ "\3/\3/\3\60\3\60\3\60\3\60\3\61\3\61\3\61\3\61\3\61\3\62\3\62\3\62\3\62"+
+ "\3\62\3\63\3\63\3\63\3\63\3\63\3\64\3\64\3\64\3\64\3\64\3\65\3\65\3\65"+
+ "\3\65\3\65\3\66\3\66\3\66\3\66\3\66\3\67\3\67\3\67\3\67\3\67\38\38\38"+
+ "\38\39\39\39\39\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@\3A\3A\3A\3A\3B\3B\3B\3B\3C\3C"+
+ "\3C\3C\3D\3D\3D\3D\3E\3E\3E\3E\3F\3F\3F\3F\3G\3G\3G\3G\3H\3H\3H\3H\3I"+
+ "\3I\3I\3I\3J\3J\3J\3J\3K\3K\3K\3K\3L\3L\3L\3L\3M\3M\3M\3M\3M\3N\3N\3N"+
+ "\3N\3O\3O\3O\3O\3O\3P\3P\3P\3P\3P\3Q\3Q\3Q\3Q\3R\3R\3R\3R\3S\3S\3S\3S"+
+ "\3T\3T\3T\3T\3U\3U\3U\3U\3V\3V\3V\3V\3V\3W\3W\3W\3W\3W\3X\3X\3X\3X\3X"+
+ "\3Y\3Y\3Y\3Y\3Y\3Z\3Z\3Z\3Z\3Z\3[\3[\3[\3[\3[\3\\\3\\\3\\\3\\\3]\3]\3"+
+ "]\3]\3^\3^\3^\3^\3^\3_\3_\3_\3_\3`\3`\3a\3a\3a\3b\3b\3c\3c\3d\3d\3e\3"+
+ "e\3f\6f\u0279\nf\rf\16f\u027a\3f\3f\3g\3g\7g\u0281\ng\fg\16g\u0284\13"+
+ "g\3h\3h\7h\u0288\nh\fh\16h\u028b\13h\3i\3i\6i\u028f\ni\ri\16i\u0290\3"+
+ "j\3j\6j\u0295\nj\rj\16j\u0296\3k\3k\3k\3k\6k\u029d\nk\rk\16k\u029e\3l"+
+ "\3l\7l\u02a3\nl\fl\16l\u02a6\13l\3m\3m\7m\u02aa\nm\fm\16m\u02ad\13m\3"+
+ "n\6n\u02b0\nn\rn\16n\u02b1\3o\3o\3o\3o\2\2p\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\67m8o9q:s;u{?}@\177A\u0081"+
+ "B\u0083C\u0085D\u0087E\u0089F\u008bG\u008dH\u008fI\u0091J\u0093K\u0095"+
+ "L\u0097M\u0099N\u009bO\u009dP\u009fQ\u00a1R\u00a3S\u00a5T\u00a7U\u00a9"+
+ "V\u00abW\u00adX\u00afY\u00b1Z\u00b3[\u00b5\\\u00b7]\u00b9^\u00bb_\u00bd"+
+ "`\u00bfa\u00c1b\u00c3c\u00c5d\u00c7e\u00c9f\u00cbg\u00cdh\u00cfi\u00d1"+
+ "j\u00d3k\u00d5l\u00d7m\u00d9n\u00dbo\u00ddp\3\2\n\6\2\60\60\62;C\\c|\4"+
+ "\2C\\c|\3\2\62;\4\2\62;ch\3\2\629\b\2&\',,..\61;C\\c|\4\2\f\f\17\17\4"+
+ "\2\13\13\"\"\u02bf\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\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\177\3\2\2\2\2\u0081\3\2\2\2\2"+
+ "\u0083\3\2\2\2\2\u0085\3\2\2\2\2\u0087\3\2\2\2\2\u0089\3\2\2\2\2\u008b"+
+ "\3\2\2\2\2\u008d\3\2\2\2\2\u008f\3\2\2\2\2\u0091\3\2\2\2\2\u0093\3\2\2"+
+ "\2\2\u0095\3\2\2\2\2\u0097\3\2\2\2\2\u0099\3\2\2\2\2\u009b\3\2\2\2\2\u009d"+
+ "\3\2\2\2\2\u009f\3\2\2\2\2\u00a1\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2"+
+ "\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2\2\2\u00ab\3\2\2\2\2\u00ad\3\2\2\2\2\u00af"+
+ "\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3\3\2\2\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2"+
+ "\2\2\u00b9\3\2\2\2\2\u00bb\3\2\2\2\2\u00bd\3\2\2\2\2\u00bf\3\2\2\2\2\u00c1"+
+ "\3\2\2\2\2\u00c3\3\2\2\2\2\u00c5\3\2\2\2\2\u00c7\3\2\2\2\2\u00c9\3\2\2"+
+ "\2\2\u00cb\3\2\2\2\2\u00cd\3\2\2\2\2\u00cf\3\2\2\2\2\u00d1\3\2\2\2\2\u00d3"+
+ "\3\2\2\2\2\u00d5\3\2\2\2\2\u00d7\3\2\2\2\2\u00d9\3\2\2\2\2\u00db\3\2\2"+
+ "\2\2\u00dd\3\2\2\2\3\u00df\3\2\2\2\5\u00e1\3\2\2\2\7\u00e3\3\2\2\2\t\u00e5"+
+ "\3\2\2\2\13\u00e9\3\2\2\2\r\u00ed\3\2\2\2\17\u00f1\3\2\2\2\21\u00f5\3"+
+ "\2\2\2\23\u00f9\3\2\2\2\25\u00fd\3\2\2\2\27\u0101\3\2\2\2\31\u0105\3\2"+
+ "\2\2\33\u0109\3\2\2\2\35\u010d\3\2\2\2\37\u0111\3\2\2\2!\u0115\3\2\2\2"+
+ "#\u0119\3\2\2\2%\u011d\3\2\2\2\'\u0121\3\2\2\2)\u0125\3\2\2\2+\u0129\3"+
+ "\2\2\2-\u012d\3\2\2\2/\u0131\3\2\2\2\61\u0135\3\2\2\2\63\u0139\3\2\2\2"+
+ "\65\u013d\3\2\2\2\67\u0141\3\2\2\29\u0145\3\2\2\2;\u0149\3\2\2\2=\u014d"+
+ "\3\2\2\2?\u0151\3\2\2\2A\u0155\3\2\2\2C\u0159\3\2\2\2E\u015d\3\2\2\2G"+
+ "\u0161\3\2\2\2I\u0165\3\2\2\2K\u016a\3\2\2\2M\u016e\3\2\2\2O\u0173\3\2"+
+ "\2\2Q\u0177\3\2\2\2S\u017c\3\2\2\2U\u0180\3\2\2\2W\u0185\3\2\2\2Y\u018a"+
+ "\3\2\2\2[\u018e\3\2\2\2]\u0192\3\2\2\2_\u0196\3\2\2\2a\u019a\3\2\2\2c"+
+ "\u019f\3\2\2\2e\u01a4\3\2\2\2g\u01a9\3\2\2\2i\u01ae\3\2\2\2k\u01b3\3\2"+
+ "\2\2m\u01b8\3\2\2\2o\u01bd\3\2\2\2q\u01c1\3\2\2\2s\u01c5\3\2\2\2u\u01c9"+
+ "\3\2\2\2w\u01ce\3\2\2\2y\u01d3\3\2\2\2{\u01d8\3\2\2\2}\u01dc\3\2\2\2\177"+
+ "\u01e0\3\2\2\2\u0081\u01e4\3\2\2\2\u0083\u01e8\3\2\2\2\u0085\u01ec\3\2"+
+ "\2\2\u0087\u01f0\3\2\2\2\u0089\u01f4\3\2\2\2\u008b\u01f8\3\2\2\2\u008d"+
+ "\u01fc\3\2\2\2\u008f\u0200\3\2\2\2\u0091\u0204\3\2\2\2\u0093\u0208\3\2"+
+ "\2\2\u0095\u020c\3\2\2\2\u0097\u0210\3\2\2\2\u0099\u0214\3\2\2\2\u009b"+
+ "\u0219\3\2\2\2\u009d\u021d\3\2\2\2\u009f\u0222\3\2\2\2\u00a1\u0227\3\2"+
+ "\2\2\u00a3\u022b\3\2\2\2\u00a5\u022f\3\2\2\2\u00a7\u0233\3\2\2\2\u00a9"+
+ "\u0237\3\2\2\2\u00ab\u023b\3\2\2\2\u00ad\u0240\3\2\2\2\u00af\u0245\3\2"+
+ "\2\2\u00b1\u024a\3\2\2\2\u00b3\u024f\3\2\2\2\u00b5\u0254\3\2\2\2\u00b7"+
+ "\u0259\3\2\2\2\u00b9\u025d\3\2\2\2\u00bb\u0261\3\2\2\2\u00bd\u0266\3\2"+
+ "\2\2\u00bf\u026a\3\2\2\2\u00c1\u026c\3\2\2\2\u00c3\u026f\3\2\2\2\u00c5"+
+ "\u0271\3\2\2\2\u00c7\u0273\3\2\2\2\u00c9\u0275\3\2\2\2\u00cb\u0278\3\2"+
+ "\2\2\u00cd\u027e\3\2\2\2\u00cf\u0285\3\2\2\2\u00d1\u028c\3\2\2\2\u00d3"+
+ "\u0292\3\2\2\2\u00d5\u0298\3\2\2\2\u00d7\u02a0\3\2\2\2\u00d9\u02a7\3\2"+
+ "\2\2\u00db\u02af\3\2\2\2\u00dd\u02b3\3\2\2\2\u00df\u00e0\7=\2\2\u00e0"+
+ "\4\3\2\2\2\u00e1\u00e2\7?\2\2\u00e2\6\3\2\2\2\u00e3\u00e4\7@\2\2\u00e4"+
+ "\b\3\2\2\2\u00e5\u00e6\7f\2\2\u00e6\u00e7\7c\2\2\u00e7\u00e8\7e\2\2\u00e8"+
+ "\n\3\2\2\2\u00e9\u00ea\7l\2\2\u00ea\u00eb\7o\2\2\u00eb\u00ec\7u\2\2\u00ec"+
+ "\f\3\2\2\2\u00ed\u00ee\7f\2\2\u00ee\u00ef\7|\2\2\u00ef\u00f0\7o\2\2\u00f0"+
+ "\16\3\2\2\2\u00f1\u00f2\7n\2\2\u00f2\u00f3\7c\2\2\u00f3\u00f4\7e\2\2\u00f4"+
+ "\20\3\2\2\2\u00f5\u00f6\7z\2\2\u00f6\u00f7\7q\2\2\u00f7\u00f8\7t\2\2\u00f8"+
+ "\22\3\2\2\2\u00f9\u00fa\7c\2\2\u00fa\u00fb\7f\2\2\u00fb\u00fc\7f\2\2\u00fc"+
+ "\24\3\2\2\2\u00fd\u00fe\7v\2\2\u00fe\u00ff\7c\2\2\u00ff\u0100\7f\2\2\u0100"+
+ "\26\3\2\2\2\u0101\u0102\7z\2\2\u0102\u0103\7e\2\2\u0103\u0104\7v\2\2\u0104"+
+ "\30\3\2\2\2\u0105\u0106\7k\2\2\u0106\u0107\7u\2\2\u0107\u0108\7|\2\2\u0108"+
+ "\32\3\2\2\2\u0109\u010a\7c\2\2\u010a\u010b\7p\2\2\u010b\u010c\7f\2\2\u010c"+
+ "\34\3\2\2\2\u010d\u010e\7u\2\2\u010e\u010f\7c\2\2\u010f\u0110\7f\2\2\u0110"+
+ "\36\3\2\2\2\u0111\u0112\7l\2\2\u0112\u0113\7o\2\2\u0113\u0114\7r\2\2\u0114"+
+ " \3\2\2\2\u0115\u0116\7p\2\2\u0116\u0117\7q\2\2\u0117\u0118\7r\2\2\u0118"+
+ "\"\3\2\2\2\u0119\u011a\7n\2\2\u011a\u011b\7c\2\2\u011b\u011c\7y\2\2\u011c"+
+ "$\3\2\2\2\u011d\u011e\7e\2\2\u011e\u011f\7o\2\2\u011f\u0120\7c\2\2\u0120"+
+ "&\3\2\2\2\u0121\u0122\7n\2\2\u0122\u0123\7c\2\2\u0123\u0124\7u\2\2\u0124"+
+ "(\3\2\2\2\u0125\u0126\7t\2\2\u0126\u0127\7c\2\2\u0127\u0128\7n\2\2\u0128"+
+ "*\3\2\2\2\u0129\u012a\7t\2\2\u012a\u012b\7c\2\2\u012b\u012c\7t\2\2\u012c"+
+ ",\3\2\2\2\u012d\u012e\7j\2\2\u012e\u012f\7n\2\2\u012f\u0130\7v\2\2\u0130"+
+ ".\3\2\2\2\u0131\u0132\7u\2\2\u0132\u0133\7o\2\2\u0133\u0134\7c\2\2\u0134"+
+ "\60\3\2\2\2\u0135\u0136\7u\2\2\u0136\u0137\7|\2\2\u0137\u0138\7c\2\2\u0138"+
+ "\62\3\2\2\2\u0139\u013a\7u\2\2\u013a\u013b\7p\2\2\u013b\u013c\7n\2\2\u013c"+
+ "\64\3\2\2\2\u013d\u013e\7u\2\2\u013e\u013f\7m\2\2\u013f\u0140\7r\2\2\u0140"+
+ "\66\3\2\2\2\u0141\u0142\7u\2\2\u0142\u0143\7p\2\2\u0143\u0144\7c\2\2\u0144"+
+ "8\3\2\2\2\u0145\u0146\7u\2\2\u0146\u0147\7|\2\2\u0147\u0148\7n\2\2\u0148"+
+ ":\3\2\2\2\u0149\u014a\7t\2\2\u014a\u014b\7v\2\2\u014b\u014c\7n\2\2\u014c"+
+ "<\3\2\2\2\u014d\u014e\7t\2\2\u014e\u014f\7v\2\2\u014f\u0150\7t\2\2\u0150"+
+ ">\3\2\2\2\u0151\u0152\7e\2\2\u0152\u0153\7k\2\2\u0153\u0154\7n\2\2\u0154"+
+ "@\3\2\2\2\u0155\u0156\7t\2\2\u0156\u0157\7e\2\2\u0157\u0158\7n\2\2\u0158"+
+ "B\3\2\2\2\u0159\u015a\7t\2\2\u015a\u015b\7e\2\2\u015b\u015c\7t\2\2\u015c"+
+ "D\3\2\2\2\u015d\u015e\7e\2\2\u015e\u015f\7k\2\2\u015f\u0160\7c\2\2\u0160"+
+ "F\3\2\2\2\u0161\u0162\7n\2\2\u0162\u0163\7t\2\2\u0163\u0164\7u\2\2\u0164"+
+ "H\3\2\2\2\u0165\u0166\7n\2\2\u0166\u0167\7t\2\2\u0167\u0168\7u\2\2\u0168"+
+ "\u0169\7u\2\2\u0169J\3\2\2\2\u016a\u016b\7n\2\2\u016b\u016c\7n\2\2\u016c"+
+ "\u016d\7u\2\2\u016dL\3\2\2\2\u016e\u016f\7n\2\2\u016f\u0170\7n\2\2\u0170"+
+ "\u0171\7u\2\2\u0171\u0172\7u\2\2\u0172N\3\2\2\2\u0173\u0174\7c\2\2\u0174"+
+ "\u0175\7n\2\2\u0175\u0176\7u\2\2\u0176P\3\2\2\2\u0177\u0178\7c\2\2\u0178"+
+ "\u0179\7n\2\2\u0179\u017a\7u\2\2\u017a\u017b\7u\2\2\u017bR\3\2\2\2\u017c"+
+ "\u017d\7o\2\2\u017d\u017e\7w\2\2\u017e\u017f\7n\2\2\u017fT\3\2\2\2\u0180"+
+ "\u0181\7k\2\2\u0181\u0182\7f\2\2\u0182\u0183\7k\2\2\u0183\u0184\7x\2\2"+
+ "\u0184V\3\2\2\2\u0185\u0186\7n\2\2\u0186\u0187\7c\2\2\u0187\u0188\7e\2"+
+ "\2\u0188\u0189\7s\2\2\u0189X\3\2\2\2\u018a\u018b\7e\2\2\u018b\u018c\7"+
+ "n\2\2\u018c\u018d\7s\2\2\u018dZ\3\2\2\2\u018e\u018f\7q\2\2\u018f\u0190"+
+ "\7o\2\2\u0190\u0191\7s\2\2\u0191\\\3\2\2\2\u0192\u0193\7e\2\2\u0193\u0194"+
+ "\7o\2\2\u0194\u0195\7s\2\2\u0195^\3\2\2\2\u0196\u0197\7n\2\2\u0197\u0198"+
+ "\7o\2\2\u0198\u0199\7s\2\2\u0199`\3\2\2\2\u019a\u019b\7f\2\2\u019b\u019c"+
+ "\7u\2\2\u019c\u019d\7e\2\2\u019d\u019e\7u\2\2\u019eb\3\2\2\2\u019f\u01a0"+
+ "\7f\2\2\u01a0\u01a1\7u\2\2\u01a1\u01a2\7n\2\2\u01a2\u01a3\7y\2\2\u01a3"+
+ "d\3\2\2\2\u01a4\u01a5\7f\2\2\u01a5\u01a6\7u\2\2\u01a6\u01a7\7n\2\2\u01a7"+
+ "\u01a8\7o\2\2\u01a8f\3\2\2\2\u01a9\u01aa\7f\2\2\u01aa\u01ab\7u\2\2\u01ab"+
+ "\u01ac\7n\2\2\u01ac\u01ad\7f\2\2\u01adh\3\2\2\2\u01ae\u01af\7f\2\2\u01af"+
+ "\u01b0\7u\2\2\u01b0\u01b1\7n\2\2\u01b1\u01b2\7u\2\2\u01b2j\3\2\2\2\u01b3"+
+ "\u01b4\7f\2\2\u01b4\u01b5\7u\2\2\u01b5\u01b6\7u\2\2\u01b6\u01b7\7h\2\2"+
+ "\u01b7l\3\2\2\2\u01b8\u01b9\7f\2\2\u01b9\u01ba\7u\2\2\u01ba\u01bb\7t\2"+
+ "\2\u01bb\u01bc\7u\2\2\u01bcn\3\2\2\2\u01bd\u01be\7k\2\2\u01be\u01bf\7"+
+ "q\2\2\u01bf\u01c0\7h\2\2\u01c0p\3\2\2\2\u01c1\u01c2\7k\2\2\u01c2\u01c3"+
+ "\7q\2\2\u01c3\u01c4\7p\2\2\u01c4r\3\2\2\2\u01c5\u01c6\7e\2\2\u01c6\u01c7"+
+ "\7c\2\2\u01c7\u01c8\7h\2\2\u01c8t\3\2\2\2\u01c9\u01ca\7e\2\2\u01ca\u01cb"+
+ "\7n\2\2\u01cb\u01cc\7q\2\2\u01cc\u01cd\7p\2\2\u01cdv\3\2\2\2\u01ce\u01cf"+
+ "\7e\2\2\u01cf\u01d0\7n\2\2\u01d0\u01d1\7u\2\2\u01d1\u01d2\7h\2\2\u01d2"+
+ "x\3\2\2\2\u01d3\u01d4\7e\2\2\u01d4\u01d5\7n\2\2\u01d5\u01d6\7q\2\2\u01d6"+
+ "\u01d7\7h\2\2\u01d7z\3\2\2\2\u01d8\u01d9\7m\2\2\u01d9\u01da\7u\2\2\u01da"+
+ "\u01db\7h\2\2\u01db|\3\2\2\2\u01dc\u01dd\7m\2\2\u01dd\u01de\7t\2\2\u01de"+
+ "\u01df\7d\2\2\u01df~\3\2\2\2\u01e0\u01e1\7v\2\2\u01e1\u01e2\7u\2\2\u01e2"+
+ "\u01e3\7h\2\2\u01e3\u0080\3\2\2\2\u01e4\u01e5\7v\2\2\u01e5\u01e6\7e\2"+
+ "\2\u01e6\u01e7\7h\2\2\u01e7\u0082\3\2\2\2\u01e8\u01e9\7v\2\2\u01e9\u01ea"+
+ "\7n\2\2\u01ea\u01eb\7u\2\2\u01eb\u0084\3\2\2\2\u01ec\u01ed\7u\2\2\u01ed"+
+ "\u01ee\7e\2\2\u01ee\u01ef\7m\2\2\u01ef\u0086\3\2\2\2\u01f0\u01f1\7e\2"+
+ "\2\u01f1\u01f2\7e\2\2\u01f2\u01f3\7m\2\2\u01f3\u0088\3\2\2\2\u01f4\u01f5"+
+ "\7n\2\2\u01f5\u01f6\7e\2\2\u01f6\u01f7\7m\2\2\u01f7\u008a\3\2\2\2\u01f8"+
+ "\u01f9\7t\2\2\u01f9\u01fa\7u\2\2\u01fa\u01fb\7h\2\2\u01fb\u008c\3\2\2"+
+ "\2\u01fc\u01fd\7t\2\2\u01fd\u01fe\7u\2\2\u01fe\u01ff\7c\2\2\u01ff\u008e"+
+ "\3\2\2\2\u0200\u0201\7t\2\2\u0201\u0202\7t\2\2\u0202\u0203\7d\2\2\u0203"+
+ "\u0090\3\2\2\2\u0204\u0205\7r\2\2\u0205\u0206\7u\2\2\u0206\u0207\7h\2"+
+ "\2\u0207\u0092\3\2\2\2\u0208\u0209\7r\2\2\u0209\u020a\7e\2\2\u020a\u020b"+
+ "\7h\2\2\u020b\u0094\3\2\2\2\u020c\u020d\7r\2\2\u020d\u020e\7u\2\2\u020e"+
+ "\u020f\7c\2\2\u020f\u0096\3\2\2\2\u0210\u0211\7e\2\2\u0211\u0212\7f\2"+
+ "\2\u0212\u0213\7h\2\2\u0213\u0098\3\2\2\2\u0214\u0215\7t\2\2\u0215\u0216"+
+ "\7n\2\2\u0216\u0217\7r\2\2\u0217\u0218\7f\2\2\u0218\u009a\3\2\2\2\u0219"+
+ "\u021a\7n\2\2\u021a\u021b\7f\2\2\u021b\u021c\7c\2\2\u021c\u009c\3\2\2"+
+ "\2\u021d\u021e\7y\2\2\u021e\u021f\7e\2\2\u021f\u0220\7i\2\2\u0220\u0221"+
+ "\7c\2\2\u0221\u009e\3\2\2\2\u0222\u0223\7t\2\2\u0223\u0224\7c\2\2\u0224"+
+ "\u0225\7g\2\2\u0225\u0226\7h\2\2\u0226\u00a0\3\2\2\2\u0227\u0228\7d\2"+
+ "\2\u0228\u0229\7g\2\2\u0229\u022a\7i\2\2\u022a\u00a2\3\2\2\2\u022b\u022c"+
+ "\7u\2\2\u022c\u022d\7r\2\2\u022d\u022e\7d\2\2\u022e\u00a4\3\2\2\2\u022f"+
+ "\u0230\7e\2\2\u0230\u0231\7r\2\2\u0231\u0232\7d\2\2\u0232\u00a6\3\2\2"+
+ "\2\u0233\u0234\7n\2\2\u0234\u0235\7r\2\2\u0235\u0236\7d\2\2\u0236\u00a8"+
+ "\3\2\2\2\u0237\u0238\7y\2\2\u0238\u0239\7d\2\2\u0239\u023a\7n\2\2\u023a"+
+ "\u00aa\3\2\2\2\u023b\u023c\7f\2\2\u023c\u023d\7r\2\2\u023d\u023e\7t\2"+
+ "\2\u023e\u023f\7u\2\2\u023f\u00ac\3\2\2\2\u0240\u0241\7f\2\2\u0241\u0242"+
+ "\7r\2\2\u0242\u0243\7u\2\2\u0243\u0244\7h\2\2\u0244\u00ae\3\2\2\2\u0245"+
+ "\u0246\7f\2\2\u0246\u0247\7r\2\2\u0247\u0248\7e\2\2\u0248\u0249\7h\2\2"+
+ "\u0249\u00b0\3\2\2\2\u024a\u024b\7f\2\2\u024b\u024c\7r\2\2\u024c\u024d"+
+ "\7t\2\2\u024d\u024e\7e\2\2\u024e\u00b2\3\2\2\2\u024f\u0250\7e\2\2\u0250"+
+ "\u0251\7t\2\2\u0251\u0252\7u\2\2\u0252\u0253\7h\2\2\u0253\u00b4\3\2\2"+
+ "\2\u0254\u0255\7e\2\2\u0255\u0256\7t\2\2\u0256\u0257\7t\2\2\u0257\u0258"+
+ "\7d\2\2\u0258\u00b6\3\2\2\2\u0259\u025a\7u\2\2\u025a\u025b\7{\2\2\u025b"+
+ "\u025c\7u\2\2\u025c\u00b8\3\2\2\2\u025d\u025e\7e\2\2\u025e\u025f\7|\2"+
+ "\2\u025f\u0260\7o\2\2\u0260\u00ba\3\2\2\2\u0261\u0262\7k\2\2\u0262\u0263"+
+ "\7t\2\2\u0263\u0264\7u\2\2\u0264\u0265\7u\2\2\u0265\u00bc\3\2\2\2\u0266"+
+ "\u0267\7f\2\2\u0267\u0268\7u\2\2\u0268\u0269\7o\2\2\u0269\u00be\3\2\2"+
+ "\2\u026a\u026b\7\60\2\2\u026b\u00c0\3\2\2\2\u026c\u026d\7\60\2\2\u026d"+
+ "\u026e\7\60\2\2\u026e\u00c2\3\2\2\2\u026f\u0270\7-\2\2\u0270\u00c4\3\2"+
+ "\2\2\u0271\u0272\7/\2\2\u0272\u00c6\3\2\2\2\u0273\u0274\7,\2\2\u0274\u00c8"+
+ "\3\2\2\2\u0275\u0276\7\61\2\2\u0276\u00ca\3\2\2\2\u0277\u0279\t\2\2\2"+
+ "\u0278\u0277\3\2\2\2\u0279\u027a\3\2\2\2\u027a\u0278\3\2\2\2\u027a\u027b"+
+ "\3\2\2\2\u027b\u027c\3\2\2\2\u027c\u027d\7<\2\2\u027d\u00cc\3\2\2\2\u027e"+
+ "\u0282\t\3\2\2\u027f\u0281\t\2\2\2\u0280\u027f\3\2\2\2\u0281\u0284\3\2"+
+ "\2\2\u0282\u0280\3\2\2\2\u0282\u0283\3\2\2\2\u0283\u00ce\3\2\2\2\u0284"+
+ "\u0282\3\2\2\2\u0285\u0289\t\4\2\2\u0286\u0288\t\5\2\2\u0287\u0286\3\2"+
+ "\2\2\u0288\u028b\3\2\2\2\u0289\u0287\3\2\2\2\u0289\u028a\3\2\2\2\u028a"+
+ "\u00d0\3\2\2\2\u028b\u0289\3\2\2\2\u028c\u028e\7f\2\2\u028d\u028f\t\4"+
+ "\2\2\u028e\u028d\3\2\2\2\u028f\u0290\3\2\2\2\u0290\u028e\3\2\2\2\u0290"+
+ "\u0291\3\2\2\2\u0291\u00d2\3\2\2\2\u0292\u0294\7q\2\2\u0293\u0295\t\6"+
+ "\2\2\u0294\u0293\3\2\2\2\u0295\u0296\3\2\2\2\u0296\u0294\3\2\2\2\u0296"+
+ "\u0297\3\2\2\2\u0297\u00d4\3\2\2\2\u0298\u0299\7f\2\2\u0299\u029a\7o\2"+
+ "\2\u029a\u029c\3\2\2\2\u029b\u029d\t\4\2\2\u029c\u029b\3\2\2\2\u029d\u029e"+
+ "\3\2\2\2\u029e\u029c\3\2\2\2\u029e\u029f\3\2\2\2\u029f\u00d6\3\2\2\2\u02a0"+
+ "\u02a4\7>\2\2\u02a1\u02a3\t\7\2\2\u02a2\u02a1\3\2\2\2\u02a3\u02a6\3\2"+
+ "\2\2\u02a4\u02a2\3\2\2\2\u02a4\u02a5\3\2\2\2\u02a5\u00d8\3\2\2\2\u02a6"+
+ "\u02a4\3\2\2\2\u02a7\u02ab\7$\2\2\u02a8\u02aa\n\b\2\2\u02a9\u02a8\3\2"+
+ "\2\2\u02aa\u02ad\3\2\2\2\u02ab\u02a9\3\2\2\2\u02ab\u02ac\3\2\2\2\u02ac"+
+ "\u00da\3\2\2\2\u02ad\u02ab\3\2\2\2\u02ae\u02b0\t\b\2\2\u02af\u02ae\3\2"+
+ "\2\2\u02b0\u02b1\3\2\2\2\u02b1\u02af\3\2\2\2\u02b1\u02b2\3\2\2\2\u02b2"+
+ "\u00dc\3\2\2\2\u02b3\u02b4\t\t\2\2\u02b4\u02b5\3\2\2\2\u02b5\u02b6\bo"+
+ "\2\2\u02b6\u00de\3\2\2\2\f\2\u027a\u0282\u0289\u0290\u0296\u029e\u02a4"+
+ "\u02ab\u02b1\3\b\2\2";
+ public static final ATN _ATN =
+ new ATNDeserializer().deserialize(_serializedATN.toCharArray());
+ static {
+ _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
+ for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
+ _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
+ }
+ }
+}
\ No newline at end of file
diff --git a/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7Listener.java b/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7Listener.java
new file mode 100644
index 0000000..43e9afe
--- /dev/null
+++ b/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7Listener.java
@@ -0,0 +1,181 @@
+// Generated from com/khubla/pdp7parse/antlr4/pdp7.g4 by ANTLR 4.5
+package com.khubla.pdp7parse.antlr4;
+import org.antlr.v4.runtime.misc.NotNull;
+import org.antlr.v4.runtime.tree.ParseTreeListener;
+
+/**
+ * This interface defines a complete listener for a parse tree produced by
+ * {@link pdp7Parser}.
+ */
+public interface pdp7Listener extends ParseTreeListener {
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#prog}.
+ * @param ctx the parse tree
+ */
+ void enterProg(pdp7Parser.ProgContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#prog}.
+ * @param ctx the parse tree
+ */
+ void exitProg(pdp7Parser.ProgContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#line}.
+ * @param ctx the parse tree
+ */
+ void enterLine(pdp7Parser.LineContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#line}.
+ * @param ctx the parse tree
+ */
+ void exitLine(pdp7Parser.LineContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#declarations}.
+ * @param ctx the parse tree
+ */
+ void enterDeclarations(pdp7Parser.DeclarationsContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#declarations}.
+ * @param ctx the parse tree
+ */
+ void exitDeclarations(pdp7Parser.DeclarationsContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#declaration}.
+ * @param ctx the parse tree
+ */
+ void enterDeclaration(pdp7Parser.DeclarationContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#declaration}.
+ * @param ctx the parse tree
+ */
+ void exitDeclaration(pdp7Parser.DeclarationContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#instruction}.
+ * @param ctx the parse tree
+ */
+ void enterInstruction(pdp7Parser.InstructionContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#instruction}.
+ * @param ctx the parse tree
+ */
+ void exitInstruction(pdp7Parser.InstructionContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#argument}.
+ * @param ctx the parse tree
+ */
+ void enterArgument(pdp7Parser.ArgumentContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#argument}.
+ * @param ctx the parse tree
+ */
+ void exitArgument(pdp7Parser.ArgumentContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#assignment}.
+ * @param ctx the parse tree
+ */
+ void enterAssignment(pdp7Parser.AssignmentContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#assignment}.
+ * @param ctx the parse tree
+ */
+ void exitAssignment(pdp7Parser.AssignmentContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#expression}.
+ * @param ctx the parse tree
+ */
+ void enterExpression(pdp7Parser.ExpressionContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#expression}.
+ * @param ctx the parse tree
+ */
+ void exitExpression(pdp7Parser.ExpressionContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#multiplyingExpression}.
+ * @param ctx the parse tree
+ */
+ void enterMultiplyingExpression(pdp7Parser.MultiplyingExpressionContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#multiplyingExpression}.
+ * @param ctx the parse tree
+ */
+ void exitMultiplyingExpression(pdp7Parser.MultiplyingExpressionContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#atom}.
+ * @param ctx the parse tree
+ */
+ void enterAtom(pdp7Parser.AtomContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#atom}.
+ * @param ctx the parse tree
+ */
+ void exitAtom(pdp7Parser.AtomContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#string}.
+ * @param ctx the parse tree
+ */
+ void enterString(pdp7Parser.StringContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#string}.
+ * @param ctx the parse tree
+ */
+ void exitString(pdp7Parser.StringContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#signednumber}.
+ * @param ctx the parse tree
+ */
+ void enterSignednumber(pdp7Parser.SignednumberContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#signednumber}.
+ * @param ctx the parse tree
+ */
+ void exitSignednumber(pdp7Parser.SignednumberContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#eol}.
+ * @param ctx the parse tree
+ */
+ void enterEol(pdp7Parser.EolContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#eol}.
+ * @param ctx the parse tree
+ */
+ void exitEol(pdp7Parser.EolContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#comment}.
+ * @param ctx the parse tree
+ */
+ void enterComment(pdp7Parser.CommentContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#comment}.
+ * @param ctx the parse tree
+ */
+ void exitComment(pdp7Parser.CommentContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#label}.
+ * @param ctx the parse tree
+ */
+ void enterLabel(pdp7Parser.LabelContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#label}.
+ * @param ctx the parse tree
+ */
+ void exitLabel(pdp7Parser.LabelContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#variable}.
+ * @param ctx the parse tree
+ */
+ void enterVariable(pdp7Parser.VariableContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#variable}.
+ * @param ctx the parse tree
+ */
+ void exitVariable(pdp7Parser.VariableContext ctx);
+ /**
+ * Enter a parse tree produced by {@link pdp7Parser#opcode}.
+ * @param ctx the parse tree
+ */
+ void enterOpcode(pdp7Parser.OpcodeContext ctx);
+ /**
+ * Exit a parse tree produced by {@link pdp7Parser#opcode}.
+ * @param ctx the parse tree
+ */
+ void exitOpcode(pdp7Parser.OpcodeContext ctx);
+}
\ No newline at end of file
diff --git a/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7Parser.java b/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7Parser.java
new file mode 100644
index 0000000..3c9f9bd
--- /dev/null
+++ b/pdp7parse/src/main/java/com/khubla/pdp7parse/antlr4/pdp7Parser.java
@@ -0,0 +1,1179 @@
+// Generated from com/khubla/pdp7parse/antlr4/pdp7.g4 by ANTLR 4.5
+package com.khubla.pdp7parse.antlr4;
+import org.antlr.v4.runtime.atn.*;
+import org.antlr.v4.runtime.dfa.DFA;
+import org.antlr.v4.runtime.*;
+import org.antlr.v4.runtime.misc.*;
+import org.antlr.v4.runtime.tree.*;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
+public class pdp7Parser extends Parser {
+ static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
+
+ protected static final DFA[] _decisionToDFA;
+ protected static final PredictionContextCache _sharedContextCache =
+ 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, T__14=15, T__15=16, T__16=17,
+ T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
+ T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
+ T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, T__37=38,
+ T__38=39, T__39=40, T__40=41, T__41=42, T__42=43, T__43=44, T__44=45,
+ T__45=46, T__46=47, T__47=48, T__48=49, T__49=50, T__50=51, T__51=52,
+ T__52=53, T__53=54, T__54=55, T__55=56, T__56=57, T__57=58, T__58=59,
+ T__59=60, T__60=61, T__61=62, T__62=63, T__63=64, T__64=65, T__65=66,
+ T__66=67, T__67=68, T__68=69, T__69=70, T__70=71, T__71=72, T__72=73,
+ T__73=74, T__74=75, T__75=76, T__76=77, T__77=78, T__78=79, T__79=80,
+ T__80=81, T__81=82, T__82=83, T__83=84, T__84=85, T__85=86, T__86=87,
+ T__87=88, T__88=89, T__89=90, T__90=91, T__91=92, T__92=93, T__93=94,
+ LOC=95, RELOC=96, PLUS=97, MINUS=98, TIMES=99, DIV=100, LABEL=101, IDENTIFIER=102,
+ NUMERIC_LITERAL=103, DECIMAL=104, OCTAL=105, DECIMAL_MINUS=106, STRING=107,
+ COMMENT=108, EOL=109, WS=110;
+ public static final int
+ RULE_prog = 0, RULE_line = 1, RULE_declarations = 2, RULE_declaration = 3,
+ RULE_instruction = 4, RULE_argument = 5, RULE_assignment = 6, RULE_expression = 7,
+ RULE_multiplyingExpression = 8, RULE_atom = 9, RULE_string = 10, RULE_signednumber = 11,
+ RULE_eol = 12, RULE_comment = 13, RULE_label = 14, RULE_variable = 15,
+ RULE_opcode = 16;
+ public static final String[] ruleNames = {
+ "prog", "line", "declarations", "declaration", "instruction", "argument",
+ "assignment", "expression", "multiplyingExpression", "atom", "string",
+ "signednumber", "eol", "comment", "label", "variable", "opcode"
+ };
+
+ private static final String[] _LITERAL_NAMES = {
+ null, "';'", "'='", "'>'", "'dac'", "'jms'", "'dzm'", "'lac'", "'xor'",
+ "'add'", "'tad'", "'xct'", "'isz'", "'and'", "'sad'", "'jmp'", "'nop'",
+ "'law'", "'cma'", "'las'", "'ral'", "'rar'", "'hlt'", "'sma'", "'sza'",
+ "'snl'", "'skp'", "'sna'", "'szl'", "'rtl'", "'rtr'", "'cil'", "'rcl'",
+ "'rcr'", "'cia'", "'lrs'", "'lrss'", "'lls'", "'llss'", "'als'", "'alss'",
+ "'mul'", "'idiv'", "'lacq'", "'clq'", "'omq'", "'cmq'", "'lmq'", "'dscs'",
+ "'dslw'", "'dslm'", "'dsld'", "'dsls'", "'dssf'", "'dsrs'", "'iof'", "'ion'",
+ "'caf'", "'clon'", "'clsf'", "'clof'", "'ksf'", "'krb'", "'tsf'", "'tcf'",
+ "'tls'", "'sck'", "'cck'", "'lck'", "'rsf'", "'rsa'", "'rrb'", "'psf'",
+ "'pcf'", "'psa'", "'cdf'", "'rlpd'", "'lda'", "'wcga'", "'raef'", "'beg'",
+ "'spb'", "'cpb'", "'lpb'", "'wbl'", "'dprs'", "'dpsf'", "'dpcf'", "'dprc'",
+ "'crsf'", "'crrb'", "'sys'", "'czm'", "'irss'", "'dsm'", "'.'", "'..'",
+ "'+'", "'-'", "'*'", "'/'"
+ };
+ private static final String[] _SYMBOLIC_NAMES = {
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, "LOC",
+ "RELOC", "PLUS", "MINUS", "TIMES", "DIV", "LABEL", "IDENTIFIER", "NUMERIC_LITERAL",
+ "DECIMAL", "OCTAL", "DECIMAL_MINUS", "STRING", "COMMENT", "EOL", "WS"
+ };
+ public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
+
+ /**
+ * @deprecated Use {@link #VOCABULARY} instead.
+ */
+ @Deprecated
+ public static final String[] tokenNames;
+ static {
+ tokenNames = new String[_SYMBOLIC_NAMES.length];
+ for (int i = 0; i < tokenNames.length; i++) {
+ tokenNames[i] = VOCABULARY.getLiteralName(i);
+ if (tokenNames[i] == null) {
+ tokenNames[i] = VOCABULARY.getSymbolicName(i);
+ }
+
+ if (tokenNames[i] == null) {
+ tokenNames[i] = "";
+ }
+ }
+ }
+
+ @Override
+ @Deprecated
+ public String[] getTokenNames() {
+ return tokenNames;
+ }
+
+ @Override
+
+ public Vocabulary getVocabulary() {
+ return VOCABULARY;
+ }
+
+ @Override
+ public String getGrammarFileName() { return "pdp7.g4"; }
+
+ @Override
+ public String[] getRuleNames() { return ruleNames; }
+
+ @Override
+ public String getSerializedATN() { return _serializedATN; }
+
+ @Override
+ public ATN getATN() { return _ATN; }
+
+ public pdp7Parser(TokenStream input) {
+ super(input);
+ _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+ }
+ public static class ProgContext extends ParserRuleContext {
+ public List line() {
+ return getRuleContexts(LineContext.class);
+ }
+ public LineContext line(int i) {
+ return getRuleContext(LineContext.class,i);
+ }
+ public ProgContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_prog; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterProg(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitProg(this);
+ }
+ }
+
+ public final ProgContext prog() throws RecognitionException {
+ ProgContext _localctx = new ProgContext(_ctx, getState());
+ enterRule(_localctx, 0, RULE_prog);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(35);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ do {
+ {
+ {
+ setState(34);
+ line();
+ }
+ }
+ setState(37);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__3) | (1L << T__4) | (1L << T__5) | (1L << T__6) | (1L << T__7) | (1L << T__8) | (1L << T__9) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__16) | (1L << T__17) | (1L << T__18) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << T__31) | (1L << T__32) | (1L << T__33) | (1L << T__34) | (1L << T__35) | (1L << T__36) | (1L << T__37) | (1L << T__38) | (1L << T__39) | (1L << T__40) | (1L << T__41) | (1L << T__42) | (1L << T__43) | (1L << T__44) | (1L << T__45) | (1L << T__46) | (1L << T__47) | (1L << T__48) | (1L << T__49) | (1L << T__50) | (1L << T__51) | (1L << T__52) | (1L << T__53) | (1L << T__54) | (1L << T__55) | (1L << T__56) | (1L << T__57) | (1L << T__58) | (1L << T__59) | (1L << T__60) | (1L << T__61) | (1L << T__62))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (T__63 - 64)) | (1L << (T__64 - 64)) | (1L << (T__65 - 64)) | (1L << (T__66 - 64)) | (1L << (T__67 - 64)) | (1L << (T__68 - 64)) | (1L << (T__69 - 64)) | (1L << (T__70 - 64)) | (1L << (T__71 - 64)) | (1L << (T__72 - 64)) | (1L << (T__73 - 64)) | (1L << (T__74 - 64)) | (1L << (T__75 - 64)) | (1L << (T__76 - 64)) | (1L << (T__77 - 64)) | (1L << (T__78 - 64)) | (1L << (T__79 - 64)) | (1L << (T__80 - 64)) | (1L << (T__81 - 64)) | (1L << (T__82 - 64)) | (1L << (T__83 - 64)) | (1L << (T__84 - 64)) | (1L << (T__85 - 64)) | (1L << (T__86 - 64)) | (1L << (T__87 - 64)) | (1L << (T__88 - 64)) | (1L << (T__89 - 64)) | (1L << (T__90 - 64)) | (1L << (T__91 - 64)) | (1L << (T__92 - 64)) | (1L << (T__93 - 64)) | (1L << (LOC - 64)) | (1L << (RELOC - 64)) | (1L << (MINUS - 64)) | (1L << (LABEL - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (NUMERIC_LITERAL - 64)) | (1L << (DECIMAL - 64)) | (1L << (OCTAL - 64)) | (1L << (DECIMAL_MINUS - 64)) | (1L << (STRING - 64)) | (1L << (COMMENT - 64)) | (1L << (EOL - 64)))) != 0) );
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class LineContext extends ParserRuleContext {
+ public EolContext eol() {
+ return getRuleContext(EolContext.class,0);
+ }
+ public DeclarationsContext declarations() {
+ return getRuleContext(DeclarationsContext.class,0);
+ }
+ public CommentContext comment() {
+ return getRuleContext(CommentContext.class,0);
+ }
+ public LineContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_line; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterLine(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitLine(this);
+ }
+ }
+
+ public final LineContext line() throws RecognitionException {
+ LineContext _localctx = new LineContext(_ctx, getState());
+ enterRule(_localctx, 2, RULE_line);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(40);
+ switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) {
+ case 1:
+ {
+ setState(39);
+ declarations();
+ }
+ break;
+ }
+ setState(43);
+ _la = _input.LA(1);
+ if (_la==COMMENT) {
+ {
+ setState(42);
+ comment();
+ }
+ }
+
+ setState(45);
+ eol();
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class DeclarationsContext extends ParserRuleContext {
+ public List declaration() {
+ return getRuleContexts(DeclarationContext.class);
+ }
+ public DeclarationContext declaration(int i) {
+ return getRuleContext(DeclarationContext.class,i);
+ }
+ public DeclarationsContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_declarations; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterDeclarations(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitDeclarations(this);
+ }
+ }
+
+ public final DeclarationsContext declarations() throws RecognitionException {
+ DeclarationsContext _localctx = new DeclarationsContext(_ctx, getState());
+ enterRule(_localctx, 4, RULE_declarations);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(47);
+ declaration();
+ setState(52);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (_la==T__0) {
+ {
+ {
+ setState(48);
+ match(T__0);
+ setState(49);
+ declaration();
+ }
+ }
+ setState(54);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class DeclarationContext extends ParserRuleContext {
+ public List label() {
+ return getRuleContexts(LabelContext.class);
+ }
+ public LabelContext label(int i) {
+ return getRuleContext(LabelContext.class,i);
+ }
+ public List instruction() {
+ return getRuleContexts(InstructionContext.class);
+ }
+ public InstructionContext instruction(int i) {
+ return getRuleContext(InstructionContext.class,i);
+ }
+ public List assignment() {
+ return getRuleContexts(AssignmentContext.class);
+ }
+ public AssignmentContext assignment(int i) {
+ return getRuleContext(AssignmentContext.class,i);
+ }
+ public List expression() {
+ return getRuleContexts(ExpressionContext.class);
+ }
+ public ExpressionContext expression(int i) {
+ return getRuleContext(ExpressionContext.class,i);
+ }
+ public DeclarationContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_declaration; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterDeclaration(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitDeclaration(this);
+ }
+ }
+
+ public final DeclarationContext declaration() throws RecognitionException {
+ DeclarationContext _localctx = new DeclarationContext(_ctx, getState());
+ enterRule(_localctx, 6, RULE_declaration);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(58);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (_la==LABEL) {
+ {
+ {
+ setState(55);
+ label();
+ }
+ }
+ setState(60);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ setState(66);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__3) | (1L << T__4) | (1L << T__5) | (1L << T__6) | (1L << T__7) | (1L << T__8) | (1L << T__9) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__16) | (1L << T__17) | (1L << T__18) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << T__31) | (1L << T__32) | (1L << T__33) | (1L << T__34) | (1L << T__35) | (1L << T__36) | (1L << T__37) | (1L << T__38) | (1L << T__39) | (1L << T__40) | (1L << T__41) | (1L << T__42) | (1L << T__43) | (1L << T__44) | (1L << T__45) | (1L << T__46) | (1L << T__47) | (1L << T__48) | (1L << T__49) | (1L << T__50) | (1L << T__51) | (1L << T__52) | (1L << T__53) | (1L << T__54) | (1L << T__55) | (1L << T__56) | (1L << T__57) | (1L << T__58) | (1L << T__59) | (1L << T__60) | (1L << T__61) | (1L << T__62))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (T__63 - 64)) | (1L << (T__64 - 64)) | (1L << (T__65 - 64)) | (1L << (T__66 - 64)) | (1L << (T__67 - 64)) | (1L << (T__68 - 64)) | (1L << (T__69 - 64)) | (1L << (T__70 - 64)) | (1L << (T__71 - 64)) | (1L << (T__72 - 64)) | (1L << (T__73 - 64)) | (1L << (T__74 - 64)) | (1L << (T__75 - 64)) | (1L << (T__76 - 64)) | (1L << (T__77 - 64)) | (1L << (T__78 - 64)) | (1L << (T__79 - 64)) | (1L << (T__80 - 64)) | (1L << (T__81 - 64)) | (1L << (T__82 - 64)) | (1L << (T__83 - 64)) | (1L << (T__84 - 64)) | (1L << (T__85 - 64)) | (1L << (T__86 - 64)) | (1L << (T__87 - 64)) | (1L << (T__88 - 64)) | (1L << (T__89 - 64)) | (1L << (T__90 - 64)) | (1L << (T__91 - 64)) | (1L << (T__92 - 64)) | (1L << (T__93 - 64)) | (1L << (LOC - 64)) | (1L << (RELOC - 64)) | (1L << (MINUS - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (NUMERIC_LITERAL - 64)) | (1L << (DECIMAL - 64)) | (1L << (OCTAL - 64)) | (1L << (DECIMAL_MINUS - 64)) | (1L << (STRING - 64)))) != 0)) {
+ {
+ setState(64);
+ switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
+ case 1:
+ {
+ setState(61);
+ instruction();
+ }
+ break;
+ case 2:
+ {
+ setState(62);
+ assignment();
+ }
+ break;
+ case 3:
+ {
+ setState(63);
+ expression();
+ }
+ break;
+ }
+ }
+ setState(68);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class InstructionContext extends ParserRuleContext {
+ public OpcodeContext opcode() {
+ return getRuleContext(OpcodeContext.class,0);
+ }
+ public List argument() {
+ return getRuleContexts(ArgumentContext.class);
+ }
+ public ArgumentContext argument(int i) {
+ return getRuleContext(ArgumentContext.class,i);
+ }
+ public InstructionContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_instruction; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterInstruction(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitInstruction(this);
+ }
+ }
+
+ public final InstructionContext instruction() throws RecognitionException {
+ InstructionContext _localctx = new InstructionContext(_ctx, getState());
+ enterRule(_localctx, 8, RULE_instruction);
+ try {
+ int _alt;
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(69);
+ opcode();
+ setState(73);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,7,_ctx);
+ while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
+ if ( _alt==1 ) {
+ {
+ {
+ setState(70);
+ argument();
+ }
+ }
+ }
+ setState(75);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,7,_ctx);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class ArgumentContext extends ParserRuleContext {
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public ArgumentContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_argument; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterArgument(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitArgument(this);
+ }
+ }
+
+ public final ArgumentContext argument() throws RecognitionException {
+ ArgumentContext _localctx = new ArgumentContext(_ctx, getState());
+ enterRule(_localctx, 10, RULE_argument);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(76);
+ expression();
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class AssignmentContext extends ParserRuleContext {
+ public ExpressionContext expression() {
+ return getRuleContext(ExpressionContext.class,0);
+ }
+ public VariableContext variable() {
+ return getRuleContext(VariableContext.class,0);
+ }
+ public TerminalNode LOC() { return getToken(pdp7Parser.LOC, 0); }
+ public TerminalNode RELOC() { return getToken(pdp7Parser.RELOC, 0); }
+ public AssignmentContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_assignment; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterAssignment(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitAssignment(this);
+ }
+ }
+
+ public final AssignmentContext assignment() throws RecognitionException {
+ AssignmentContext _localctx = new AssignmentContext(_ctx, getState());
+ enterRule(_localctx, 12, RULE_assignment);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(81);
+ switch (_input.LA(1)) {
+ case IDENTIFIER:
+ {
+ setState(78);
+ variable();
+ }
+ break;
+ case LOC:
+ {
+ setState(79);
+ match(LOC);
+ }
+ break;
+ case RELOC:
+ {
+ setState(80);
+ match(RELOC);
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ setState(83);
+ match(T__1);
+ setState(84);
+ expression();
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class ExpressionContext extends ParserRuleContext {
+ public List multiplyingExpression() {
+ return getRuleContexts(MultiplyingExpressionContext.class);
+ }
+ public MultiplyingExpressionContext multiplyingExpression(int i) {
+ return getRuleContext(MultiplyingExpressionContext.class,i);
+ }
+ public List PLUS() { return getTokens(pdp7Parser.PLUS); }
+ public TerminalNode PLUS(int i) {
+ return getToken(pdp7Parser.PLUS, i);
+ }
+ public List MINUS() { return getTokens(pdp7Parser.MINUS); }
+ public TerminalNode MINUS(int i) {
+ return getToken(pdp7Parser.MINUS, i);
+ }
+ public ExpressionContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_expression; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterExpression(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitExpression(this);
+ }
+ }
+
+ public final ExpressionContext expression() throws RecognitionException {
+ ExpressionContext _localctx = new ExpressionContext(_ctx, getState());
+ enterRule(_localctx, 14, RULE_expression);
+ int _la;
+ try {
+ int _alt;
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(86);
+ multiplyingExpression();
+ setState(91);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,9,_ctx);
+ while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
+ if ( _alt==1 ) {
+ {
+ {
+ setState(87);
+ _la = _input.LA(1);
+ if ( !(_la==PLUS || _la==MINUS) ) {
+ _errHandler.recoverInline(this);
+ } else {
+ consume();
+ }
+ setState(88);
+ multiplyingExpression();
+ }
+ }
+ }
+ setState(93);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,9,_ctx);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class MultiplyingExpressionContext extends ParserRuleContext {
+ public List atom() {
+ return getRuleContexts(AtomContext.class);
+ }
+ public AtomContext atom(int i) {
+ return getRuleContext(AtomContext.class,i);
+ }
+ public List TIMES() { return getTokens(pdp7Parser.TIMES); }
+ public TerminalNode TIMES(int i) {
+ return getToken(pdp7Parser.TIMES, i);
+ }
+ public List DIV() { return getTokens(pdp7Parser.DIV); }
+ public TerminalNode DIV(int i) {
+ return getToken(pdp7Parser.DIV, i);
+ }
+ public MultiplyingExpressionContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_multiplyingExpression; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterMultiplyingExpression(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitMultiplyingExpression(this);
+ }
+ }
+
+ public final MultiplyingExpressionContext multiplyingExpression() throws RecognitionException {
+ MultiplyingExpressionContext _localctx = new MultiplyingExpressionContext(_ctx, getState());
+ enterRule(_localctx, 16, RULE_multiplyingExpression);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(94);
+ atom();
+ setState(99);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ while (_la==TIMES || _la==DIV) {
+ {
+ {
+ setState(95);
+ _la = _input.LA(1);
+ if ( !(_la==TIMES || _la==DIV) ) {
+ _errHandler.recoverInline(this);
+ } else {
+ consume();
+ }
+ setState(96);
+ atom();
+ }
+ }
+ setState(101);
+ _errHandler.sync(this);
+ _la = _input.LA(1);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class AtomContext extends ParserRuleContext {
+ public VariableContext variable() {
+ return getRuleContext(VariableContext.class,0);
+ }
+ public TerminalNode LOC() { return getToken(pdp7Parser.LOC, 0); }
+ public TerminalNode RELOC() { return getToken(pdp7Parser.RELOC, 0); }
+ public StringContext string() {
+ return getRuleContext(StringContext.class,0);
+ }
+ public TerminalNode DECIMAL() { return getToken(pdp7Parser.DECIMAL, 0); }
+ public TerminalNode DECIMAL_MINUS() { return getToken(pdp7Parser.DECIMAL_MINUS, 0); }
+ public TerminalNode OCTAL() { return getToken(pdp7Parser.OCTAL, 0); }
+ public SignednumberContext signednumber() {
+ return getRuleContext(SignednumberContext.class,0);
+ }
+ public AtomContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_atom; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterAtom(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitAtom(this);
+ }
+ }
+
+ public final AtomContext atom() throws RecognitionException {
+ AtomContext _localctx = new AtomContext(_ctx, getState());
+ enterRule(_localctx, 18, RULE_atom);
+ try {
+ setState(110);
+ switch (_input.LA(1)) {
+ case IDENTIFIER:
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(102);
+ variable();
+ }
+ break;
+ case LOC:
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(103);
+ match(LOC);
+ }
+ break;
+ case RELOC:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(104);
+ match(RELOC);
+ }
+ break;
+ case STRING:
+ enterOuterAlt(_localctx, 4);
+ {
+ setState(105);
+ string();
+ }
+ break;
+ case DECIMAL:
+ enterOuterAlt(_localctx, 5);
+ {
+ setState(106);
+ match(DECIMAL);
+ }
+ break;
+ case DECIMAL_MINUS:
+ enterOuterAlt(_localctx, 6);
+ {
+ setState(107);
+ match(DECIMAL_MINUS);
+ }
+ break;
+ case OCTAL:
+ enterOuterAlt(_localctx, 7);
+ {
+ setState(108);
+ match(OCTAL);
+ }
+ break;
+ case MINUS:
+ case NUMERIC_LITERAL:
+ enterOuterAlt(_localctx, 8);
+ {
+ setState(109);
+ signednumber();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class StringContext extends ParserRuleContext {
+ public TerminalNode STRING() { return getToken(pdp7Parser.STRING, 0); }
+ public List NUMERIC_LITERAL() { return getTokens(pdp7Parser.NUMERIC_LITERAL); }
+ public TerminalNode NUMERIC_LITERAL(int i) {
+ return getToken(pdp7Parser.NUMERIC_LITERAL, i);
+ }
+ public StringContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_string; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterString(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitString(this);
+ }
+ }
+
+ public final StringContext string() throws RecognitionException {
+ StringContext _localctx = new StringContext(_ctx, getState());
+ enterRule(_localctx, 20, RULE_string);
+ int _la;
+ try {
+ int _alt;
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(112);
+ match(STRING);
+ setState(116);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,12,_ctx);
+ while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
+ if ( _alt==1 ) {
+ {
+ {
+ setState(113);
+ match(NUMERIC_LITERAL);
+ }
+ }
+ }
+ setState(118);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,12,_ctx);
+ }
+ setState(120);
+ _la = _input.LA(1);
+ if (_la==T__2) {
+ {
+ setState(119);
+ match(T__2);
+ }
+ }
+
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class SignednumberContext extends ParserRuleContext {
+ public TerminalNode NUMERIC_LITERAL() { return getToken(pdp7Parser.NUMERIC_LITERAL, 0); }
+ public SignednumberContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_signednumber; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterSignednumber(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitSignednumber(this);
+ }
+ }
+
+ public final SignednumberContext signednumber() throws RecognitionException {
+ SignednumberContext _localctx = new SignednumberContext(_ctx, getState());
+ enterRule(_localctx, 22, RULE_signednumber);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(123);
+ _la = _input.LA(1);
+ if (_la==MINUS) {
+ {
+ setState(122);
+ match(MINUS);
+ }
+ }
+
+ setState(125);
+ match(NUMERIC_LITERAL);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class EolContext extends ParserRuleContext {
+ public TerminalNode EOL() { return getToken(pdp7Parser.EOL, 0); }
+ public EolContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_eol; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterEol(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitEol(this);
+ }
+ }
+
+ public final EolContext eol() throws RecognitionException {
+ EolContext _localctx = new EolContext(_ctx, getState());
+ enterRule(_localctx, 24, RULE_eol);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(127);
+ match(EOL);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class CommentContext extends ParserRuleContext {
+ public TerminalNode COMMENT() { return getToken(pdp7Parser.COMMENT, 0); }
+ public CommentContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_comment; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterComment(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitComment(this);
+ }
+ }
+
+ public final CommentContext comment() throws RecognitionException {
+ CommentContext _localctx = new CommentContext(_ctx, getState());
+ enterRule(_localctx, 26, RULE_comment);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(129);
+ match(COMMENT);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class LabelContext extends ParserRuleContext {
+ public TerminalNode LABEL() { return getToken(pdp7Parser.LABEL, 0); }
+ public LabelContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_label; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterLabel(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitLabel(this);
+ }
+ }
+
+ public final LabelContext label() throws RecognitionException {
+ LabelContext _localctx = new LabelContext(_ctx, getState());
+ enterRule(_localctx, 28, RULE_label);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(131);
+ match(LABEL);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class VariableContext extends ParserRuleContext {
+ public TerminalNode IDENTIFIER() { return getToken(pdp7Parser.IDENTIFIER, 0); }
+ public VariableContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_variable; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterVariable(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitVariable(this);
+ }
+ }
+
+ public final VariableContext variable() throws RecognitionException {
+ VariableContext _localctx = new VariableContext(_ctx, getState());
+ enterRule(_localctx, 30, RULE_variable);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(133);
+ match(IDENTIFIER);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class OpcodeContext extends ParserRuleContext {
+ public OpcodeContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_opcode; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).enterOpcode(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof pdp7Listener ) ((pdp7Listener)listener).exitOpcode(this);
+ }
+ }
+
+ public final OpcodeContext opcode() throws RecognitionException {
+ OpcodeContext _localctx = new OpcodeContext(_ctx, getState());
+ enterRule(_localctx, 32, RULE_opcode);
+ int _la;
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(135);
+ _la = _input.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__3) | (1L << T__4) | (1L << T__5) | (1L << T__6) | (1L << T__7) | (1L << T__8) | (1L << T__9) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__16) | (1L << T__17) | (1L << T__18) | (1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__26) | (1L << T__27) | (1L << T__28) | (1L << T__29) | (1L << T__30) | (1L << T__31) | (1L << T__32) | (1L << T__33) | (1L << T__34) | (1L << T__35) | (1L << T__36) | (1L << T__37) | (1L << T__38) | (1L << T__39) | (1L << T__40) | (1L << T__41) | (1L << T__42) | (1L << T__43) | (1L << T__44) | (1L << T__45) | (1L << T__46) | (1L << T__47) | (1L << T__48) | (1L << T__49) | (1L << T__50) | (1L << T__51) | (1L << T__52) | (1L << T__53) | (1L << T__54) | (1L << T__55) | (1L << T__56) | (1L << T__57) | (1L << T__58) | (1L << T__59) | (1L << T__60) | (1L << T__61) | (1L << T__62))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (T__63 - 64)) | (1L << (T__64 - 64)) | (1L << (T__65 - 64)) | (1L << (T__66 - 64)) | (1L << (T__67 - 64)) | (1L << (T__68 - 64)) | (1L << (T__69 - 64)) | (1L << (T__70 - 64)) | (1L << (T__71 - 64)) | (1L << (T__72 - 64)) | (1L << (T__73 - 64)) | (1L << (T__74 - 64)) | (1L << (T__75 - 64)) | (1L << (T__76 - 64)) | (1L << (T__77 - 64)) | (1L << (T__78 - 64)) | (1L << (T__79 - 64)) | (1L << (T__80 - 64)) | (1L << (T__81 - 64)) | (1L << (T__82 - 64)) | (1L << (T__83 - 64)) | (1L << (T__84 - 64)) | (1L << (T__85 - 64)) | (1L << (T__86 - 64)) | (1L << (T__87 - 64)) | (1L << (T__88 - 64)) | (1L << (T__89 - 64)) | (1L << (T__90 - 64)) | (1L << (T__91 - 64)) | (1L << (T__92 - 64)) | (1L << (T__93 - 64)))) != 0)) ) {
+ _errHandler.recoverInline(this);
+ } else {
+ consume();
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static final String _serializedATN =
+ "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3p\u008c\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\6\2&\n\2\r\2\16\2\'\3\3\5\3+\n\3\3\3\5\3.\n\3\3\3\3\3\3\4\3\4\3\4"+
+ "\7\4\65\n\4\f\4\16\48\13\4\3\5\7\5;\n\5\f\5\16\5>\13\5\3\5\3\5\3\5\7\5"+
+ "C\n\5\f\5\16\5F\13\5\3\6\3\6\7\6J\n\6\f\6\16\6M\13\6\3\7\3\7\3\b\3\b\3"+
+ "\b\5\bT\n\b\3\b\3\b\3\b\3\t\3\t\3\t\7\t\\\n\t\f\t\16\t_\13\t\3\n\3\n\3"+
+ "\n\7\nd\n\n\f\n\16\ng\13\n\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\5\13"+
+ "q\n\13\3\f\3\f\7\fu\n\f\f\f\16\fx\13\f\3\f\5\f{\n\f\3\r\5\r~\n\r\3\r\3"+
+ "\r\3\16\3\16\3\17\3\17\3\20\3\20\3\21\3\21\3\22\3\22\3\22\2\2\23\2\4\6"+
+ "\b\n\f\16\20\22\24\26\30\32\34\36 \"\2\5\3\2cd\3\2ef\3\2\6`\u0091\2%\3"+
+ "\2\2\2\4*\3\2\2\2\6\61\3\2\2\2\b<\3\2\2\2\nG\3\2\2\2\fN\3\2\2\2\16S\3"+
+ "\2\2\2\20X\3\2\2\2\22`\3\2\2\2\24p\3\2\2\2\26r\3\2\2\2\30}\3\2\2\2\32"+
+ "\u0081\3\2\2\2\34\u0083\3\2\2\2\36\u0085\3\2\2\2 \u0087\3\2\2\2\"\u0089"+
+ "\3\2\2\2$&\5\4\3\2%$\3\2\2\2&\'\3\2\2\2\'%\3\2\2\2\'(\3\2\2\2(\3\3\2\2"+
+ "\2)+\5\6\4\2*)\3\2\2\2*+\3\2\2\2+-\3\2\2\2,.\5\34\17\2-,\3\2\2\2-.\3\2"+
+ "\2\2./\3\2\2\2/\60\5\32\16\2\60\5\3\2\2\2\61\66\5\b\5\2\62\63\7\3\2\2"+
+ "\63\65\5\b\5\2\64\62\3\2\2\2\658\3\2\2\2\66\64\3\2\2\2\66\67\3\2\2\2\67"+
+ "\7\3\2\2\28\66\3\2\2\29;\5\36\20\2:9\3\2\2\2;>\3\2\2\2<:\3\2\2\2<=\3\2"+
+ "\2\2=D\3\2\2\2><\3\2\2\2?C\5\n\6\2@C\5\16\b\2AC\5\20\t\2B?\3\2\2\2B@\3"+
+ "\2\2\2BA\3\2\2\2CF\3\2\2\2DB\3\2\2\2DE\3\2\2\2E\t\3\2\2\2FD\3\2\2\2GK"+
+ "\5\"\22\2HJ\5\f\7\2IH\3\2\2\2JM\3\2\2\2KI\3\2\2\2KL\3\2\2\2L\13\3\2\2"+
+ "\2MK\3\2\2\2NO\5\20\t\2O\r\3\2\2\2PT\5 \21\2QT\7a\2\2RT\7b\2\2SP\3\2\2"+
+ "\2SQ\3\2\2\2SR\3\2\2\2TU\3\2\2\2UV\7\4\2\2VW\5\20\t\2W\17\3\2\2\2X]\5"+
+ "\22\n\2YZ\t\2\2\2Z\\\5\22\n\2[Y\3\2\2\2\\_\3\2\2\2][\3\2\2\2]^\3\2\2\2"+
+ "^\21\3\2\2\2_]\3\2\2\2`e\5\24\13\2ab\t\3\2\2bd\5\24\13\2ca\3\2\2\2dg\3"+
+ "\2\2\2ec\3\2\2\2ef\3\2\2\2f\23\3\2\2\2ge\3\2\2\2hq\5 \21\2iq\7a\2\2jq"+
+ "\7b\2\2kq\5\26\f\2lq\7j\2\2mq\7l\2\2nq\7k\2\2oq\5\30\r\2ph\3\2\2\2pi\3"+
+ "\2\2\2pj\3\2\2\2pk\3\2\2\2pl\3\2\2\2pm\3\2\2\2pn\3\2\2\2po\3\2\2\2q\25"+
+ "\3\2\2\2rv\7m\2\2su\7i\2\2ts\3\2\2\2ux\3\2\2\2vt\3\2\2\2vw\3\2\2\2wz\3"+
+ "\2\2\2xv\3\2\2\2y{\7\5\2\2zy\3\2\2\2z{\3\2\2\2{\27\3\2\2\2|~\7d\2\2}|"+
+ "\3\2\2\2}~\3\2\2\2~\177\3\2\2\2\177\u0080\7i\2\2\u0080\31\3\2\2\2\u0081"+
+ "\u0082\7o\2\2\u0082\33\3\2\2\2\u0083\u0084\7n\2\2\u0084\35\3\2\2\2\u0085"+
+ "\u0086\7g\2\2\u0086\37\3\2\2\2\u0087\u0088\7h\2\2\u0088!\3\2\2\2\u0089"+
+ "\u008a\t\4\2\2\u008a#\3\2\2\2\21\'*-\66'=3
+'dac'=4
+'jms'=5
+'dzm'=6
+'lac'=7
+'xor'=8
+'add'=9
+'tad'=10
+'xct'=11
+'isz'=12
+'and'=13
+'sad'=14
+'jmp'=15
+'nop'=16
+'law'=17
+'cma'=18
+'las'=19
+'ral'=20
+'rar'=21
+'hlt'=22
+'sma'=23
+'sza'=24
+'snl'=25
+'skp'=26
+'sna'=27
+'szl'=28
+'rtl'=29
+'rtr'=30
+'cil'=31
+'rcl'=32
+'rcr'=33
+'cia'=34
+'lrs'=35
+'lrss'=36
+'lls'=37
+'llss'=38
+'als'=39
+'alss'=40
+'mul'=41
+'idiv'=42
+'lacq'=43
+'clq'=44
+'omq'=45
+'cmq'=46
+'lmq'=47
+'dscs'=48
+'dslw'=49
+'dslm'=50
+'dsld'=51
+'dsls'=52
+'dssf'=53
+'dsrs'=54
+'iof'=55
+'ion'=56
+'caf'=57
+'clon'=58
+'clsf'=59
+'clof'=60
+'ksf'=61
+'krb'=62
+'tsf'=63
+'tcf'=64
+'tls'=65
+'sck'=66
+'cck'=67
+'lck'=68
+'rsf'=69
+'rsa'=70
+'rrb'=71
+'psf'=72
+'pcf'=73
+'psa'=74
+'cdf'=75
+'rlpd'=76
+'lda'=77
+'wcga'=78
+'raef'=79
+'beg'=80
+'spb'=81
+'cpb'=82
+'lpb'=83
+'wbl'=84
+'dprs'=85
+'dpsf'=86
+'dpcf'=87
+'dprc'=88
+'crsf'=89
+'crrb'=90
+'sys'=91
+'czm'=92
+'irss'=93
+'dsm'=94
+'.'=95
+'..'=96
+'+'=97
+'-'=98
+'*'=99
+'/'=100
diff --git a/pdp7parse/src/main/java/pdp7Lexer.tokens b/pdp7parse/src/main/java/pdp7Lexer.tokens
new file mode 100644
index 0000000..ff4ed2b
--- /dev/null
+++ b/pdp7parse/src/main/java/pdp7Lexer.tokens
@@ -0,0 +1,210 @@
+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
+T__14=15
+T__15=16
+T__16=17
+T__17=18
+T__18=19
+T__19=20
+T__20=21
+T__21=22
+T__22=23
+T__23=24
+T__24=25
+T__25=26
+T__26=27
+T__27=28
+T__28=29
+T__29=30
+T__30=31
+T__31=32
+T__32=33
+T__33=34
+T__34=35
+T__35=36
+T__36=37
+T__37=38
+T__38=39
+T__39=40
+T__40=41
+T__41=42
+T__42=43
+T__43=44
+T__44=45
+T__45=46
+T__46=47
+T__47=48
+T__48=49
+T__49=50
+T__50=51
+T__51=52
+T__52=53
+T__53=54
+T__54=55
+T__55=56
+T__56=57
+T__57=58
+T__58=59
+T__59=60
+T__60=61
+T__61=62
+T__62=63
+T__63=64
+T__64=65
+T__65=66
+T__66=67
+T__67=68
+T__68=69
+T__69=70
+T__70=71
+T__71=72
+T__72=73
+T__73=74
+T__74=75
+T__75=76
+T__76=77
+T__77=78
+T__78=79
+T__79=80
+T__80=81
+T__81=82
+T__82=83
+T__83=84
+T__84=85
+T__85=86
+T__86=87
+T__87=88
+T__88=89
+T__89=90
+T__90=91
+T__91=92
+T__92=93
+T__93=94
+LOC=95
+RELOC=96
+PLUS=97
+MINUS=98
+TIMES=99
+DIV=100
+LABEL=101
+IDENTIFIER=102
+NUMERIC_LITERAL=103
+DECIMAL=104
+OCTAL=105
+DECIMAL_MINUS=106
+STRING=107
+COMMENT=108
+EOL=109
+WS=110
+';'=1
+'='=2
+'>'=3
+'dac'=4
+'jms'=5
+'dzm'=6
+'lac'=7
+'xor'=8
+'add'=9
+'tad'=10
+'xct'=11
+'isz'=12
+'and'=13
+'sad'=14
+'jmp'=15
+'nop'=16
+'law'=17
+'cma'=18
+'las'=19
+'ral'=20
+'rar'=21
+'hlt'=22
+'sma'=23
+'sza'=24
+'snl'=25
+'skp'=26
+'sna'=27
+'szl'=28
+'rtl'=29
+'rtr'=30
+'cil'=31
+'rcl'=32
+'rcr'=33
+'cia'=34
+'lrs'=35
+'lrss'=36
+'lls'=37
+'llss'=38
+'als'=39
+'alss'=40
+'mul'=41
+'idiv'=42
+'lacq'=43
+'clq'=44
+'omq'=45
+'cmq'=46
+'lmq'=47
+'dscs'=48
+'dslw'=49
+'dslm'=50
+'dsld'=51
+'dsls'=52
+'dssf'=53
+'dsrs'=54
+'iof'=55
+'ion'=56
+'caf'=57
+'clon'=58
+'clsf'=59
+'clof'=60
+'ksf'=61
+'krb'=62
+'tsf'=63
+'tcf'=64
+'tls'=65
+'sck'=66
+'cck'=67
+'lck'=68
+'rsf'=69
+'rsa'=70
+'rrb'=71
+'psf'=72
+'pcf'=73
+'psa'=74
+'cdf'=75
+'rlpd'=76
+'lda'=77
+'wcga'=78
+'raef'=79
+'beg'=80
+'spb'=81
+'cpb'=82
+'lpb'=83
+'wbl'=84
+'dprs'=85
+'dpsf'=86
+'dpcf'=87
+'dprc'=88
+'crsf'=89
+'crrb'=90
+'sys'=91
+'czm'=92
+'irss'=93
+'dsm'=94
+'.'=95
+'..'=96
+'+'=97
+'-'=98
+'*'=99
+'/'=100
diff --git a/pdp7parse/src/test/java/com/khubla/pdp7parse/BasicTests.java b/pdp7parse/src/test/java/com/khubla/pdp7parse/BasicTests.java
new file mode 100644
index 0000000..d04b0aa
--- /dev/null
+++ b/pdp7parse/src/test/java/com/khubla/pdp7parse/BasicTests.java
@@ -0,0 +1,35 @@
+package com.khubla.pdp7parse;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Collection;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.khubla.pdp7parse.antlr4.pdp7Parser.ProgContext;
+
+public class BasicTests {
+ @Test
+ public void test1() {
+ String[] extensions = new String[] { "s" };
+ Collection files = FileUtils.listFiles(new File("src/test/resources"), extensions, true);
+ for (File file : files) {
+ testFile(file);
+ }
+ }
+
+ private void testFile(File file) {
+ try {
+ System.out.println(file.getAbsolutePath());
+ InputStream is = new FileInputStream(file);
+ ProgContext progContext = PDP7Parser.parse(is, System.out);
+ Assert.assertNotNull(progContext);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail();
+ }
+ }
+}
diff --git a/pdp7parse/src/test/resources/cat.s b/pdp7parse/src/test/resources/cat.s
new file mode 100644
index 0000000..f40fd6c
--- /dev/null
+++ b/pdp7parse/src/test/resources/cat.s
@@ -0,0 +1,151 @@
+" cat: cat [arg1 arg2 ...]
+
+ " Load the pointer pointer in 017777 to see if we have any arguments
+ lac 017777 i
+ sad d4 " Skip if we have more than four argument words
+ jmp nofiles " Only four argument words, so no arguments
+ lac 017777 " Move five words past the argument word count
+ tad d1 " so that AC points at the first argument
+ tad d4 " and save the pointer in name
+ dac name
+
+loop:
+ sys open; name:0; 0 " Open file, get fd back
+ spa
+ jmp badfile " Negative fd, exit with an error message
+ dac fi " Save file descriptor in fi
+
+1:
+ jms getc " Get a character in AC
+ sad o4
+ jmp 1f " Break the loop when we get a ctrl-D
+ jms putc " Write the character on stdout
+ jmp 1b " and loop back
+
+1:
+ lac fi " Close the file descriptor in fi
+ sys close
+
+loop1:
+ -4
+ tad 017777 i " Subtract 4 from the count of argument words
+ dac 017777 i
+ sad d4 " Is the value 4, i.e. no args left?
+ jmp done " Yes, so exit
+
+ lac name " Still an argument, so move up
+ tad d4 " to the next filename argument
+ dac name
+ jmp loop " and loop back to cat this file
+
+badfile:
+ lac name " Get the pointer to the filename
+ dac 1f " Store it in 1f below
+ lac d8 " Load fd 8 which is stderr
+ sys write; 1:0; 4 " Write the four words of the filename
+ lac d8
+ sys write; 1f; 2 " and then write " ?\n"
+ jmp loop1 " Now try doing the next argument
+
+1: 040;077012 " String literal: " ?\n"
+
+nofiles:
+ lac d8
+ sys write; 1f; 5 " Write "No files\n" to stderr
+ sys exit " and exit
+
+1: ; 040; ;;; 040040; 040040; 040040
+dotdot:
+ 056056; 040040; 040040; 040040
+system:
+ ;;; 040040
+scrname:
+ <*s>;;040040;040040
+pass2:
+
@@ -266,18 +266,18 @@ bufwr: 0 " write current buffer to a.out file
dac maxsto
jmp i bufwr
-number: 0 " print decimal number?
- dac 3f
+number: 0 " print decimal number: append to buffer at index 8
+ dac 3f " save number
lac d1000
- dac 2f
+ dac 2f " save divisor
1:
lac 3f
cll
idiv; 2: 0
dac 3f
lacq
- tad o60
- dac i 8
+ tad o60 " add ascii '0'
+ dac i 8 " save char
lac 2b
cll
idiv; 10
@@ -288,17 +288,18 @@ number: 0 " print decimal number?
jmp i number
3: 0
- " get character from buffer
+ " get character from buffer (two characters per word)
" call with:
" jms getsc; pointer_pointer
- " where pointer_pointer contains a pointer to buffer
+ " where pointer_pointer refers to a pointer to buffer
+ " high bit in pointer indicates low char is next
getsc: 0
lac i getsc " get pointer pointer
dac sctalp " save
isz getsc " skip pointer pointer
lac i sctalp " fetch pointer
dac sctal " save
- add o400000 " toggle high bit of pointer
+ add o400000 " toggle high bit, increment on wrap
dac i sctalp " save pointer back
ral " rotate high bit into link reg
lac i sctal " load word from buffer
@@ -308,7 +309,7 @@ getsc: 0
jmp i getsc " return
" save characters: word after call is addr of pointer, -count pair
- " high bit in pointer used to indicate high or low byte next?
+ " high bit in pointer used to indicate high/low
putsc: 0
and o177 " strip character to 7 bits
lmq " save in MQ
@@ -318,7 +319,7 @@ putsc: 0
"** 05-1-4.pdf page 37
lac i sctalp " get pointer
dac sctal " save
- add o400000 " toggle sign bit by adding -0
+ add o400000 " toggle pointer sign bit, increment on wrap
dac i sctalp " save pointer
sma cla " skip if minus & clear AC
jmp 1f " AC positive
@@ -329,7 +330,7 @@ putsc: 0
1:
lac i sctal " load target word
- omq " or in char from MQ
+ omq " or in low char from MQ
dac i sctal " save word back
lacq " restore character
jmp i putsc " return
@@ -400,27 +401,27 @@ error: 0
jmp i error " return
1:
-1
- tad mesp
- dac 8
- lac i error
- dac i 8
- lac o40
- dac i 8
- lac rator
- sad d5
- jmp 1f
- lac savchr
- sad o12
- jmp 1f
- lac lineno
+ tad mesp " get mes-1
+ dac 8 " save as index
+ lac i error " get error
+ dac i 8 " save in mess
+ lac o40 " get space
+ dac i 8 " save in mess
+ lac rator " get operator
+ sad d5 " word break (semi, newline)?
+ jmp 1f " yes
+ lac savchr " no, get saved char
+ sad o12 " newline?
+ jmp 1f " yes
+ lac lineno " get lineno
jmp 2f
1:
-1
- tad lineno
+ tad lineno " get lineno -1
2:
- jms number
- lac o12
- dac i 8
+ jms number " convert line number to ascii
+ lac o12 " get newline
+ dac i 8 " append to mess
-2
tad mesp
cma
@@ -591,8 +592,8 @@ lqot: " left quote (<)
rqot: " right quote (>)
lac namc " get previous(?) char
1:
- dac rand+1
- lac d7
+ dac rand+1 " save value
+ lac d7 " return as literal
dac rator
jmp i gsymb
@@ -770,20 +771,20 @@ lu2:
namep: name
gpair: 0
- jms gsymb
+ jms gsymb " get a symbol
lac rator " get operator
sad d4 " space tab or comma?
jmp gpair+1 " yes, get another
- jms betwen; dm1; d6 " anything but a digit?
- jmp gp1 " no-- a digit
- dzm rand
+ jms betwen; dm1; d6 " plus, minus, comma, semi?
+ jmp gp1 " no
+ dzm rand " clear "rand"
dzm rand+1
- jmp i gpair
-gp1: " here with digit
- sad d7
- lac d4
- tad dm4
- dac rand
+ jmp i gpair " return
+gp1:
+ sad d7 " digit??
+ lac d4 " yes: switch to space??
+ tad dm4 " subtract 4??
+ dac rand " save as operand??
jms gsymb
lac rator
sad d4 " whitespace?
@@ -867,13 +868,15 @@ grand: 0
dac rand+1
jmp i grand
+ " called with
+ " jms oper; argument
oper: 0
tad opsw
dac oper1
-1
- tad i oper
- dac 8
- isz oper
+ tad i oper " pick up argument
+ dac 8 " store as index
+ isz oper " skip argument
lac r
sad d3
jmp oper2
@@ -958,10 +961,10 @@ o77: 077
o74: 074
o76: 076
-namsiz: -2
-namlstp: namlst
-fnamep: fakename
-lactab: lac .+1 " character class table (8 unless noted)
+namsiz: -2 " negative numberof namelist entries
+namlstp: namlst " pointer to namelist
+fnamep: fakename " pointer to fake namelist entry
+lactab: lac .+1 " character (operator) class table (8 unless noted)
8;8;8;8;8;8;8;8
8;4;5;8;8;8;8;8 " TAB=4 NL=5
8;8;8;8;8;8;8;8
@@ -979,44 +982,44 @@ lactab: lac .+1 " character class table (8 unless noted)
6;6;6;6;6;6;6;6
6;6;6;8;8;8;8;8
-fbflg: .=.+1
-tal: .=.+1
-talc: .=.+1
-tal1: .=.+1
-tal1c: .=.+1
-narg: .=.+1
-lvrand: .=.+1
-eofflg: .=.+1
-namc: .=.+1
-passno: .=.+1
-char: .=.+1
-savchr: .=.+1
-comflg: .=.+1
-rator: .=.+1
-orator: .=.+1
-rand: .=.+2
-srand: .=.+2
-r: .=.+2
-name: .=.+4
-buf: .=.+64
-iobuf: .=.+64
-fbx: .=.+10 " forward/backward pointers?
-mes: .=.+20
-iof: .=.+1
-bfi: .=.+1
-bfo: .=.+1
-lineno: .=.+1
+fbflg: .=.+1 " f/b label flag
+tal: .=.+1 " iobuf pointer
+talc: .=.+1 " -bytecount-1
+tal1: .=.+1 " namebuf pointer
+tal1c: .=.+1 " -bytecount-1
+narg: .=.+1 " argc
+lvrand: .=.+1 " numeric constant, word address
+eofflg: .=.+1 " 0 on EOF??
+namc: .=.+1 " saved char, temporary
+passno: .=.+1 " 0=pass1, 1=pass2
+char: .=.+1 " current character
+savchr: .=.+1 " pushed back char
+comflg: .=.+1 " comment flag
+rator: .=.+1 " (opo)rator (char type)
+orator: .=.+1 " ?? (op)orator
+rand: .=.+2 " ?? (ope)rand (type/address pair)
+srand: .=.+2 " ?? another operand
+r: .=.+2 " ?? yet another??
+name: .=.+4 " buffer for accumulating names
+buf: .=.+64 " a.out output buffer
+iobuf: .=.+64 " input buffer
+fbx: .=.+10 " forward/backward counters
+mes: .=.+20 " (error) message buffer
+iof: .=.+1 " source file fd
+bfi: .=.+1 " a.out input fd
+bfo: .=.+1 " a.out output fd
+lineno: .=.+1 " source file line number
-fakename: .=.+6 " dummy entry returned by tlookup??
-namlst:
-.=.+4
-dot: " dot type, value
-.=.+6
-cmflx: " dotdot type, value
-
- " first four words of name list are symbol (space padded)
+fakename: .=.+6 " dummy namelist entry returned by tlookup??
+namlst: " symbol table
+.=.+4 " dot name
+dot: " dot type, value
+.=.+6 " dot dot name
+cmflx: " dotdot type, value
+ " namelist (symbol table) entries are 6 words.
+ " four words of symbol (space padded) name
" next word is type??
" 0: initial dotdot type
- " 1: initial dot type
- " 3: set by "lookup"
- " last word is value??
\ No newline at end of file
+ " 1: initial dot type (reset on error)
+ " 3: set by "lookup" (user symbol)
+ " last word is value??
diff --git a/tools/as7 b/tools/as7
deleted file mode 100755
index 057e3be..0000000
--- a/tools/as7
+++ /dev/null
@@ -1,473 +0,0 @@
-#!/usr/bin/perl
-#
-# Read in files of PDP-7 assembly code in Ken Thompon's as format
-# and convert them into PDP-7 machine code
-#
-# (c) 2016 Warren Toomey, GPL3
-# Tweaked by Phil Budne (line, expression parsing, "list", "ptr" formats)
-#
-use strict;
-use warnings;
-use Data::Dumper;
-use Getopt::Long qw(GetOptions);
-
-Getopt::Long::Configure qw(gnu_getopt);
-
-### Global variables ###
-my %Var; # Variables such as ., .., t
-my %Label; # Labels that are defined once
-my %Rlabel; # Relative labels, e.g. 1:, 2:
- # with an array of locations for each label
-
-my @Mem; # Actual PDP-7 memory locations
-my @Mline; # Source lines associated with mem locations
-my $origline; # The original current input line of code
-my $line; # line being parsed
-my $stage = 1; # Pass one or pass two
-my $errors = 0; # set to non-zero on error
-my $line_error = ' ';
-my $file; # current file name
-my $lineno; # current line number
-
-## command line options
-my $debug = 0; # Run in debug mode
-my $format = 'a7out'; # output format
-
-# keep this near the GetOptions call to make it easy to add documentation!
-sub usage {
- die("Usage: $0 [--debug] [--format=a7out|list|ptr ] file1.s [file2.s ...]\n")
-}
-
-### Main program ###
-
-GetOptions(
- 'debug|d' => \$debug,
- 'format|f=s' => \$format,
-) or usage();
-
-usage() if ( @ARGV < 1 );
-
-# start with the location counter at zero
-# predefine syscall and opcodes as variables
-%Var = (
- '.' => 020,
- '..' => 4096, # output base addr?
-
- # as.s does not have an initial symbol table
- # (except for the above), so there must have been a
- # user "ops" file
-
- save => 1, # saves core dump & user area!
- getuid => 2,
- open => 3,
- read => 4,
- write => 5,
- creat => 6,
- seek => 7,
- tell => 8,
- close => 9,
- link => 10,
- unlink => 11,
- setuid => 12,
- rename => 13,
- exit => 14,
- time => 15,
- intrp => 16,
- chdir => 17,
- chmod => 18,
- chown => 19,
- # 20 removed
- sysloc => 21, # return system addresses
- # 22 removed
- capt => 23, # capture display?
- rele => 24, # release display?
- status => 25, # "stat"
- smes => 27,
- rmes => 28,
- fork => 29,
-
- # List of instruction names and machine code values
- # These come from https://raw.githubusercontent.com/simh/
-
- sys => 0020000, # "cal i" instruction (trap indirect thru 020)
- i => 0020000, # indirect bit
-
- # memory reference instructions
- dac => 0040000, # deposit AC
- jms => 0100000, # jump to subroutine
- dzm => 0140000, # deposit zero in memory
- lac => 0200000, # load AC
- xor => 0240000, # exclusive or
- add => 0300000, # one's complement add
- tad => 0340000, # two's complement add
- xct => 0400000, # execute
- isz => 0440000, # increment and skip if zero
- and => 0500000, # AND with contents of Y
- sad => 0540000, # skip if AC different from content of Y
- jmp => 0600000, # jump to Y
-
- # Type 177 Extended Arithmetic Element (EAE)
- eae => 0640000, # base instruction (nop)
- osc => 0640001, # OR SC into AC
- omq => 0640002, # OR MQ into AC
- cmq => 0640004, # Complement MQ
- div => 0640323, # divide
- norm => 0640444, # normalize, unsigned
- lls => 0640600, # long left shift
- als => 0640700, # AC shift
- lrs => 0640500, # long right shift
- lacs => 0641001, # load AC with SC
- lacq => 0641002, # load AC with MQ
- abs => 0644000, # absolute value
- divs => 0644323, # divide, signed
-
- clq => 0650000, # clear MQ
- frdiv => 0650323, # fractional divide
- lmq => 0652000, # load MQ from AC
- mul => 0653122, # multiply
- idiv => 0653323, # integer divide
- idivs => 0657323, # integer divide, signed
- frdivs => 0654323, # fractional divide, signed
- muls => 0657122, # multiply, signed
-
- norms => 0660444, # normalize, signed
- gsm => 0664000, # get sign and magnitude
- lrss => 0660500, # long right shift, signed
- llss => 0660600, # long left shift, signed
- alss => 0660700, # AC left shift, signed
-
- # PLB: removed I/OT instructions: kernel uses sop.s
-
- # Operate Instructions
-
- # Group 1 (OPR 1) instructions
- opr => 0740000, # base operate instruction (nop)
- nop => 0740000,
- cma => 0740001, # complement accumulator
- cml => 0740002, # complement link
- oas => 0740004, # inclusive or accumulator switches
- ral => 0740010, # rotate (ac, link) left
- rar => 0740020, # rotate (ac, link) right
- hlt => 0740040, # HALT
- xx => 0740040,
- sma => 0740100, # skip on minus accumulator
- sza => 0740200, # skip on zero accumulator
- snl => 0740400, # skip on non-zero link
-
- skp => 0741000, # unconditional skip
- spa => 0741100, # skip on positive accumulator
- sna => 0741200, # skip on negative accumulator
- szl => 0741400, # skip on zero link
-
- rtl => 0742010, # rotate two left (ral*2)
- rtr => 0742020, # rotate two right (rar*2)
-
- cll => 0744000, # clear link
- stl => 0744002, # set link
- rcl => 0744010, # clear link, rotate left
- rcr => 0744020, # clear link, rotate right
-
- cla => 0750000, # clear accumulator
- clc => 0750001, # clear and complement acc
- las => 0750004, # load acc from switches
- glk => 0750010, # get link
-
- # Group 2 operate
- law => 0760000, # load accumulator with (instruction)
-# lam => 0777777, # (load accumulator minus)
-);
-
-# Parse all the files
-foreach my $file (@ARGV) {
- parse_file($file);
-}
-
-# Now do it all again, pass two
-$Var{'.'} = 020;
-$stage = 2;
-print("PASS 2\n") if ($debug);
-foreach my $file (@ARGV) {
- parse_file($file);
-}
-
-if ($format eq 'a7out') {
- # print out the contents of memory
- for my $i ( 0 .. $#Mem ) {
- if ( defined( $Mem[$i] ) ) {
- printf( "%06o: %06o\t%s\n", $i, $Mem[$i], $Mline[$i] || "" );
- }
- }
-}
-elsif ($format eq 'list') {
- print "\n";
- print "Labels:\n";
- foreach my $key (sort keys %Label) {
- printf("%-8.8s %#06o\n", $key, $Label{$key});
- }
-}
-elsif ($format eq 'ptr') { # dump absolute memory in PTR binary
- for my $loc ( 0 .. $#Mem ) {
- my $m = $Mem[$loc] || 0;
- printf("%c%c%c", ($m >> 12) & 077, ($m >> 6) & 077, $m & 077);
- }
-}
-else {
- die("unknown format $format");
-}
-
-# as.s writes a binary file named n.out, ours is ascii
-open (my $NOUT, ">n.out") || die "n.out";
-foreach my $key (sort keys %Label) {
- printf $NOUT "%-8.8s %#06o\n", $key, $Label{$key};
-}
-close($NOUT);
-
-exit($errors);
-
-# report an assmebly error:
-# sets error flag
-# reports filename:lineno for emacs m-x compile
-sub err {
- $line_error = shift;
- my $msg = shift;
-
- $errors = 1; # exit status
- if ($stage == 2) {
- print STDERR "$file:$lineno: $msg\n";
- print "$file:$lineno: $msg\n" if (! -t STDOUT && $format ne 'ptr');
- }
- return 0; # expression value
-}
-
-# Open and parse the given file
-sub parse_file {
- $file = shift;
- open( my $IN, "<", $file ) || die("Cannot read $file: $!\n");
- $lineno = 0;
- while ( $line = <$IN> ) {
- $lineno++;
- chomp($line); # Lose the end of line
- $origline = $line;
- print "\t\t$line\n" if ($stage == 2 && $line ne '' && $format eq 'list');
- parse_line();
- }
- close($IN);
-}
-
-# process a label and set its value to the location counter
-# OK for symbolic label to be entered twice, so long as it's the same value
-# (ie; both passes)
-sub process_label {
- my $label = shift;
- my $loc = $Var{'.'};
-
- print "process_label $label\n" if ($debug);
-
- if ( $label =~ m{^\d+$} ) { # numeric (relative) label?
- if ($stage == 1) {
- push( @{ $Rlabel{$label} }, $loc );
- printf( "Pushing %#o for label %s\n", $loc, $label ) if ($debug);
- }
- } # numeric label
- else { # symbolic label
- # error to have different values
- if ( defined( $Label{$label} ) && $Label{$label} != $loc ) {
- err('M', "Label $label multiply defined");
- }
- else {
- $Label{$label} = $loc;
- printf( "Set label %s to %#o\n", $label, $loc ) if ($debug);
- }
- }
-}
-
-sub eol {
- return $line eq '' || $line =~ m{^"}; # empty or comment
-}
-
-# Blame Phil for this....
-# parses global $line based on prefixes, nibbling of a bit at a time
-# (: and ; can appear in char literals)
-# handles multiple ';' separated words per line
-# allows " in character literals (tho none appear in listings)
-sub parse_line {
- while (1) {
- $line_error = ' '; # clear listing error indicator
-
- return if (eol());
-
- # Lose any leading whitespace
- $line =~ s{^\s*}{};
-
- print "parse_line: '$line'\n" if ($debug);
-
- while ($line =~ s{^([a-z0-9\.]+):\s*}{}) { # labels
- process_label($1);
- }
-
- return if (eol());
-
- if ( $line =~ s{^(\S+)\s*=}{}) { # assignment
- my $lhs = $1;
- my $word = parse_expression();
- printf( "Setting variable %s to 0%o\n", $lhs, $word ) if ($debug);
- $Var{$lhs} = $word;
- printf("\t%06o %s\n", $word, $line_error) if ($stage == 2 && $format eq 'list');
- }
- else { # bare expression (not assignment)
- # Get its value on pass two and save to memory
- # Also save the input line that altered memory
- my $word = parse_expression();
- if ( $stage == 2 ) {
- my $location = $Var{'.'};
- $Mem[$location] = $word;
- $Mline[$location] = $origline;
- $origline = '';
- if ($format eq 'list' and defined($word)) {
- printf( "%06o: %06o %s\n", $location, $word, $line_error);
- }
- }
- # Move up to the next location in both passes
- $Var{'.'}++;
- } # expr
-
- # eat trailing whitespace and ";", if any
- $line =~ s{^\s*;?}{};
- } # while
-}
-
-# Blame Phil for this bit too...
-# Parse an expression off $line and return a PDP-7 word
-# as a series of whitespace separated "syllables"
-# ORed, added, or subtracted
-sub parse_expression {
- my $word = 0;
-
- print "expression: '$line'\n" if ($debug);
-
- while (1) {
- my $syllable = 0;
- my $op = '|';
-
- $line =~ s{^\s+}{}; # as.s accepts ",' as whitespace too!
-
- if ($line eq '' || $line =~ m{^[";]}) { # EOL ; and " terminate expr
- printf("\tparse_expression => %#o\n", $word) if ($debug);
- return $word;
- }
-
- print " '$line'\n" if ($debug);
-
- if ($line =~ s{^-}{}) {
- print "\tfound -\n" if ($debug);
- $op = '-';
- }
- elsif ($line =~ s{^\+}{}) {
- print "\tfound +\n" if ($debug);
- $op = '+';
- }
-
- if ($line =~ s{^<(.)}{}) { # }{}) { # char>
- print "\tfound x>\n" if ($debug);
- $syllable = ord($1)
- }
- elsif ($line =~ s{^>(.)}{}) { # >char !!
- print "\tfound >x\n" if ($debug);
- $syllable = ord($1)
- }
- elsif ($line =~ s{^([a-z\.][a-z0-9\.]*)}{}) {
- my $sym = $1;
- print "\tsym: $sym\n" if ($debug);
- if (defined($Var{$sym})) {
- $syllable = $Var{$sym};
- printf("\tvar: %s: %#o\n", $sym, $syllable) if ($debug);
- }
- elsif (defined($Label{$sym})) {
- $syllable = $Label{$sym};
- printf("\tlbl: %s: %#o\n", $sym, $syllable) if ($debug);
- }
- elsif ($stage == 2) {
- err('U', "$sym not defined")
- } # pass 2
- } # symbol
- elsif ( $line =~ s{^(\d+)([fb])}{} ) { # relative label
- printf "\tfound relative: $1$2\n" if ($debug);
- $syllable = find_relative_label( $1, $2 ) if ($stage == 2);
- }
- elsif ( $line =~ s{^(\d+)}{} ) { # constant
- my $value = $1;
- printf "\tfound constant: $value\n" if ($debug);
- if ( $value =~ m{^0} ) {
- $syllable = oct($value);
- }
- else {
- $syllable = $value + 0;
- }
- $syllable &= 0777777;
- }
- else {
- # From the BSD fortune file:
- # Ken Thompson has an automobile which he helped design.
- # Unlike most automobiles, it has neither speedometer,
- # nor gas gauge, nor any of the numerous idiot lights
- # which plague the modern driver. Rather, if the driver
- # makes any mistake, a giant "?" lights up in the center
- # of the dashboard. "The experienced driver",
- # he says, "will usually know what's wrong.
- err('?', "huh? '$line'");
- $line = ''; # abort processing
- return undef;
- }
-
- if ($op eq '+') {
- $word += $syllable;
- }
- elsif ($op eq '-') {
- $word -= $syllable;
- }
- else {
- $word |= $syllable;
- }
- $word &= 0777777;
- printf("\tsyllable: %#o word: %#o\n", $syllable, $word) if ($debug);
- }
-}
-
-# Given a relative label number and a direction,
-# return the location of this relative label or
-# die if we don't have one
-sub find_relative_label {
- my ( $label, $direction ) = @_;
- my $curlocation = $Var{'.'};
-
- # Error check: no labels at all
- if ( !defined( $Rlabel{$label} ) ) {
- return err('U', "relative label $label never defined");
- }
-
- # Get the list of possible locations for this label
- my $locarray = $Rlabel{$label};
-
- # Error check: no locations
- return err('U', "No relative labels") if ( @{$locarray} == 0 );
-
- if ( $direction eq 'f' ) {
- # Search forward for first location larger then the current one
- foreach my $reflocation ( @{$locarray} ) {
- printf("forward %#o %#o\n", $reflocation, $curlocation) if ($debug);
- return ($reflocation) if ( $reflocation > $curlocation );
- }
- }
- else {
- # Search backwards for first location smaller than the current one
- foreach my $reflocation ( sort( { $b <=> $a } @{$locarray} ) ) {
- printf("backward %#o %#o\n", $reflocation, $curlocation) if ($debug);
- return ($reflocation) if ( $reflocation < $curlocation );
- }
- }
- return err('U', "undefined relative reference $label$direction");
-}