Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jimple pretty print #147

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tallestgabs
Copy link

Gabriel de Castro Dias - 211055432
João Victor Pereira Vieira - 211036114

DIFICULDADES:
Problemas com Tempo
Problemas com Grupo
Problemas com Organização
Final de Semestre puxado
Falta de contato com a linguagem
Trabalhar com um código avançado e já implementado por outras pessoas
Sem comentários no código

CONTRIBUIÇÕES: Pretty Print
Adicionamos sistemas de tipos
Adicionamos Cabeçalhos
Adicionamos Sistemas de Blocos
Adicionamos Funções que geram Expressões
Adicionamos Arquivos Jimple gerados no Soot
Organizamos os Testes

Obs: Implementamos o Pretty Print no JimpleCodeGenerator.scala
O print foi feito através do código Jimple gerado, usamos Oberon apenas para gerar arquivos java
Não mudamos as Declarações já Existentes

Um exemplo do que fizemos:

Print gerado anteriormente:

ClassDeclaration(List(PublicModifer),TObject(SimpleModule4),TObject(java.lang.Object),
List(),List(Field(List(PublicModifer, StaticModifier, FinalModifier),TInteger,x),
Field(List(PublicModifer, StaticModifier, FinalModifier),TInteger,y),
Field(List(PublicModifer, StaticModifier, FinalModifier),TInteger,z),
Field(List(PublicModifer, StaticModifier),TInteger,abc),
Field(List(PublicModifer, StaticModifier),TBoolean,def)),
List(Method(List(PublicModifer, StaticModifier),TVoid,main,List(TArray(TString)),List(),
DefaultMethodBody(List(LocalVariableDeclaration(TArray(TString),args)),
List(AssignStmt(StaticField(FieldSignature(SimpleModule4,TInteger,x)),
ImmediateExpression(ImmediateValue(IntValue(5)))),
AssignStmt(StaticField(FieldSignature(SimpleModule4,TInteger,y)),
ImmediateExpression(ImmediateValue(IntValue(10)))),
AssignStmt(StaticField(FieldSignature(SimpleModule4,TInteger,z)),
PlusExpression(ImmediateValue(IntValue(5)),ImmediateValue(IntValue(10))))),List()))))

Print atual:

Public Class SimpleModule4 extends java.lang.Object
{
Public static final int x;
Public static final int y;
Public static final int z;
Public int abc;
Public boolean def;

public void <init>()
{
    SimpleModule4 r0;

    r0 := @this: SimpleModule4;

    specialinvoke r0.<java.lang.Object: void <init>()>();

    return;    
}

public static void <clinit>()
{
    <SimpleModule4: int z> = 15;

    <SimpleModule4: int y> = 10;

    <SimpleModule4: int x> = 5;

    return;
}

}

gabfelix added a commit to gabfelix/Oberon-Scala that referenced this pull request Dec 7, 2023
This commit merges the code from pull request UnBCIC-TP2#147 into the master
branch, which implements a pretty printer for the Jimple IR of the
interpreter and adds some sample jimple files for testing.

Some changes had to be done to migrate away from the original code's
reliance on CodeVisitor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant