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
''' | |
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 |
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
#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 |
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
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 |