This file contains hidden or 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
| // https://loup-vaillant.fr/tutorials/earley-parsing/recogniser | |
| // | |
| // with c code cleanup from https://github.com/DogeSSBM | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdint.h> | |
| #include <stdbool.h> | |
| #include <stdalign.h> | |
| #include <string.h> |
This file contains hidden or 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 <stdint.h> | |
| #include <string.h> | |
| #define VECTOR_ALIGN_CHECK 0 | |
| struct vector_t { | |
| uint64_t size; | |
| uint64_t align; | |
| uint64_t stride; | |
| uint64_t len; |
This file contains hidden or 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> | |
| typedef enum { | |
| INIT, | |
| REQUESTED_SAVE, | |
| AWAIT_INNER_LOOP_COND_GT, | |
| REQUESTED_OVERWRITE, | |
| REQUESTED_RESTORE, | |
| PC_OUT_OF_SYNC, |
This file contains hidden or 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
| use std::{cmp::Ordering, fmt::Debug}; | |
| #[derive(Debug)] | |
| struct Partition { | |
| pivot_pos : usize, | |
| mid_cursor : usize, | |
| end_cursor : usize, | |
| array_length : usize, | |
| state : State, | |
| } |
This file contains hidden or 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(nonstandard_style)] | |
| #![allow(unused)] | |
| use std::{alloc::Layout, usize}; | |
| extern crate alloc; | |
| type Weight = f64; | |
| type Node = usize; |
This file contains hidden or 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
| // top nibble are flags, bottom nibble is the value | |
| type ParentVaL = u8; | |
| type Trie16Idx = u32; | |
| type ChildIdx = Option<core::num::NonZeroU32>; | |
| // This is a proper tree, the parent pointers are used to represent string as a linked list, | |
| struct Trie16Node { | |
| parent_val : ParentVaL, | |
| parent : Trie16Idx, | |
| children : [ChildIdx; 16], |
This file contains hidden or 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
| extern crate alloc; | |
| struct Arena { | |
| start : *mut u8, | |
| pos : *mut u8, | |
| end : *mut u8, | |
| layout : core::alloc::Layout, | |
| } | |
| fn arena_new(layout : core::alloc::Layout) -> Arena { |
This file contains hidden or 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 <stdint.h> | |
| #include <stdlib.h> | |
| struct ByteSlice { uint8_t* ptr; uintptr_t len; }; | |
| /* caution this removes the null terminated char! */ | |
| struct ByteSlice nullTerminated_slice(uint8_t* str) { | |
| uintptr_t len = 0; |
This file contains hidden or 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
| type Equal<a> = { equal : (l:a,r:a)=>boolean | |
| , notEqual : (l:a,r:a)=>boolean | |
| } | |
| type Ordering = "LT" | "EQ" | "GT" | |
| type Order<a> = { eq : Equal<a> | |
| , cmp : (l:a,r:a)=>Ordering | |
| , lt : (l:a,r:a)=>boolean | |
| , le : (l:a,r:a)=>boolean | |
| , gt : (l:a,r:a)=>boolean | |
| , ge : (l:a,r:a)=>boolean |
This file contains hidden or 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
| // Author : Remy Clarke | |
| // | |
| // the main function is at the bottom of the file. | |
| // USAGE : --JSON <FILE> --OUTDIR <DIR>" | |
| use std::{fmt::Debug, io::Write, rc::Rc}; | |
| /// ```ignore | |
| /// integer |
NewerOlder