Skip to content

Instantly share code, notes, and snippets.

View mtasic85's full-sized avatar
🦁
Recruiters will be shot on sight

Marko Tasic mtasic85

🦁
Recruiters will be shot on sight
View GitHub Profile
@mtasic85
mtasic85 / gist:8887231
Created February 8, 2014 17:35
cosmos c backend semantics
from co.lang.c import * # var, field, struct, PTR, ptr, NULL, double ...
class A(struct):
field.x = int
field.y = double
field.z = PTR('A')
def __init__(self, x: int, y: double, z: PTR('A')):
self.x = x
self.y = y
@mtasic85
mtasic85 / dragons.c
Created August 12, 2018 14:31 — forked from gby/dragons.c
How to do a computed goto in an inline function in GCC
#include <stdio.h>
#include <stdlib.h>
/*
* How to do a computed goto in an inline function.
* "Here be Dragons"
*/
/*
* This is used to keep the compiler from
@mtasic85
mtasic85 / parser_peg_json_v1_1.py
Last active September 5, 2021 12:28
Python - PEG - Parsing Combinators - Simple JSON parser v1.1
'''
PEG - Parsing Combinators
Example: Simple JSON parser
'''
from typing import Any, Callable
from string import digits, ascii_letters, whitespace
class JsonParser:
'''
VALUE ::= STRING | NUMBER | OBJECT | ARRAY