rough date | version |
---|---|
2022-07-01 | 0.10.0-dev.2836+2360f8c49 |
2022-06-06 | 0.10.0-dev.2490+135b91aec |
2022-05-26 | 0.10.0-dev.2413+ee1a95b55 |
2022-05-11 | 0.10.0-dev.2186+3a64693db |
2022-05-04 | 0.10.0-dev.2063+49a7ceb5b |
2022-03-15 | 0.10.0-dev.1335+c64279b15 |
const std = @import("std"); | |
const Signer = std.crypto.sign.Ed25519; | |
// Blake3 : 1 | |
// Blake2b512 : 1.3 x slower than Blake3 | |
// Sha256 : 4 x slower than Blake3 | |
//const Hasher = std.crypto.hash.sha2.Sha256; | |
//const Hasher = std.crypto.hash.blake2.Blake2b512; | |
const Hasher = std.crypto.hash.Blake3; |
#!/usr/bin/env python3 | |
import sys | |
import os | |
import re | |
import argparse | |
import subprocess | |
def scan_path(defines, path): | |
for entry_base in os.listdir(path): | |
entry = os.path.join(path, entry_base) |
#include <windows.h> | |
#include <stdio.h> | |
#define logf(fmt,...) do { fprintf(stderr, fmt "\n", ##__VA_ARGS__); fflush(stderr); } while (0) | |
void MonitorDirectoryRecursively(const char* directoryPath) { | |
HANDLE hChange = FindFirstChangeNotification( | |
directoryPath, | |
TRUE, // Watch the subtree | |
FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME |
const std = @import("std"); | |
const mem = std.mem; | |
const testing = std.testing; | |
/// AnyWriter is an instance of std.io.Writer that is able to wrap | |
/// any other std.io.Writer type and forward data to it. | |
/// | |
/// AnyWriter enables std.io.Writer to be used in places where concrete | |
/// types are required such as function pointer parameters or as a field | |
/// in a struct. |
const std = @import("std"); | |
const Vm = @import("vm.zig").Vm; | |
const tokenizer = @import("tokenizer.zig"); | |
pub fn lex(src: [:0]const u8, off: usize) tokenizer.Token { | |
var t = @import("tokenizer.zig").Tokenizer{ .code = src, .idx = off }; | |
return t.next(); | |
} |
fn changePitchOne(freq: u16, semitones: f32) u16 { | |
if (freq == 0) return 0; | |
const freq_f32 = @as(f32, @floatFromInt(freq)); | |
return @intFromFloat(@round(freq_f32 * std.math.pow( | |
f32, | |
@exp2(1.0 / 12.0), | |
semitones, | |
))); | |
} |
const std = @import("std"); | |
fn fatal(comptime fmt: []const u8, args: anytype) noreturn { | |
std.log.err(fmt, args); | |
std.os.exit(0xff); | |
} | |
pub fn main() void { | |
var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
const arena = arena_instance.allocator(); |
Since people seem to enjoy making scripting languages so much (not meant to be a "dig", I like this)...here's a scripting language I'd be very interested in.
ZigScript
"A companion scripting language meant for Zig developers."
Zig is my language of choice, but I still reach for Python when I want to make something fast or "short lived". However, Python has downsides, it's hard to build the interpreter for it (especially a static executable), its packaging system is a mess and it's got some interesting syntax choices that would feel foreign to a native Zig developer, but overall I think the core of the language is brilliant. I imagine ZigScript as Python but in a "Zig Style" syntax with the problems fixed. Here are some features that come to mind:
const std = @import("std"); | |
const stdout = std.io.getStdOut().writer(); | |
fn raw(s: []const u8) void { | |
stdout.writeAll(s) catch |err| @panic(@errorName(err)); | |
} | |
fn fmt(comptime spec: []const u8, args: anytype) void { | |
stdout.print(spec, args) catch |err| @panic(@errorName(err)); | |
} |