|
|
|
@ -2097,33 +2097,10 @@ |
|
|
|
; [; (fn main ( ) { println! ( "{}" , TRES ) }) [use std :: io ; const TRES : i64 = 3] :sin-errores [[0] [[io [lib ()] 0] [TRES [const i64] 3]]] 0 [[CAL 0] HLT] []] |
|
|
|
; [; (fn main ( ) { println! ( "{}" , TRES ) }) [use std :: io ; const TRES : i64 = 3] :sin-errores [[0] [[io [lib ()] 0] [TRES [const i64] 3]]] 0 [[CAL 0] HLT] []] |
|
|
|
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
|
|
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
|
|
|
|
|
|
|
|
(defn maxnil [a1 a2] |
|
|
|
|
|
|
|
(cond |
|
|
|
|
|
|
|
(and (nil? a1) (nil? a2)) nil |
|
|
|
|
|
|
|
(nil? a1) a2 |
|
|
|
|
|
|
|
(nil? a2) a1 |
|
|
|
|
|
|
|
:else (max a1 a2) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn last_const_idx [seq] |
|
|
|
|
|
|
|
(reduce maxnil (map-indexed (fn [idx itm] (if itm idx nil)) (map #(= 'const %1) seq))) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn cargar-const-en-tabla [amb] |
|
|
|
(defn cargar-const-en-tabla [amb] |
|
|
|
(cond |
|
|
|
(cond |
|
|
|
(not= (get amb 3) :sin-errores) amb |
|
|
|
(not= (get amb 4) :sin-errores) amb |
|
|
|
:else (let [ |
|
|
|
:else nil |
|
|
|
syp (get amb 2), |
|
|
|
|
|
|
|
ctx (get amb 4), |
|
|
|
|
|
|
|
idx_const (last_const_idx syp), |
|
|
|
|
|
|
|
const_name (get syp (+ 1 idx_const)), |
|
|
|
|
|
|
|
const_type (get syp (+ 3 idx_const)), |
|
|
|
|
|
|
|
const_value (get syp (+ 5 idx_const)), |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
(assoc-in amb [4 1 (count (get ctx 1))] [const_name ['const const_type] const_value]) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
@ -2139,17 +2116,10 @@ |
|
|
|
; [{ (let x : i64 = 10 ; println! ( "{}" , x ) }) [fn main ( )] :sin-errores [[0 1] [[main [fn [() ()]] 2]]] 0 [[CAL 2] HLT] []] |
|
|
|
; [{ (let x : i64 = 10 ; println! ( "{}" , x ) }) [fn main ( )] :sin-errores [[0 1] [[main [fn [() ()]] 2]]] 0 [[CAL 2] HLT] []] |
|
|
|
; ^^^^^^^^^^^^ ^ ^^^^^^^^^^^^^^^^^^^^^^^ |
|
|
|
; ^^^^^^^^^^^^ ^ ^^^^^^^^^^^^^^^^^^^^^^^ |
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
(defn inicializar-contexto-local [amb] |
|
|
|
; TODO |
|
|
|
(cond |
|
|
|
; (defn inicializar-contexto-local |
|
|
|
(not= (get amb 3) :sin-errores) amb |
|
|
|
; |
|
|
|
:else (let [ |
|
|
|
;) |
|
|
|
ctx (get amb 4), |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
(assoc-in amb [4 0 (count (get ctx 0))] (count (get ctx 1))) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
; RESTAURAR-CONTEXTO-ANTERIOR: Recibe un ambiente y, si su estado no es :sin-errores, lo devuelve intacto. |
|
|
|
; RESTAURAR-CONTEXTO-ANTERIOR: Recibe un ambiente y, si su estado no es :sin-errores, lo devuelve intacto. |
|
|
|
|