-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
16 changed files
with
3,053 additions
and
3,130 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
a = 5; | ||
b = a - 3; | ||
print (a+2); | ||
a = 34; | ||
c = 7+3; | ||
a = 5; | ||
b = a - 3; | ||
print (a+2); | ||
a = 34; | ||
c = 7+3; | ||
print (a+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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,130 +1,130 @@ | ||
#ifndef LISTA_H_INCLUDED | ||
#define LISTA_H_INCLUDED | ||
|
||
class ActualID | ||
{ | ||
public: | ||
ActualID *siguiente = NULL; | ||
string simbolo; | ||
char tipo; | ||
|
||
ActualID(string sim, char t) | ||
{ | ||
simbolo = sim; | ||
tipo = t; | ||
} | ||
|
||
void setTipo(char t) | ||
{ | ||
tipo = t; | ||
} | ||
|
||
char getTipo() | ||
{ | ||
return tipo; | ||
} | ||
|
||
string getID() | ||
{ | ||
return simbolo; | ||
} | ||
}; | ||
typedef ActualID *pActualID; | ||
|
||
|
||
class Lista | ||
{ | ||
private: | ||
pActualID root; | ||
pActualID fin; | ||
public: | ||
|
||
Lista() | ||
{ | ||
root = NULL; | ||
fin = NULL; | ||
} | ||
|
||
bool vacio() | ||
{ | ||
return (root == NULL); | ||
} | ||
|
||
void insertaNodo(string nuevo, char t) | ||
{ | ||
if(vacio()) | ||
{ | ||
root = new ActualID(nuevo,t); | ||
fin = root; | ||
} | ||
else | ||
{ | ||
if(!buscaID(nuevo)) | ||
{ | ||
fin->siguiente = new ActualID(nuevo, t); | ||
fin = fin->siguiente; | ||
} | ||
else | ||
{ | ||
updateType(nuevo, t); | ||
} | ||
} | ||
} | ||
|
||
bool buscaID(string busca) | ||
{ | ||
pActualID temp = root; | ||
while(temp != NULL) | ||
{ | ||
if(temp->getID() == busca) | ||
{ | ||
return true; | ||
} | ||
temp = temp->siguiente; | ||
} | ||
return false; | ||
} | ||
|
||
char tipoID(string busca) | ||
{ | ||
pActualID temp = root; | ||
while(temp != NULL) | ||
{ | ||
if(temp->getID() == busca) | ||
{ | ||
return temp->getTipo(); | ||
} | ||
temp = temp->siguiente; | ||
} | ||
return 'e'; | ||
} | ||
|
||
void updateType(string busca, char t) | ||
{ | ||
pActualID temp = root; | ||
while(temp != NULL) | ||
{ | ||
if(temp->getID() == busca) | ||
{ | ||
temp->setTipo(t); | ||
break; | ||
} | ||
temp = temp->siguiente; | ||
} | ||
} | ||
|
||
void imprime() | ||
{ | ||
pActualID temp = root; | ||
while(temp != NULL) | ||
{ | ||
cout << temp->getID() << "\t" << temp->getTipo() << endl; | ||
temp = temp->siguiente; | ||
} | ||
} | ||
|
||
|
||
}; | ||
|
||
#endif // LISTA_H_INCLUDED | ||
|
||
#ifndef LISTA_H_INCLUDED | ||
#define LISTA_H_INCLUDED | ||
|
||
class ActualID | ||
{ | ||
public: | ||
ActualID *siguiente = NULL; | ||
string simbolo; | ||
char tipo; | ||
|
||
ActualID(string sim, char t) | ||
{ | ||
simbolo = sim; | ||
tipo = t; | ||
} | ||
|
||
void setTipo(char t) | ||
{ | ||
tipo = t; | ||
} | ||
|
||
char getTipo() | ||
{ | ||
return tipo; | ||
} | ||
|
||
string getID() | ||
{ | ||
return simbolo; | ||
} | ||
}; | ||
typedef ActualID *pActualID; | ||
|
||
|
||
class Lista | ||
{ | ||
private: | ||
pActualID root; | ||
pActualID fin; | ||
public: | ||
|
||
Lista() | ||
{ | ||
root = NULL; | ||
fin = NULL; | ||
} | ||
|
||
bool vacio() | ||
{ | ||
return (root == NULL); | ||
} | ||
|
||
void insertaNodo(string nuevo, char t) | ||
{ | ||
if(vacio()) | ||
{ | ||
root = new ActualID(nuevo,t); | ||
fin = root; | ||
} | ||
else | ||
{ | ||
if(!buscaID(nuevo)) | ||
{ | ||
fin->siguiente = new ActualID(nuevo, t); | ||
fin = fin->siguiente; | ||
} | ||
else | ||
{ | ||
updateType(nuevo, t); | ||
} | ||
} | ||
} | ||
|
||
bool buscaID(string busca) | ||
{ | ||
pActualID temp = root; | ||
while(temp != NULL) | ||
{ | ||
if(temp->getID() == busca) | ||
{ | ||
return true; | ||
} | ||
temp = temp->siguiente; | ||
} | ||
return false; | ||
} | ||
|
||
char tipoID(string busca) | ||
{ | ||
pActualID temp = root; | ||
while(temp != NULL) | ||
{ | ||
if(temp->getID() == busca) | ||
{ | ||
return temp->getTipo(); | ||
} | ||
temp = temp->siguiente; | ||
} | ||
return 'e'; | ||
} | ||
|
||
void updateType(string busca, char t) | ||
{ | ||
pActualID temp = root; | ||
while(temp != NULL) | ||
{ | ||
if(temp->getID() == busca) | ||
{ | ||
temp->setTipo(t); | ||
break; | ||
} | ||
temp = temp->siguiente; | ||
} | ||
} | ||
|
||
void imprime() | ||
{ | ||
pActualID temp = root; | ||
while(temp != NULL) | ||
{ | ||
cout << temp->getID() << "\t" << temp->getTipo() << endl; | ||
temp = temp->siguiente; | ||
} | ||
} | ||
|
||
|
||
}; | ||
|
||
#endif // LISTA_H_INCLUDED | ||
|
Oops, something went wrong.