This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module app; | |
pure @nogc unittest | |
{ | |
/// API | |
extern(C++) | |
interface IAllocatorNogc | |
{ | |
extern(D): | |
void* alloc(size_t) pure @nogc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module setmem; | |
version(unittest) | |
{ | |
import std.range : repeat; | |
import std.algorithm : equal; | |
} | |
version (LDC) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module app; | |
import llvm; | |
int main() | |
{ | |
// module preparation | |
LLVMModuleRef mod = LLVMModuleCreateWithName("main".ptr); | |
// build a main function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug, Clone)] | |
enum Token { | |
PRODUCT, | |
SUM, | |
NUMBER(i64), | |
} | |
#[derive(Debug, Clone)] | |
struct Node { | |
pub children: Vec<Node>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module result; | |
import std.algorithm : cumulativeFold, each, map, sum; | |
import std.conv : to; | |
import std.exception : assumeWontThrow; | |
import std.range : chain, enumerate, iota, only, take, walkLength, zip; | |
import std.traits : isInstanceOf, ReturnType, Unqual; | |
import core.memory : pureMalloc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
#define WINDOW_SIZE 500 | |
#define SHIFT_X (0.075 * WINDOW_SIZE) | |
#define SHIFT_Y (0.25 * WINDOW_SIZE) | |
#define LINE_LENGTH (WINDOW_SIZE - 0.15 * WINDOW_SIZE) |