Code Monkey home page Code Monkey logo

minilang's Introduction

Wrapl, The Programming Language

For building and installation instructions, see dev/README.md.

Documentation

Current documentation is available at http://wrapl.github.io.

minilang's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

johnathonnow

minilang's Issues

Add support for clang -- error: ld: error: undefined symbol: clog10

Clang doesn't have clog10. I think it's specific to gcc.

442 / 476 #0 Updated file:/usr/include/sys/filio.h to iteration 1
443 / 477 #0 Updated file:/usr/include/sys/sockio.h to iteration 1
444 / 478 #0 Updated file:/usr/include/poll.h to iteration 1
445 / 478 #0 Updated scan:file:obj/linenoise.c::INCLUDES to iteration 1
446 / 478 #0 Updated file:obj/linenoise.o to iteration 1
447 / 478 #0 Updated file:lib/libminilang.a to iteration 1
448 / 479 #0 Updated symb:/obj/LDFLAGS to iteration 1
ld: error: undefined symbol: clog10
>>> referenced by ml_math.c:327 (/memfs/git/minilang/src/ml_math.c:327)
>>>               ml_math.o:(ml_method_fn_327_30) in archive /memfs/git/minilang/lib/libminilang.a
>>> referenced by ml_math.c:327 (/memfs/git/minilang/src/ml_math.c:327)
>>>               ml_math.o:(ml_method_fn_327_31) in archive /memfs/git/minilang/lib/libminilang.a
>>> did you mean: log10
>>> defined in: /usr/lib/libm.so
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Error: file:bin/minilang: process returned non-zero exit code
        cc -o /memfs/git/minilang/bin/minilang /memfs/git/minilang/obj/minilang.o /memfs/git/minilang/lib/libminilang.a -lm -g -lyajl -lexpat -ldl -luuid -licuuc -L/usr/local/lib -lgc-threaded:1

FreeBSD clang version 13.0.0 ([email protected]:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)
Target: x86_64-unknown-freebsd13.1
Thread model: posix
InstalledDir: /usr/bin

FreeBSD 13.1-RELEASE

Empty expr complex string embed causes a segfault

If you have an expression that only consists of whitespace or the empty string embedded into a string literal, minilang will segfault.
For example, this very minimal script will lead to a crash:

'{}'

The stack trace is here:
Screen Shot 2021-10-04 at 8 52 28 AM

Within the frame, the local variable Child is null, leading to the segfault.

minilang/src/ml_compiler.c

Lines 2172 to 2198 in 3ca518e

static void ml_string_expr_compile(mlc_function_t *Function, mlc_string_expr_t *Expr, int Flags) {
MLC_EMIT(Expr->StartLine, MLI_STRING_NEW, 0);
mlc_inc_top(Function);
for (mlc_string_part_t *Part = Expr->Parts; Part; Part = Part->Next) {
if (Part->Length) {
ml_inst_t *AddInst = MLC_EMIT(Part->Line, MLI_STRING_ADDS, 2);
AddInst[1].Count = Part->Length;
AddInst[2].Chars = Part->Chars;
} else {
MLC_FRAME(ml_string_expr_frame_t, ml_string_expr_compile2);
Frame->Expr = Expr;
Frame->Part = Part;
mlc_expr_t *Child = Part->Child;
Frame->Child = Child->Next;
Frame->NumArgs = 1;
Frame->Flags = Flags;
return mlc_compile(Function, Child, MLCF_PUSH);
}
}
MLC_EMIT(Expr->EndLine, MLI_STRING_END, 0);
if (Flags & MLCF_PUSH) {
MLC_EMIT(Expr->EndLine, MLI_PUSH, 0);
} else {
--Function->Top;
}
MLC_RETURN(NULL);
}

Future, roadmap, goals, ideas...

Is there any roadmap or todo list or brainstormed ideas etc. for this project?

I'd like to know more as I discovered it today and wonder what are the trade-offs and what's the maximum expected performance etc.

undefined symbol: parse_printf_format

Build fails on FreeBSD 12.2:

cc obj/cache.o obj/context.o obj/rabs.o obj/target.o obj/target_expr.o obj/target_file.o obj/target_meta.o obj/target_scan.o obj/target_symb.o obj/targetcache.o obj/targetqueue.o obj/targetset.o obj/util.o obj/vfs.o obj/library.o obj/whereami.o minilang/lib/libminilang.a radb/libradb.a -o bin/rabs  -fstack-protector-strong -L/usr/local/lib  minilang/lib/libminilang.a radb/libradb.a -lm -pthread -L/usr/local/lib -lgc-threaded
ld: error: undefined symbol: parse_printf_format
>>> referenced by ml_string.c:162 (src/ml_string.c:162)

Rev. 93e02da

Hashing a closure within a tuple that references itself leads to a segfault

AFL found a weird sequence that I minimized below:

let Y := (;)Y
#Y

After poking around for a bit I realized that the issue is it is calling ml_tuple_hash, ml_closure_hash, and ml_hash_chain recursively forever. This happens even with more readable closures-in-tuples:

let X := (fun() X, 1)
#X

will also cause a crash.

I'm not familiar enough with the codebase to fully understand the purpose of the hash chains, and so I don't know the implications of this, but it seems that changing this line:

for (int I = 0; I < Tuple->Size; ++I) Hash = ((Hash << 3) + Hash) + ml_hash(Tuple->Values[I]);

to pass along the chain stops the crash. (I.e. call ml_hash_chain instead of ml_hash).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.