kragen/peg-bootstrap
View on GitHub ↗ ★ 76 JavaScript
A PEG that compiles itself.
18 mentions on Hacker News by 3 people: 2 stories, 16 comments · first 2008-12-21 · latest 2025-07-10
20082026
-
…more. This is not trivial to understand but I think it's not that hard either; it's a page of code: https://github.com/kragen/peg-bootstrap/blob/master/peg.md That version doesn't memoize and so doesn't enjoy Packrat parsing's linear-time…
comment by kragen · 2025-07-10 · in QRS: Epsilon Wrangling -
…(from a forth-like language to an i386 linux elf executable, 132 lines of code) - https://github.com/kragen/peg-bootstrap/blob/master/peg.md (from a peg grammar with semantic actions to javascript, 66 lines of code) - https://github.com/kra
comment by kragen · 2023-11-07 · in Writing a Compiler is Surprisingly Easy (part 1) -
…- letter: :between "az", :between "AZ", :between "__" Meta5ix, like my earlier peg-bootstrap https://github.com/kragen/peg-bootstrap/blob/master/peg.md (66 lines of code, compiles to JavaScript, supports backtracking), is not really…
comment by kragen · 2022-09-23 · in Langcc: A Next-Generation Compiler Compiler -
…you'd take the extra trouble to write a compiler rather than an interpreter. In 66 lines of code in https://github.com/kragen/peg-bootstrap/blob/master/peg.md I wrote an example compiler which compiles a PEG grammar into a JavaScript…
comment by kragen · 2022-07-17 · in Show HN: A compiler and VM for a simple language, in 150 lines of code -
Oh goodness, I never thought about using LuaLaTeX for that! I wrote handaxeweb.lua originally for https://github.com/kragen/peg-bootstrap/blob/master/peg.md but have used it for various things since then.
comment by kragen · 2022-02-10 · in Understanding LSM trees: What powers write-heavy databases (2020) -
I did pretty much the same thing with https://github.com/kragen/peg-bootstrap/blob/master/peg.md , although admittedly hand-compiling to JS was noticeably less work than hand-compiling to assembly language would have taken. My friend Dave…
comment by kragen · 2021-04-07 · in First C compiler ported to GCC -
…I've been interested in literate programming for a long time; for my self-bootstrapping PEG parser https://github.com/kragen/peg-bootstrap/blob/master/peg.md I wrote my own noweb-like system called HandAxeWeb in Lua (5.x)…
comment by kragen · 2021-02-27 · in Noweb – A Simple, Extensible Tool for Literate Programming -
…in a way that LALR and LL grammars aren't. I wrote a one-page PEG parser generator targeting JS at https://github.com/kragen/peg-bootstrap/blob/master/peg.md a few years back. But I think an excessive focus on the syntax of a programming…
comment by kragen · 2020-06-07 · in Let's make a Teeny Tiny compiler -
…it, though. It's very simple indeed (my self-compiling PEG parser generator is 66 lines of code: https://github.com/kragen/peg-bootstrap/blob/master/peg.md ) and very expressive.
comment by kragen · 2011-08-26 · in Want to Write a Compiler? Just Read These Two Papers. -
…remove the comments. I also wrote a PEG compiler-compiler in JavaScript which is one page of code: https://github.com/kragen/peg-bootstrap/blob/master/peg.md --- ultimately I want to make a version that generates StoneKnifeForth code…
comment by kragen · 2011-08-23 · in An unusual hardware architecture: APA (Associative Processing Array) -
…it's not vulgar to post yet another link to my minimal PEG parser generator in one page of code: https://github.com/kragen/peg-bootstrap/blob/master/peg.md In particular, the example here of embedding SQL in C would be pretty trivial to do…
comment by kragen · 2011-03-16 · in Parsing ought to be easier -
…written a one-page PEG compiler-compiler (interspersed with many pages of text explaining it) at https://github.com/kragen/peg-bootstrap/blob/master/peg.md .
comment by kragen · 2011-03-13 · in Yacc is not dead -
I wrote a metacircular compiler-compiler that generates parsers in PostScript: http://github.com/kragen/peg-bootstrap and a bootstrapping compiler for a very simple Forth-like language: http://github.com/kragen/stoneknifeforth (although I…
comment by kragen · 2010-09-26 · in Let’s Build a Compiler (1995) -
…Compiler construction: http://canonical.org/~kragen/sw/urscheme/ http://github.com/kragen/peg-bootstrap http://github.com/kragen/stoneknifeforth Machine learning: http://angstro.com/ (this isn't solely my project; I'm only
comment by kragen · 2009-07-10 · in "Is that a real program or is that something somebody wrote?" -
…for expressiveness. I did a simple PEG parser generator (66 lines, generates code in JavaScript, http://github.com/kragen/peg-bootstrap/blob/15acbdd6f7108117... ) and since then I've been thinking about computing one-character follow-sets…
comment by kragen · 2009-07-04 · in PyPEG - a PEG Parser-Interpreter in Python -
…'p' / 'u' / 's'. name <- namechar name / namechar _. methodname <- '+'_ / name. I have tested it (in http://github.com/kragen/peg-bootstrap/tree/master/peg.md ) and it seems to work for that fragment, although I haven't examined the parse…
comment by kragen · 2008-12-21 · in Java in College: "You might as well be teaching Chinese to a monkey."