Facilis - A Low Level Functional Language
h
CSharpIsGud (643)

Facilis is a strongly typed functional language that aims to be low level. Facilis uses a hand-written recursive descent parser made with love.

Factorial Example

impure foreign putchar(c of u8) -> void
impure foreign tostr(num of void*) -> string

impure write(str of string, start of i32) -> void {
	putchar(str[start])

	if start != str.length() {
		write(str, start + 1)
	}
}

pure fact(i of i32) -> i32 {
	if i == 1 {
		return i
	}

	return i * fact(i - 1)
}

impure main() -> i32 {
    write(tostr(fact(6)), 0)
}

Demo: https://repl.it/@Facilislang/FacilisDemo#README.md
^ Has a user/password login program loaded by default. Read the README!

Source: https://repl.it/@Facilislang/Facilis
^ 2072 lines of C++!

@CSharpIsGud @Subarashi @xxpertHacker

You are viewing a single comment. View All
AmazingMech2418 (950)

Are there supposed to be errors with the linker?

fuzzyastrocat (1270)

@CSharpIsGud @xxpertHacker I too get this error, undefined symbol main. From Sea I know that this means the main function hasn't been defined, so maybe the compiler is not generating an entry point?

CSharpIsGud (643)

@fuzzyastrocat It happens randomly, usually if you keep on trying the same thing it eventually works. We don't really know why yet.

fuzzyastrocat (1270)

@CSharpIsGud Weird! It's odd when things like that happen even though there's no randomness in the code.

CSharpIsGud (643)

@fuzzyastrocat We assume it has something to do with memory alloc/dealloc problems.

AmazingMech2418 (950)

@CSharpIsGud Memory allocation won't cause an issue with the linker...

CSharpIsGud (643)

@AmazingMech2418 the linker isn't the problem, the error happens because the compiler has a bug that makes it generate an empty file.
the linker errors when it cant find the main function.

AmazingMech2418 (950)

@CSharpIsGud Try changing it to a C++ repl instead of a Bash repl.

fuzzyastrocat (1270)

@CSharpIsGud Interesting, okay. Memory management can be pretty finicky sometimes, so that would probably explain it.

AmazingMech2418 (950)

@fuzzyastrocat It only happens in the demo repl or a fork of it. It works in the main repl.

AmazingMech2418 (950)

@fuzzyastrocat I think it might be that it is a Bash repl...

CSharpIsGud (643)

@AmazingMech2418 it happens on the main repl too.

AmazingMech2418 (950)

@CSharpIsGud Not for me. Maybe it's the program being compiled?

xxpertHacker (494)

@AmazingMech2418 It seems to be non-deterministic, I'd estimate it occurs about 50% of the time, for now just keep compiling until it works.
I had theorized that it occurs due to early deallocation, but we don't have any hard proof, or we would've fixed it.
And yes, it's on all of the Repls, Bash Repls are just easier to work with.

xxpertHacker (494)

@fuzzyastrocat Yeah, it definitely could be memory, considering how much we allocated memory, because we started off by using plenty of std::strings instead of something like static std::string_views, meaning a good amount of memory is allocated, which may be problematic for large programs.
But if we ever wanted to work on this, we would have to do a full rewrite.

(Also, there is a whole memory leak we didn't do anything about...)

fuzzyastrocat (1270)

@xxpertHacker Oh no, memory leaks are the worst... I envy low-level programmers who are able to avoid them lol

xxpertHacker (494)

@fuzzyastrocat It's literally as easy as saying delete x; in C++, lol. But apparently we didn't clear any of the memory we allocated... so, yeah, there's that. :)

fuzzyastrocat (1270)

@xxpertHacker Oh I meant for C, I'm not a big fan of malloc and free
But yeah always good to clear that memory :D