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
function fromJulianDay(jd) { | |
const Y = 4716; | |
const J = 1401; | |
const M = 2; | |
const N = 12; | |
const R = 4; | |
const P = 1461; | |
const V = 3; | |
const U = 5; | |
const S = 153; |
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
#![allow(unused_doc_comments)] | |
#![allow(dead_code)] | |
/// let's create a lexer to tokenise a simplistic arithmetic language, | |
/// with integers, plusses and minuses! | |
/// | |
/// playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7e0716a957a90c486328c8e775ca268f | |
/// | |
/// to store the state of our lexer we'll just create a lexer struct: |
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
auto s = q"(")"; | |
auto broken = true; |
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
import std.stdio; | |
import std.datetime; | |
@safe: | |
private immutable ulong[256][8] tables_; | |
static this() | |
{ | |
import std.random : unpredictableSeed; |
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
import std.string, std.algorithm, std.range.primitives; | |
// a | void a() | |
// a :: b, c, ... | void a(b, c, ...) | |
// a :: b, c, ... -> r | r a(b, c, ...) | |
// a -> r | r a() | |
string generateIsSpec(string typename, string spec) | |
{ | |
auto buf = "{\nimport std.traits : lvalueOf;\n" ~ | |
"return is(typeof(" ~ typename ~ ".init) == " ~ typename ~ ") &&\n"; |
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 XSConverter | |
# noinspection RubyStringKeysInHashInspection | |
XSAMPA_MAP = { | |
'b_<' => 'ɓ', | |
'd`' => 'ɖ', | |
'd_<' => 'ɗ', | |
'g_<' => 'ɠ', | |
'h\\' => 'ɦ', | |
'j\\' => 'ʝ', | |
'l`' => 'ɭ', |