Skip to content

Instantly share code, notes, and snippets.

@gingerBill
gingerBill / dumb_handle_map.odin
Last active July 19, 2024 10:27
Handle-based Map
package dumb_handle_map
// NOTE: ONLY TO SHOW WHAT A GENERATION IS DOING
// BUT DOES NO INSERTION WHATSOEVER
Handle_Map :: struct($T: typeid) {
entries: [dynamic]Entry(T),
}
Entry :: struct($T: typeid) {
@gingerBill
gingerBill / algol68_prime_sieve_in_odin.odin
Created May 14, 2024 12:20
A translation of ALGOL68 code to Odin, showing the similarities of the entire ALGOL family
package main
import "core:fmt"
import "core:os"
error :: proc(s: string) -> ! {
fmt.eprintln("\n error:", s); os.exit(1)
}
one_to :: proc(n: int) -> List {
f :: proc(m, n: int) -> List {
@gingerBill
gingerBill / checklist.txt
Last active April 18, 2024 02:16
Language Design Checklist for Odin
You appear to be advocating a new:
[ ] functional [x] imperative [ ] object-oriented [x] procedural [ ] stack-based
[ ] "multi-paradigm" [ ] lazy [x] eager [x] statically-typed [ ] dynamically-typed
[ ] pure [x] impure [ ] non-hygienic [ ] visual [ ] beginner-friendly
[ ] non-programmer-friendly [ ] completely incomprehensible
programming language. Your language will not work. Here is why it will not work.
You appear to believe that:
[ ] Syntax is what makes programming difficult
[ ] Garbage collection is free [ ] Computers have infinite memory
@gingerBill
gingerBill / llvm_passes.txt
Last active March 20, 2024 13:07
LLVM 17.0.1 default<O?> module passes
# LLVM 17.0.1 Passes
## default<O0>
always-inline,
coro-cond(
coro-early,
cgscc(
coro-split
@gingerBill
gingerBill / odin.ebnf
Last active September 22, 2023 00:24
Odin EBNF (Work In Progress)
/* characters */
newline = /* the Unicode code point U+000A */ .
unicode_char = /* an arbitrary Unicode codepoint except newline */ .
unicode_letter = /* a Unicode code point categorized as "Letter" */ .
unicode_digit = /* a Unicode code point categorized as "Number, decimal digit" */ .
letter = unicode_letter | "_" .
decimal_digit = "0" ... "9" .
binary_digit = "0" | "1" .
@gingerBill
gingerBill / d3d11_in_odin.odin
Last active March 22, 2024 22:53
D3D11 in Odin
package d3d11_main
import D3D11 "vendor:directx/d3d11"
import DXGI "vendor:directx/dxgi"
import D3D "vendor:directx/d3d_compiler"
import SDL "vendor:sdl2"
import glm "core:math/linalg/glsl"
// Based off https://gist.github.com/d7samurai/261c69490cce0620d0bfc93003cd1052
@gingerBill
gingerBill / metal_in_odin.odin
Last active April 11, 2024 18:12
Metal in Odin Natively
package objc_test
import NS "vendor:darwin/Foundation"
import MTL "vendor:darwin/Metal"
import CA "vendor:darwin/QuartzCore"
import SDL "vendor:sdl2"
import "core:fmt"
import "core:os"
@gingerBill
gingerBill / wasm4_wasm32.odin
Created November 9, 2021 15:34
WASM-4 Odin Bindings
// WASM-4: https://wasm4.org/docs
package wasm4
foreign import wasm4 "env"
#assert(size_of(int) == size_of(u32))
// ┌───────────────────────────────────────────────────────────────────────────┐
// │ │
// │ Platform Constants │
@gingerBill
gingerBill / wasm4_wasm32.odin
Last active April 4, 2024 09:33
WASM-4 Odin bindings
// WASM-4: https://wasm4.org/docs
package wasm4
foreign import wasm4 "env"
#assert(size_of(int) == size_of(u32))
// ┌───────────────────────────────────────────────────────────────────────────┐
// │ │
// │ Platform Constants │
@gingerBill
gingerBill / sdl2_opengl_demo.odin
Last active July 9, 2024 08:11
Simple SDL2 + OpenGL demo written in Odin
package main
import "core:fmt"
import glm "core:math/linalg/glsl"
import "core:time"
import SDL "vendor:sdl2"
import gl "vendor:OpenGL"
main :: proc() {