mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Merge branch 'post-historic' of https://github.com/dboulytchev/compiler-workout-private into post-historic
This commit is contained in:
commit
686e3ff9d7
5 changed files with 18 additions and 5 deletions
2
regression/orig/test055.log
Normal file
2
regression/orig/test055.log
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
0
|
||||||
|
3
|
||||||
8
regression/test055.expr
Normal file
8
regression/test055.expr
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
fun len(l) {
|
||||||
|
case l of
|
||||||
|
_ : xs -> return len(xs) + 1
|
||||||
|
|{} -> return 0
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
write(len({}));
|
||||||
|
write(len({1, 2, 3}))
|
||||||
0
regression/test055.input
Normal file
0
regression/test055.input
Normal file
|
|
@ -66,7 +66,7 @@ char* de_hash (int n) {
|
||||||
static char *chars = (char*) BOX (NULL);
|
static char *chars = (char*) BOX (NULL);
|
||||||
static char buf[6] = {0,0,0,0,0,0};
|
static char buf[6] = {0,0,0,0,0,0};
|
||||||
char *p = (char *) BOX (NULL);
|
char *p = (char *) BOX (NULL);
|
||||||
chars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNJPQRSTUVWXYZ";
|
chars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
p = &buf[5];
|
p = &buf[5];
|
||||||
|
|
||||||
#ifdef DEBUG_PRINT
|
#ifdef DEBUG_PRINT
|
||||||
|
|
@ -316,13 +316,16 @@ extern void* Bsexp (int n, ...) {
|
||||||
|
|
||||||
extern int Btag (void *d, int t, int n) {
|
extern int Btag (void *d, int t, int n) {
|
||||||
data *r = (data *) BOX (NULL);
|
data *r = (data *) BOX (NULL);
|
||||||
r = TO_DATA(d);
|
if (UNBOXED(d)) return BOX(0);
|
||||||
|
else {
|
||||||
|
r = TO_DATA(d);
|
||||||
#ifndef DEBUG_PRINT
|
#ifndef DEBUG_PRINT
|
||||||
return BOX(TAG(r->tag) == SEXP_TAG && TO_SEXP(d)->tag == t && LEN(r->tag) == n);
|
return BOX(TAG(r->tag) == SEXP_TAG && TO_SEXP(d)->tag == t && LEN(r->tag) == n);
|
||||||
#else
|
#else
|
||||||
return BOX(TAG(r->tag) == SEXP_TAG &&
|
return BOX(TAG(r->tag) == SEXP_TAG &&
|
||||||
GET_SEXP_TAG(TO_SEXP(d)->tag) == t && LEN(r->tag) == n);
|
GET_SEXP_TAG(TO_SEXP(d)->tag) == t && LEN(r->tag) == n);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int Barray_patt (void *d, int n) {
|
extern int Barray_patt (void *d, int n) {
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,7 @@ module M = Map.Make (String)
|
||||||
|
|
||||||
(* Environment implementation *)
|
(* Environment implementation *)
|
||||||
class env =
|
class env =
|
||||||
let chars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNJPQRSTUVWXYZ" in
|
let chars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" in
|
||||||
let make_assoc l i = List.combine l (List.init (List.length l) (fun x -> x + i)) in
|
let make_assoc l i = List.combine l (List.init (List.length l) (fun x -> x + i)) in
|
||||||
let rec assoc x = function [] -> raise Not_found | l :: ls -> try List.assoc x l with Not_found -> assoc x ls in
|
let rec assoc x = function [] -> raise Not_found | l :: ls -> try List.assoc x l with Not_found -> assoc x ls in
|
||||||
object (self)
|
object (self)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue