Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
2 - codificador JSON Funcion IF anidados
objeto :- write('{'),aux1, write('}'). atributo :-cadena, write(':'),valor,aux2. aux1 :- read(X),(X='atributo'->atributo; X='fin'->write('')). aux2 :- read(X),(X='atributo'->write(','),atributo; X='fin'->write('')). aux3 :- read(X),(X='valor'->valor,aux4; X='fin'->write('')). aux4 :- read(X),(X='valor'->write(','),valor,aux4; X='fin'->write('')). aux5 :- read(X), (X='return' -> return; X='fin'->write('')). cadena :- read(X),write('"'),write(X),write('"'). numero :- read(X),write(X). arreglo :- write('['), aux3, write(']'). metodo :- write('"function () {'),instruccion, aux5, write(' }"'). instruccion :- read(X),(X='asignacion'->asignacion,instruccion; X='decision'-> decision , instruccion; X='fin'->write('')). asignacion :- read(X) , write(X), write('=') , read(Y) , write(Y) ,write(';'). decision :- write('if (') , read(X) , write(X) , write(') {') , instruccion , write('}'). return :- read(X), write('return '), write(X). valor :-read(T),(T='cadena'->cadena; T='numero'->numero; T='arreglo'->arreglo; T='metodo'->metodo; T='objeto'->objeto). :- objeto.
run
|
edit
|
history
|
help
0
Luna Ramírez Diana, Ejercicio 3, Primer examen parcial
Avance2_TAREA_15_MARZO
Kvl
Méndez Huerta Janet- Arreglos y Objetos
Salgado Sanchez Ivan_Examen2
González Martínez Luis Alberto - BC_Arbol
PROLOG evaluacion
EJEMPLO_CLASE_25/03
Tarea Arreglos JSON
TAREA ARREGLO