Compare commits

..

No commits in common. 'c706f527ac3c01a4f98b8cea45ec7a9d70292b3c' and 'ade58c34d86d227577ba1b2cf187e686f2810c88' have entirely different histories.

  1. 12
      src/rustint/core.clj
  2. 57
      test/rustint/core_test.clj

@ -1937,7 +1937,7 @@
; user=> (agregar-ptocoma (list 'fn 'main (symbol "(") (symbol ")") (symbol "{") 'if 'x '< '0 (symbol "{") 'x '= '- 'x (symbol ";") (symbol "}") 'renglon '= 'x (symbol ";") 'if 'z '< '0 (symbol "{") 'z '= '- 'z (symbol ";") (symbol "}") (symbol "}") 'fn 'foo (symbol "(") (symbol ")") (symbol "{") 'if 'y '> '0 (symbol "{") 'y '= '- 'y (symbol ";") (symbol "}") 'else (symbol "{") 'x '= '- 'y (symbol ";") (symbol "}") (symbol "}")))
; (fn main ( ) { if x < 0 { x = - x ; } ; renglon = x ; if z < 0 { z = - z ; } } fn foo ( ) { if y > 0 { y = - y ; } else { x = - y ; } })
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; TODO
;TODO
;(defn agregar-ptocoma
;
;)
@ -2097,12 +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] []]
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn cargar-const-en-tabla [amb]
(cond
(not= (get amb 4) :sin-errores) amb
:else nil
)
)
; TODO
; (defn cargar-const-en-tabla
;
;)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; INICIALIZAR-CONTEXTO-LOCAL: Recibe un ambiente y, si su estado no es :sin-errores, lo devuelve intacto.

@ -608,60 +608,3 @@
)
)
)
(deftest test-cargar-const-en-tabla-01
(testing "Test 01 cargar-const-en-tabla"
(is (=
(cargar-const-en-tabla [
(symbol ";") ; simb-actual
(list 'fn 'main (symbol "(") (symbol ")") (symbol "{") 'println! (symbol "(") "{}" (symbol ",") 'TRES (symbol ")") (symbol "}")) ; simb-no-parseados-aun
['use 'std (symbol "::") 'io (symbol ";") 'const 'TRES (symbol ":") 'i64 (symbol "=") 3] ; simb-ya-parseados
8 ; estado
[[0] [['io ['lib '()] 0]]] ; contexto
0 ; prox-var
[['CAL 0] 'HLT] ; bytecode
[] ; mapa-regs-de-act
])
[
(symbol ";")
(list 'fn 'main (symbol "(") (symbol ")") (symbol "{") 'println! (symbol "(") "{}" (symbol ",") 'TRES (symbol ")") (symbol "}"))
['use 'std (symbol "::") 'io (symbol ";") 'const 'TRES (symbol ":") 'i64 (symbol "=") 3]
8
[[0] [['io ['lib '()] 0]]]
0
[['CAL 0] 'HLT]
[]
]
)
)
)
)
(deftest test-cargar-const-en-tabla-02
(testing "Test 02 cargar-const-en-tabla"
(is (=
(cargar-const-en-tabla [
(symbol ";")
(list 'fn 'main (symbol "(") (symbol ")") (symbol "{") 'println! (symbol "(") "{}" (symbol ",") 'TRES (symbol ")") (symbol "}"))
['use 'std (symbol "::") 'io (symbol ";") 'const 'TRES (symbol ":") 'i64 (symbol "=") 3]
:sin-errores
[[0] [['io ['lib '()] 0]]]
0
[['CAL 0] 'HLT]
[]
]
)
[
(symbol ";")
(list 'fn 'main (symbol "(") (symbol ")") (symbol "{") 'println! (symbol "(") "{}" (symbol ",") 'TRES (symbol ")") (symbol "}"))
['use 'std (symbol "::") 'io (symbol ";") 'const 'TRES (symbol ":") 'i64 (symbol "=") 3]
:sin-errores
[[0] [['io ['lib '()] 0] ['TRES ['const 'i64] 3]]]
0
[['CAL 0] 'HLT]
[]
]
)
)
)
)

Loading…
Cancel
Save