Skip to content

Commit

Permalink
Since there are no complex initializations, a TLA expression maps to …
Browse files Browse the repository at this point in the history
…a single Go expression. Refactor TLAExprToGo to reflect this
  • Loading branch information
Brandon Zhang committed Jun 2, 2017
1 parent 6771338 commit 1a54758
Show file tree
Hide file tree
Showing 19 changed files with 198 additions and 310 deletions.
4 changes: 1 addition & 3 deletions pgo-code-style.epf

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLA.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.trans.PGoTransException;

Expand Down Expand Up @@ -30,7 +30,7 @@ public int getLine() {
* @throws PGoTransException
* if there is a type contradiction
*/
protected abstract Vector<Statement> convert(TLAExprToGo trans) throws PGoTransException;
protected abstract Expression convert(TLAExprToGo trans) throws PGoTransException;

/**
* Infer the type of the TLA expression using the translator passed in.
Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLAArray.java
Expand Up @@ -3,7 +3,7 @@
import java.util.Vector;

import pcal.TLAToken;
import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.parser.TLAExprParser;
import pgo.trans.PGoTransException;
Expand All @@ -28,7 +28,7 @@ public Vector<PGoTLA> getContents() {
return contents;
}

protected Vector<Statement> convert(TLAExprToGo trans) {
protected Expression convert(TLAExprToGo trans) {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLABool.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;

public class PGoTLABool extends PGoTLA {
Expand All @@ -24,7 +24,7 @@ public boolean getVal() {
return val;
}

protected Vector<Statement> convert(TLAExprToGo trans) {
protected Expression convert(TLAExprToGo trans) {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLABoolOp.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.trans.PGoTransException;

Expand Down Expand Up @@ -37,7 +37,7 @@ public PGoTLA getRight() {
return right;
}

protected Vector<Statement> convert(TLAExprToGo trans) throws PGoTransException {
protected Expression convert(TLAExprToGo trans) throws PGoTransException {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLAFunction.java
Expand Up @@ -3,7 +3,7 @@
import java.util.Vector;

import pcal.TLAToken;
import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.parser.TLAExprParser;
import pgo.trans.PGoTransException;
Expand Down Expand Up @@ -34,7 +34,7 @@ public Vector<PGoTLA> getParams() {
return params;
}

protected Vector<Statement> convert(TLAExprToGo trans) {
protected Expression convert(TLAExprToGo trans) {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLAGroup.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.trans.PGoTransException;

Expand All @@ -27,7 +27,7 @@ public PGoTLA getInner() {
return inner;
}

protected Vector<Statement> convert(TLAExprToGo trans) throws PGoTransException {
protected Expression convert(TLAExprToGo trans) throws PGoTransException {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLANumber.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;

/**
Expand All @@ -22,7 +22,7 @@ public String getVal() {
return val;
}

protected Vector<Statement> convert(TLAExprToGo trans) {
protected Expression convert(TLAExprToGo trans) {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLASequence.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.trans.PGoTransException;

Expand Down Expand Up @@ -30,7 +30,7 @@ public PGoTLA getEnd() {
return end;
}

protected Vector<Statement> convert(TLAExprToGo trans) throws PGoTransException {
protected Expression convert(TLAExprToGo trans) throws PGoTransException {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLASet.java
Expand Up @@ -3,7 +3,7 @@
import java.util.Vector;

import pcal.TLAToken;
import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.parser.TLAExprParser;
import pgo.trans.PGoTransException;
Expand All @@ -26,7 +26,7 @@ public Vector<PGoTLA> getContents() {
return contents;
}

protected Vector<Statement> convert(TLAExprToGo trans) throws PGoTransException {
protected Expression convert(TLAExprToGo trans) throws PGoTransException {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLASetOp.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.trans.PGoTransException;

Expand Down Expand Up @@ -32,7 +32,7 @@ public PGoTLA getRight() {
return right;
}

protected Vector<Statement> convert(TLAExprToGo trans) throws PGoTransException {
protected Expression convert(TLAExprToGo trans) throws PGoTransException {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLASimpleArithmetic.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.trans.PGoTransException;

Expand Down Expand Up @@ -42,7 +42,7 @@ public PGoTLA getRight() {
return right;
}

protected Vector<Statement> convert(TLAExprToGo trans) throws PGoTransException {
protected Expression convert(TLAExprToGo trans) throws PGoTransException {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLAString.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;

/**
Expand All @@ -22,7 +22,7 @@ public String getString() {
return string;
}

protected Vector<Statement> convert(TLAExprToGo trans) {
protected Expression convert(TLAExprToGo trans) {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLASuchThat.java
Expand Up @@ -3,7 +3,7 @@
import java.util.Vector;

import pcal.TLAToken;
import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.parser.TLAExprParser;
import pgo.trans.PGoTransException;
Expand Down Expand Up @@ -69,7 +69,7 @@ public boolean isSetImage() {
return isSetImage;
}

protected Vector<Statement> convert(TLAExprToGo trans) {
protected Expression convert(TLAExprToGo trans) {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLAUnary.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;
import pgo.trans.PGoTransException;

Expand Down Expand Up @@ -30,7 +30,7 @@ public PGoTLA getArg() {
return arg;
}

protected Vector<Statement> convert(TLAExprToGo trans) throws PGoTransException {
protected Expression convert(TLAExprToGo trans) throws PGoTransException {
return trans.translate(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pgo/model/tla/PGoTLAVariable.java
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

import pgo.model.golang.Statement;
import pgo.model.golang.Expression;
import pgo.model.intermediate.PGoType;

/**
Expand All @@ -22,7 +22,7 @@ public String getName() {
return name;
}

protected Vector<Statement> convert(TLAExprToGo trans) {
protected Expression convert(TLAExprToGo trans) {
return trans.translate(this);
}

Expand Down

0 comments on commit 1a54758

Please sign in to comment.