Skip to content

Instantly share code, notes, and snippets.

@gingerBill
gingerBill / build_msvc.sublime-build
Created June 8, 2016 19:10
Sublime Build - MSVC
{
"shell_cmd": "build.bat",
"file_regex": "^ *([A-z]:.*)[(]([0-9]+)[)]",
"working_dir": "${project_path:${folder}}"
}
@gingerBill
gingerBill / demo001.odin
Created August 26, 2016 11:11
First Odin Demo
// Demo 001
#load "basic.odin"
#load "game.odin"
main :: proc() {
_ = hellope();
procedures();
variables();
constants();
types();
@gingerBill
gingerBill / gist:a02887b5f989c0a19d94384c6051e365
Created October 27, 2016 19:11
Bill's Sublime Settings File
{
"auto_indent": true,
"auto_match_enabled": true,
"binary_file_patterns":
[
"*.dds",
"*.eot",
"*.gif",
"*.ico",
"*.jar",
@gingerBill
gingerBill / GCC
Last active October 27, 2016 22:01
{
"shell_cmd": "build",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder}}"
}
#foreign_library "stb_image"
DEFAULT :: 0
GREY :: 1
GREY_ALPHA :: 2
RGB :: 3
RGB_ALPHA :: 4
io_callbacks :: struct #ordered {
read: proc(user: rawptr, data: ^byte, size: i32) -> i32 // fill 'data' with 'size' bytes. return number of bytes actually read
Brief comments on https://eev.ee/blog/2016/12/01/lets-stop-copying-c/ for Odin
A - Agree with eev.ee
D - Disagree with eev.ee
S - Have it for sanity reasons
O - Other reason
[A] Textual Inclusion
[A] Optional block delimiters
[A] Bitwise operator precedence
@gingerBill
gingerBill / plugin_system_idea.md
Last active April 16, 2017 10:56
Plug-in System for a Compiler (Idea for Odin)

One of the original goals in Odin was metaprogramming. However, as development progressed, it has come clear that this is such a broad term which could mean anything.

The kinds of metaprogramming originally conceived are compile time execution, AST modification, and "semantic macros".

Here is the new idea: allow the user to "plug-in" their own metaprogramming functionality as a stage in the compiler. With the specific stages being:

  • File loading (get text into memory)
  • Tokenizing/Lexing
  • Parsing
  • Type checking
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Odin
file_extensions:
- odin
first_line_match: "-[*]-( Mode:)? Odin -[*]-"
scope: source.odin
variables:
identifier: '\b[[:alpha:]_][[:alnum:]_]*\b'
@gingerBill
gingerBill / gist:5b620b50a02930f4961075e3b4fd3e17
Last active June 26, 2017 14:55
Jai-like Syntax Solution for Foreign Procedures
I'm using `proc` as a prefix to remove ambiguity in the syntax. The current syntax is ambiguous.
(int) // Is this a procedure that takes an int or is it just an int?
Current Jai Syntax:
name :: proc(); // type
name :: proc() {}; // declaration
name :: proc() #foreign lib; // foreign declaration
This syntax fails if you want have foreign variables too. Foreign variables would not have a consistent syntax.
@gingerBill
gingerBill / augmented.c
Created June 6, 2016 13:55
Augmented C - 002
#ifndef AUGMENTED_C_GUARD
#define AUGMENTED_C_GUARD
#include <stddef.h>
typedef ptrdiff_t isize;
#define offset_of(Type, element) ((isize)&(((Type *)0)->element))
#define JOIN2_IND(a, b) a##b
#define JOIN2(a, b) JOIN2_IND(a, b)