diff --git a/lama-spec.pdf b/lama-spec.pdf index 3460207f7..9997b90fd 100644 Binary files a/lama-spec.pdf and b/lama-spec.pdf differ diff --git a/runtime/runtime.c b/runtime/runtime.c index 6b2984f6a..852b76751 100644 --- a/runtime/runtime.c +++ b/runtime/runtime.c @@ -555,13 +555,15 @@ extern void* Lsubstring (void *subj, int p, int l) { } extern struct re_pattern_buffer *Lregexp (char *regexp) { - struct re_pattern_buffer *b = - (struct re_pattern_buffer*) malloc (sizeof (struct re_pattern_buffer)); - + regex_t *b = (regex_t*) malloc (sizeof (regex_t)); + b->translate = 0; - b->fastmap = 0; - b->buffer = 0; - b->allocated = 0; + b->fastmap = 0; + // A weird workaround: should be 0/0 in theory, + // but is does not work sometimes. The exact number is + // determined experimentally :(( + b->buffer = malloc (256); + b->allocated = 256; int n = (int) re_compile_pattern (regexp, strlen (regexp), b); @@ -1426,7 +1428,7 @@ extern void __gc_root_scan_stack (); /* ======================================== */ //static size_t SPACE_SIZE = 16; -static size_t SPACE_SIZE = 16 * 1024 * 1024; +static size_t SPACE_SIZE = 32 * 1024 * 1024; // static size_t SPACE_SIZE = 128; // static size_t SPACE_SIZE = 1024 * 1024; @@ -1728,7 +1730,7 @@ static inline void init_extra_roots (void) { extern void init_pool (void) { size_t space_size = SPACE_SIZE * sizeof(size_t); from_space.begin = mmap (NULL, space_size, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0); to_space.begin = NULL; if (to_space.begin == MAP_FAILED) { perror ("EROOR: init_pool: mmap failed\n"); @@ -1922,6 +1924,7 @@ extern void * alloc (size_t size) { #endif return p; } + init_to_space (0); #ifdef DEBUG_PRINT print_indent (); diff --git a/spec/03.01.lexical_structure.tex b/spec/03.01.lexical_structure.tex index f543593b6..19d8276ce 100644 --- a/spec/03.01.lexical_structure.tex +++ b/spec/03.01.lexical_structure.tex @@ -104,10 +104,10 @@ The following symbols are treated as delimiters: \begin{lstlisting} . , ( ) { } - ; # -> + ; # -> | \end{lstlisting} -Despite custom infix operators can coincide with delimiters "\lstinline|#|" and "\lstinline|->|" they can -never clash as neither of these delimiters can be encountered in expressions in infix operator position. +Note, custom infix operators can coincide with delimiters "\lstinline|#|", "\lstinline!|!", and "\lstinline|->|", which can +sometimes be misleading. diff --git a/src/version.ml b/src/version.ml index f4905bf19..893e6e89d 100644 --- a/src/version.ml +++ b/src/version.ml @@ -1 +1 @@ -let version = "Version 1.00, 5db12d76, Fri Mar 13 19:41:14 2020 +0300" +let version = "Version 1.00, c084e57b2, Sun Mar 15 12:41:31 2020 +0300" diff --git a/stdlib/Matcher.lama b/stdlib/Matcher.lama index 65864fb3f..5086e398b 100644 --- a/stdlib/Matcher.lama +++ b/stdlib/Matcher.lama @@ -8,7 +8,9 @@ -- (e.g. "identifier", "string constant", etc.), used for error -- reporting public fun createRegexp (r, name) { - [regexp (r), name] + local l = [regexp (r), name]; + --printf ("Created regexp %s: %x, %x\n", name, l, l[0]); + l } -- Create an immutable matcher.