Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
isan Leonardo Calvillo Tapia
%commands to the interpreter are submitted from stdin input ('show input' box below) %'halt.' will be automatically appended to stdin input. %swi-prolog 7.6.4 objeto :- write('{'),read(X),(X='atributo'->atributo;write('')),write('}'). atributo :-cadena,write(':'),valor,otro. valor :- read(X),(X='cadena'->cadena;X='numero'->numero;X='objeto'->objeto;X='vacio'->write('""');X='vacioa'->write('');X='arreglo'->array;X='boolean'->numero;X='null'->write('null');X='objeto'->objeto;X='metodo'->metodo). array :- write('['),valor,arrayitem,write(']'). arrayitem :- read(X),(X='otro'->item;write('')). item :- write(','),valor,arrayitem. numero :- read(X),write(X). cadena :- read(X),write('"'),write(X),write('"'). otro :- read(X),(X='otro'->write(','),atributo,otro;write('')). metodo :- write('"function(){'),instruccion,write('}"'). instruccion :- read(X),(X='asignacion'->asignacion,instruccion;X='decision'->decision,instruccion;X='finsub'->write('');X='falso'->falso,instruccion;X='false'->falsocon,instruccion;X='finm'->write(' return '),read(Y),write(Y),write(';')). decision :- write('if ('),numero,write(')'),verdadero. verdadero :- write('{'),instruccion,write('}'). falso :- write('else{'),instruccion,write('}'). falsocon :- write('else if('),numero,write(')'),verdadero. asignacion :- numero,write('='),numero,write('; '). :- objeto.
run
|
edit
|
history
|
help
0
Fii
2 - codificador JSON If anidados y else
Paredes Lopez Hector G - 3NM70 - Tarea 1
ARREGLOS
clasificador json 14 feb
Generador cod. json.
A1
isan Leonardo Calvillo Tapia
PRODUCTIVAS
Chem