Skip to content

Commit 182e72d

Browse files
committed
Updated SlangLl2.
1 parent 4213ea9 commit 182e72d

File tree

9 files changed

+2324
-2086
lines changed

9 files changed

+2324
-2086
lines changed

ast/shared/src/main/scala/org/sireum/lang/ast/SlangLl2PrettyPrinter.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ object SlangLl2PrettyPrinter {
132132
case o: AST.ProofAst.StepId.Str => o.prettyST
133133
}
134134
@strictpure def printAssignExp(o: AST.AssignExp): ST = printStmt(T, o.asStmt)
135-
@strictpure def printWitneses(o: AST.ProofAst.Step.Justification): ST = if (o.hasWitness && o.witnesses.nonEmpty) st" [${(for (w <- o.witnesses) yield w.prettyST, ", ")}]" else st""
135+
@strictpure def printWitneses(o: AST.ProofAst.Step.Justification): ST = if (o.hasWitness) st" <${(for (w <- o.witnesses) yield w.prettyST, ", ")}>" else st""
136136
@strictpure def printJust(o: AST.ProofAst.Step.Justification): ST = o match {
137137
case o: AST.ProofAst.Step.Justification.Apply => st"${printExp(o.invoke)}${printWitneses(o)}"
138138
case o: AST.ProofAst.Step.Justification.ApplyEta => st"${printExp(o.eta)}${printWitneses(o)}"
@@ -157,7 +157,12 @@ object SlangLl2PrettyPrinter {
157157
st"""deduce {
158158
| ${(for (step <- o.steps) yield printProofStep(step), lineSep)}
159159
|}"""
160-
@strictpure def shouldAddDo(o: AST.Exp): B = T
160+
@strictpure def shouldAddDo(o: AST.Exp): B = o match {
161+
case _: AST.Exp.Invoke => F
162+
case _: AST.Exp.InvokeNamed => F
163+
case _: AST.Exp.Select => F
164+
case _ => T
165+
}
161166
@strictpure def printIfElse(elseBody: AST.Body): ST = {
162167
elseBody.stmts match {
163168
case ISZ() => st""

parser/jvm/src/main/java/org/sireum/lang/parser/antlrv4/SlangLl2.interp

Lines changed: 10 additions & 1 deletion
Large diffs are not rendered by default.

parser/jvm/src/main/java/org/sireum/lang/parser/antlrv4/SlangLl2BaseVisitor.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,27 @@ public class SlangLl2BaseVisitor<T> extends AbstractParseTreeVisitor<T> implemen
509509
* {@link #visitChildren} on {@code ctx}.</p>
510510
*/
511511
@Override public T visitJust(SlangLl2Parser.JustContext ctx) { return visitChildren(ctx); }
512+
/**
513+
* {@inheritDoc}
514+
*
515+
* <p>The default implementation returns the result of calling
516+
* {@link #visitChildren} on {@code ctx}.</p>
517+
*/
518+
@Override public T visitJustArgs(SlangLl2Parser.JustArgsContext ctx) { return visitChildren(ctx); }
519+
/**
520+
* {@inheritDoc}
521+
*
522+
* <p>The default implementation returns the result of calling
523+
* {@link #visitChildren} on {@code ctx}.</p>
524+
*/
525+
@Override public T visitJustTypeArgs(SlangLl2Parser.JustTypeArgsContext ctx) { return visitChildren(ctx); }
526+
/**
527+
* {@inheritDoc}
528+
*
529+
* <p>The default implementation returns the result of calling
530+
* {@link #visitChildren} on {@code ctx}.</p>
531+
*/
532+
@Override public T visitJustWitnesses(SlangLl2Parser.JustWitnessesContext ctx) { return visitChildren(ctx); }
512533
/**
513534
* {@inheritDoc}
514535
*

parser/jvm/src/main/java/org/sireum/lang/parser/antlrv4/SlangLl2Lexer.interp

Lines changed: 10 additions & 1 deletion
Large diffs are not rendered by default.

parser/jvm/src/main/java/org/sireum/lang/parser/antlrv4/SlangLl2Lexer.java

Lines changed: 434 additions & 425 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)