Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Arreglos json 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
SuperQuery
Examen
Tarea 4NM70 HCHCHP.2
ARREGLOS-AGUIRREMONTOYALIZET-SEC3NM70
Fii
Tarea If
Economia con 2 objetos empresa
estructuras de datos con bases de conocimiento
2 - codificador JSON Funcion IF - ELSE Anidado
dayanna