-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08be6ff
commit dfd5642
Showing
23 changed files
with
866 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
mkdir output | ||
javac parser/langX.java | ||
javac langXrt/Runtime.java | ||
java parser.langX "$1" | ||
java -jar ~/jasmin-2.4/jasmin.jar "$1.$2.jas" | ||
clear | ||
java -classpath .:. $2 | ||
|
||
mkdir "output/$3" | ||
|
||
cp "$1.arvore.txt" "output/$3" | ||
cp "$2.class" "output/$3" | ||
cp "saida.txt" "output/$3" | ||
cp "$1" "output/$3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Parametros: | ||
6 | ||
1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
|
||
|
||
Saida: | ||
vetor[0][0] = 1 | ||
vetor[1][0] = 2 | ||
vetor[2][0] = 3 | ||
vetor[3][0] = 4 | ||
vetor[4][0] = 5 | ||
vetor[5][0] = 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
class bubblesort{ | ||
|
||
int condicional(int v1, int v2){ | ||
if(v1 > v2) return 1; | ||
return 0; | ||
} | ||
|
||
int start(){ | ||
|
||
int n,i; | ||
|
||
print "Numero de valores do vetor: "; | ||
read n; | ||
|
||
//n = 5; | ||
|
||
int vetor[][]; | ||
|
||
vetor = new int[n][1]; | ||
|
||
//vetor[0][0] = 5; | ||
//vetor[1][0] = 7; | ||
//vetor[2][0] = 3; | ||
//vetor[3][0] = 8; | ||
//vetor[4][0] = 1; | ||
|
||
print "Digite os valores do vetor: "; | ||
|
||
for (i = 0; i < n; i = i + 1){ | ||
read vetor[i][0]; | ||
} | ||
|
||
|
||
int j, min, aux; | ||
|
||
for (i = n; i >= 1; i = i - 1) { | ||
for (j = 1; j < i; j = j + 1) { | ||
if (vetor[j - 1][0] > vetor[j][0]) { | ||
aux = vetor[j][0]; | ||
vetor[j][0] = vetor[j - 1][0]; | ||
vetor[j - 1][0] = aux; | ||
} | ||
} | ||
} | ||
|
||
for (i = 0; i < n; i = i + 1){ | ||
print "vetor["+i+"][0] = "+vetor[i][0]+ " \n" ; | ||
} | ||
|
||
return 0; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Parametros: | ||
4 | ||
4 | ||
3 | ||
2 | ||
1 | ||
|
||
Saida: | ||
vetor[0][0] = 1 | ||
vetor[1][0] = 2 | ||
vetor[2][0] = 3 | ||
vetor[3][0] = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
class bubblesort{ | ||
|
||
int condicional(int v1, int v2){ | ||
if(v1 > v2) return 1; | ||
return 0; | ||
} | ||
|
||
int start(){ | ||
|
||
int n,i; | ||
|
||
print "Numero de valores do vetor: "; | ||
read n; | ||
|
||
//n = 5; | ||
|
||
int vetor[][]; | ||
|
||
vetor = new int[n][1]; | ||
|
||
//vetor[0][0] = 5; | ||
//vetor[1][0] = 7; | ||
//vetor[2][0] = 3; | ||
//vetor[3][0] = 8; | ||
//vetor[4][0] = 1; | ||
|
||
print "Digite os valores do vetor: "; | ||
|
||
for (i = 0; i < n; i = i + 1){ | ||
read vetor[i][0]; | ||
} | ||
|
||
|
||
int j, min, aux; | ||
|
||
for (i = n; i >= 1; i = i - 1) { | ||
for (j = 1; j < i; j = j + 1) { | ||
if (vetor[j - 1][0] > vetor[j][0]) { | ||
aux = vetor[j][0]; | ||
vetor[j][0] = vetor[j - 1][0]; | ||
vetor[j - 1][0] = aux; | ||
} | ||
} | ||
} | ||
|
||
for (i = 0; i < n; i = i + 1){ | ||
print "vetor["+i+"][0] = "+vetor[i][0]+ " \n" ; | ||
} | ||
|
||
return 0; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
class bubblesort{ | ||
|
||
int condicional(int v1, int v2){ | ||
if(v1 > v2) return 1; | ||
return 0; | ||
} | ||
|
||
int start(){ | ||
|
||
int n,i; | ||
|
||
print "Numero de valores do vetor: "; | ||
read n; | ||
|
||
//n = 5; | ||
|
||
int vetor[][]; | ||
|
||
vetor = new int[n][1]; | ||
|
||
//vetor[0][0] = 5; | ||
//vetor[1][0] = 7; | ||
//vetor[2][0] = 3; | ||
//vetor[3][0] = 8; | ||
//vetor[4][0] = 1; | ||
|
||
print "Digite os valores do vetor: "; | ||
|
||
for (i = 0; i < n; i = i + 1){ | ||
read vetor[i][0]; | ||
} | ||
|
||
|
||
int j, min, aux; | ||
|
||
for (i = n; i >= 1; i = i - 1) { | ||
for (j = 1; j < i; j = j + 1) { | ||
if (vetor[j - 1][0] > vetor[j][0]) { | ||
aux = vetor[j][0]; | ||
vetor[j][0] = vetor[j - 1][0]; | ||
vetor[j - 1][0] = aux; | ||
} | ||
} | ||
} | ||
|
||
for (i = 0; i < n; i = i + 1){ | ||
print "vetor["+i+"][0] = "+vetor[i][0]+ " \n" ; | ||
} | ||
|
||
return 0; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Ler o ano de nascimento de uma pessoa e iformar sua idade | ||
// se a indade for menor que 16 anos informar não pode trabalho | ||
// se a indade for entre 16 e 18 anos informar menor aprendiz | ||
// se a idade for maior que 18 anos informar contrato de trabalho | ||
|
||
class classetrabalho{ | ||
|
||
int start(){ | ||
|
||
int anonascimento, idade; | ||
|
||
print "digite o ano de nascimento: \n"; | ||
read anonascimento; | ||
|
||
idade = 2017 - anonascimento; | ||
|
||
print "idade: " + idade + "\n"; | ||
|
||
if(idade < 16){ | ||
print "nao pode trabalhar"; | ||
|
||
return 0; | ||
} | ||
|
||
if(idade > 18){ | ||
print "contrato de trabalho"; | ||
|
||
return 0; | ||
} | ||
|
||
if(idade >= 16){ | ||
|
||
if(idade <= 18){ | ||
print "menor aprendiz"; | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Ler o ano de nascimento de uma pessoa e iformar sua idade | ||
// se a indade for menor que 16 anos informar não pode trabalho | ||
// se a indade for entre 16 e 18 anos informar menor aprendiz | ||
// se a idade for maior que 18 anos informar contrato de trabalho | ||
|
||
class classetrabalho{ | ||
|
||
int start(){ | ||
|
||
int anonascimento, idade; | ||
|
||
print "digite o ano de nascimento: \n"; | ||
read anonascimento; | ||
|
||
idade = 2017 - anonascimento; | ||
|
||
print "idade: " + idade + "\n"; | ||
|
||
if(idade < 16){ | ||
print "nao pode trabalhar"; | ||
|
||
return 0; | ||
} | ||
|
||
if(idade > 18){ | ||
print "contrato de trabalho"; | ||
|
||
return 0; | ||
} | ||
|
||
if(idade >= 16){ | ||
|
||
if(idade <= 18){ | ||
print "menor aprendiz"; | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Ler o ano de nascimento de uma pessoa e iformar sua idade | ||
// se a indade for menor que 16 anos informar não pode trabalho | ||
// se a indade for entre 16 e 18 anos informar menor aprendiz | ||
// se a idade for maior que 18 anos informar contrato de trabalho | ||
|
||
class classetrabalho{ | ||
|
||
int start(){ | ||
|
||
int anonascimento, idade; | ||
|
||
print "digite o ano de nascimento: \n"; | ||
read anonascimento; | ||
|
||
idade = 2017 - anonascimento; | ||
|
||
print "idade: " + idade + "\n"; | ||
|
||
if(idade < 16){ | ||
print "nao pode trabalhar"; | ||
|
||
return 0; | ||
} | ||
|
||
if(idade > 18){ | ||
print "contrato de trabalho"; | ||
|
||
return 0; | ||
} | ||
|
||
if(idade >= 16){ | ||
|
||
if(idade <= 18){ | ||
print "menor aprendiz"; | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// calcula o fatorial de um número | ||
|
||
class fatorial{ | ||
|
||
int start() | ||
{ | ||
int fat, n; | ||
print "Insira um valor para o qual deseja calcular seu fatorial: "; | ||
read n; | ||
|
||
for(fat = 1; n > 1; n = n - 1){ | ||
fat = fat * n; | ||
} | ||
|
||
print "\nFatorial calculado: " + fat; | ||
|
||
return 0; | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.