Skip to content

Commit a64ff53

Browse files
committed
Initial commit
0 parents  commit a64ff53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2261
-0
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
JFLAGS = -cp "bin;."
2+
PROCESADOR = src/*.java
3+
APP_RUN = JavaScript
4+
5+
.PHONY: compile
6+
compile:
7+
@javac -d bin $(JFLAGS) $(PROCESADOR)
8+
9+
run:
10+
@java $(JFLAGS) $(APP_RUN) $(fich)
11+
12+
.PHONY: clean
13+
clean:
14+
rm -r bin

bin/AFD.class

2.18 KB
Binary file not shown.

bin/JavaScript.class

13.8 KB
Binary file not shown.

bin/MTpair.class

1.08 KB
Binary file not shown.

bin/Reader.class

1.08 KB
Binary file not shown.

bin/Token.class

1.02 KB
Binary file not shown.

bin/Writer.class

1.31 KB
Binary file not shown.

data/input.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
let boolean booleano;
2+
3+
print
4+
5+
(
6+
7+
'http://dlsiis.fi.upm.es/procesadores' //
8+
9+
)
10+
11+
;
12+
function bisiesto boolean (int a)
13+
{ let string bis;
14+
print ('Es bisiesto?');
15+
input(bis);
16+
return ((a - 4 < 0));
17+
}
18+
function dias int (int m, int a)
19+
{
20+
let int dd;
21+
print ('di cuantos dias tiene el mes ');
22+
print (m);
23+
input(dd);
24+
if (bisiesto(a)) dd = dd - 1;
25+
return dd;
26+
}
27+
function esFechaCorrecta boolean (int d, int m, int a)
28+
{
29+
return !(d < dias (m, a));
30+
}
31+
function demo ()
32+
{
33+
34+
if (esFechaCorrecta(22, 22, 2022)) print (9999);
35+
return;
36+
}
37+
let int a1b2c3d4e5f6g7h8i9j0;
38+
demo();

data/input_variados.txt

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
Prueba 1
2+
---------------------------------------------------
3+
let int a ;
4+
let int b ;
5+
let int number;
6+
print ( 'Introduce el primer operando' );
7+
input (a);
8+
print ('Introduce el segundo operando');input(b);
9+
function operacion
10+
int (int num1_, int num2_)
11+
{
12+
let int number;
13+
number = 88 - num1_-num2_;
14+
return number;
15+
}
16+
number = operacion (a, b);
17+
print (number);
18+
---------------------------------------------------
19+
Prueba 2
20+
---------------------------------------------------
21+
let int a;
22+
let int b;
23+
let boolean bbb;
24+
a = 3;
25+
b=a ;
26+
input(z);
27+
print(z);
28+
x%=z;
29+
print (z-1);
30+
b=!b;a = a - b;
31+
print (a) ;
32+
print(b);
33+
---------------------------------------------------
34+
Prueba 3
35+
---------------------------------------------------
36+
let int n1;let int n2;
37+
let boolean l1;let boolean l2;
38+
let
39+
string
40+
cad
41+
;
42+
input (n1);
43+
l1 = l2;
44+
if (! l2) cad = 'hello';
45+
n2 = n1 - 378;
46+
47+
print( 33
48+
-
49+
n1
50+
-
51+
n2);
52+
53+
function ff boolean(boolean ss)
54+
{
55+
varglobal = 3333;
56+
if (l1) l2 = ff (ss);
57+
return ss;
58+
}
59+
60+
61+
62+
if (ff(!l1))
63+
print (varglobal);
64+
---------------------------------------------------
65+
Prueba 4
66+
---------------------------------------------------
67+
if for let
68+
int boolean string function
69+
return print input
70+
a b ds12 rec_a
71+
25 32 45 a a a a a a a a a a
72+
'cadena'
73+
=
74+
%=
75+
(){},;-!<
76+
---------------------------------------------------
77+
Prueba 5
78+
---------------------------------------------------
79+
let string texto;
80+
function alert (string msg)
81+
{
82+
print (msg);
83+
}
84+
function pideTexto ()
85+
{
86+
print ('Introduce un texto');
87+
input (texto);
88+
}
89+
pideTexto();
90+
alert
91+
(texto);
92+
---------------------------------------------------
93+
Prueba 6
94+
---------------------------------------------------
95+
let int a ;
96+
let int b ;
97+
let int number;
98+
print ( 'Introduce el primer operando' );
99+
input (a);
100+
print ('Introduce el segundo operando');input(b);
101+
function operacion int(int num2,int num1)
102+
{
103+
let int res;
104+
res=num1-num2;
105+
return ((res));
106+
}
107+
number = operacion (a, b);
108+
print (number);
109+
---------------------------------------------------
110+
111+
Prueba 1 AN SINTÁCTICO
112+
---------------------------------------------------
113+
let string texto;
114+
function pideTexto ()
115+
{
116+
print ('Introduce un texto');
117+
input (texto);
118+
}
119+
function alert (string msg)
120+
{
121+
print ('Texto introducido:');
122+
print (msg);
123+
}
124+
pideTexto();
125+
alert
126+
(texto);
127+
---------------------------------------------------
128+
129+
Prueba 2 AN SINTÁCTICO
130+
---------------------------------------------------
131+
let string texto;
132+
function pideTexto ()
133+
{
134+
print ('Introduce una palabra');
135+
input (texto);
136+
}
137+
function alert (string msg)
138+
{
139+
print (msg);
140+
}
141+
pideTexto();
142+
alert
143+
(texto);
144+
---------------------------------------------------
145+
146+
Prueba 3 AN SINTÁCTICO
147+
---------------------------------------------------
148+
let int a;
149+
let int b;
150+
let boolean bbb;
151+
a = 3;
152+
b=a ;
153+
let boolean c;
154+
c = a < b;
155+
if (c) b = 1;
156+
if (b < a) b %= 44;
157+
a = a - b;
158+
print (a) ;
159+
print(b);
160+
---------------------------------------------------
161+
Prueba 4 AN SINTÁCTICO
162+
---------------------------------------------------
163+
let int x;
164+
let boolean b;
165+
let int z;
166+
input (x);
167+
print (x);
168+
input (z);
169+
b=x<z;if (b)
170+
x =
171+
x - 6
172+
- z
173+
- 1
174+
- (2
175+
- y
176+
- 7);
177+
---------------------------------------------------
178+
Prueba 5 AN_SINTÁCTICO
179+
180+
let boolean booleano;
181+
function bisiesto boolean (int a)
182+
{ let string bis;
183+
print ('Es bisiesto?');
184+
input(bis);
185+
return (!(a - 4 < 0));
186+
}
187+
function dias int (int m, int a)
188+
{
189+
let int dd;
190+
print ('di cuantos dias tiene el mes ');
191+
print (m);
192+
input(dd);
193+
if (bisiesto(a)) dd = dd - 1;
194+
return dd;
195+
}
196+
197+
print (4-5-77);
198+
function esFechaCorrecta boolean (int d, int m, int a)
199+
{
200+
return (d < dias (m, a));
201+
}
202+
function demo ()
203+
{
204+
205+
if (esFechaCorrecta(25, 10, 2021)) print ('OK');
206+
207+
}
208+
let int aaa111;
209+
demo();

data/test/correcta1/TS.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
TABLA DE SIMBOLOS GLOBAL #1 :
2+
3+
* LEXEMA : 'a'
4+
Atributos :
5+
+ tipo: 'ent'
6+
+ despl: 0
7+
* LEXEMA : 'b'
8+
Atributos :
9+
+ tipo: 'ent'
10+
+ despl: 1
11+
* LEXEMA : 'bbb'
12+
Atributos :
13+
+ tipo: 'log'
14+
+ despl: 2
15+
* LEXEMA : 'c'
16+
Atributos :
17+
+ tipo: 'log'
18+
+ despl: 3
19+
-----------------------------------------

data/test/correcta1/input.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
let int a;
2+
let int b;
3+
let boolean bbb;
4+
a = 3;
5+
b=a ;
6+
let boolean c;
7+
c = a < b;
8+
if (c) bbb = !bbb;
9+
a = a - b;
10+
print (a) ;
11+
print(b);

data/test/correcta1/parse.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ascendente 35 11 6 35 11 6 37 11 6 48 43 41 14 8 46 43 41 14 8 37 11 6 46 43 41 46 43 40 14 8 46 43 41 46 44 43 41 14 7 46 43 46 42 41 14 8 46 43 41 15 8 46 43 41 15 8 3 1 1 1 1 1 1 1 1 1 1 1

data/test/correcta1/tokens.txt

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<3,>
2+
<4,>
3+
<11,0>
4+
<21,>
5+
<3,>
6+
<4,>
7+
<11,1>
8+
<21,>
9+
<3,>
10+
<5,>
11+
<11,2>
12+
<21,>
13+
<11,0>
14+
<14,>
15+
<12,3>
16+
<21,>
17+
<11,1>
18+
<14,>
19+
<11,0>
20+
<21,>
21+
<3,>
22+
<5,>
23+
<11,3>
24+
<21,>
25+
<11,3>
26+
<14,>
27+
<11,0>
28+
<24,>
29+
<11,1>
30+
<21,>
31+
<1,>
32+
<16,>
33+
<11,3>
34+
<17,>
35+
<11,2>
36+
<14,>
37+
<23,>
38+
<11,2>
39+
<21,>
40+
<11,0>
41+
<14,>
42+
<11,0>
43+
<22,>
44+
<11,1>
45+
<21,>
46+
<9,>
47+
<16,>
48+
<11,0>
49+
<17,>
50+
<21,>
51+
<9,>
52+
<16,>
53+
<11,1>
54+
<17,>
55+
<21,>

data/test/correcta2/TS.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
TABLA DE SIMBOLOS GLOBAL #1 :
2+
3+
* LEXEMA : 'texto'
4+
Atributos :
5+
+ tipo: 'cad'
6+
+ despl: 0
7+
* LEXEMA : 'b1'
8+
Atributos :
9+
+ tipo: 'log'
10+
+ despl: 64
11+
* LEXEMA : 'i'
12+
Atributos :
13+
+ tipo: 'ent'
14+
+ despl: 65
15+
* LEXEMA : 'pideTexto'
16+
Atributos :
17+
+ tipo: 'func'
18+
+ TipoRetorno: 'tipo_vacio'
19+
+ numParam: 0
20+
+ EtiqFuncion: 'EtiqFuncion1'
21+
-----------------------------------------
22+
TABLA pideTexto #2 :
23+
24+
-----------------------------------------

data/test/correcta2/input.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
let string texto; // declaracion de variables
2+
let boolean b1;
3+
for (i = 0; !b1; i %= 2){ // bucle for
4+
print(i);
5+
}
6+
function pideTexto () // funcion
7+
{
8+
print ('Introduce una palabra');
9+
input (texto);
10+
}
11+
12+
pideTexto();

data/test/correcta2/parse.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ascendente 36 11 6 37 11 6 48 43 41 20 46 44 43 41 48 43 41 19 46 43 41 15 8 26 25 9 28 22 5 23 49 43 41 15 8 16 8 26 25 25 24 21 32 12 8 3 1 2 1 1 1

0 commit comments

Comments
 (0)