Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Esclavo JSON

%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('{'),cadena,write(':'),valor,extra.
valor :- read(X),(X='cadena'->cadena;X='numero'->numero;X='objeto'->objeto, X='vacio').
numero :- read(X), write(X).
cadena :- read(X),write('"'),write(X),write('"').
extra :- read(X), (X='extra' -> ingresar; X='fin'->fin).
ingresar :- write(','),cadena,write(':'),valor,extra.
fin :- write('}').
vacio :- write('').

:- objeto.
 run  | edit  | history  | help 0