Skip to content

Commit d63aac2

Browse files
committed
[ADD] añadido codigo analizador lexico
1 parent fdd6d91 commit d63aac2

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

compilador/src/resources/prueba.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import java.util.Scanner;
2+
3+
public class prueba {
4+
private int numero = 5;
5+
public static void main(String[] args) {
6+
Scanner scan = new Scanner(System.in);
7+
int num = scan.nextInt();
8+
System.out.println(num);
9+
System.out.println("Hola mundo!");
10+
}
11+
}

compilador/src/resources/prueba2.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import java.util.Scanner;
2+
3+
public class prueba {
4+
private int numero = 5;
5+
public static void main(String[] args) {
6+
Scanner scan = new Scanner(System.in);
7+
int num = scan.nextInt();
8+
System.out.println(num);
9+
System.out.println("Hola mundo!");
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def leer_fichero(path:str)->str:
2+
try:
3+
with open(path, 'r') as file:
4+
contenido = file.read()
5+
return contenido
6+
except FileNotFoundError:
7+
print("El archivo no existe.")
8+
except PermissionError:
9+
print("No tienes permiso para leer el archivo.")
10+
except Exception as e:
11+
print("Ocurrió un error:", e)

0 commit comments

Comments
 (0)