Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
teaching:cc4101:tareas:2016-2:tarea3 [2017/11/07 14:55] – folmedoteaching:cc4101:tareas:2016-2:tarea3 [2017/11/07 14:56] (current) – old revision restored (2016/11/30 16:16) folmedo
Line 16: Line 16:
 <code scheme> <code scheme>
 <s-expr> ::= <num> <s-expr> ::= <num>
-         | (+ <s-expr> <s-expr>) +         | {+ <s-expr> <s-expr>} 
-         | (- <s-expr> <s-expr>) +         | {- <s-expr> <s-expr>} 
-         | (if0 <s-expr> <s-expr> <s-expr>)+         | {if0 <s-expr> <s-expr> <s-expr>}
  
 </code> </code>
Line 36: Line 36:
 <code scheme> <code scheme>
 <s-expr> ::= ... <s-expr> ::= ...
-         | (with (<id> <s-expr>) <s-expr>)+         | {with {<id> <s-expr>} <s-expr>}
          | <id>          | <id>
-         | (fun (<id>) <s-expr>) +         | {fun {<id>} <s-expr>} 
-         | (<s-expr> <s-expr>)+         | {<s-expr> <s-expr>}
  
 </code> </code>
Line 53: Line 53:
 <code scheme> <code scheme>
 <s-expr> ::= ... <s-expr> ::= ...
-         | (seqn <s-expr> <s-expr>) +         | {seqn <s-expr> <s-expr>} 
-         | (set <id> <s-expr>)+         | {set <id> <s-expr>}
 </code> </code>
  
Line 72: Line 72:
  
 <code Java> <code Java>
-java tarea3 "(+ 4 3)"+java tarea3 "{+ 4 3}"
 >"7" >"7"
 </code> </code>
  
 <code Java> <code Java>
-java tarea3 "(fun (x) x)"+java tarea3 "{fun {x} x}"
 >"Function" >"Function"
 </code> </code>
Line 83: Line 83:
 Ejemplos con C: Ejemplos con C:
 <code C> <code C>
-./Tarea3 "(((fun (x) x) +./Tarea3 "{{{fun {x} x} 
-        (fun (x) (+ x 5))) +        {fun {x} {+ x 5}}} 
-       3)"+       3}"
 >"8" >"8"
 </code> </code>
  
 <code C> <code C>
-./Tarea3 "(8 10)" +./Tarea3 "{8 10}" 
->"error: expresión inválida (8 10)"+>"error: expresión inválida {8 10}"
 </code> </code>
  
 <code C> <code C>
-./Tarea3 "(with (x 3) +./Tarea3 "{with {x 3} 
-             (with (f (fun (y) (+ x y))) +             {with {f {fun {y} {+ x y}}} 
-                   (with (x 5) +                   {with {x 5} 
-                         (f 4))))"+                         {f 4}}}}"
 >"7" >"7"
 </code> </code>
 +
 +
 +
 +
 +
 +
 +