|
1 | | -{{ define "main" }} |
2 | | -<section class="hero"> |
3 | | - <img class="hero-logo" src="{{ "img/logo.svg" | relURL }}" alt="go-ruby-parser logo" width="96" height="96"> |
4 | | - <h1> |
5 | | - <span class="accent">{{ .Site.Params.heroAccent }}</span> |
6 | | - </h1> |
7 | | - {{ with .Site.Params.heroTagline }}<p class="tag">{{ . }}</p>{{ end }} |
8 | | - <div class="intro"> |
9 | | - {{ range .Site.Params.heroIntro }}<p>{{ . | safeHTML }}</p>{{ end }} |
10 | | - </div> |
11 | | -</section> |
12 | | - |
13 | | -<section id="why"> |
14 | | - <h2>Why go-ruby-parser</h2> |
15 | | - <p> |
16 | | - Building Ruby tooling in Go used to mean shelling out to a Ruby process, binding |
17 | | - <strong>Prism</strong> (Ruby's official parser, written in C) over cgo, or |
18 | | - reimplementing the grammar from scratch. go-ruby-parser is a faithful, pure-Go |
19 | | - Ruby front-end — lexer, parser and AST — so a Go program can parse Ruby to a typed |
20 | | - syntax tree with <strong>no cgo</strong> and a single static binary. It is the |
21 | | - parser the Go ecosystem was missing. |
22 | | - </p> |
23 | | -</section> |
24 | | - |
25 | | -<section id="repos"> |
26 | | - <h2>Repositories</h2> |
27 | | - <div class="grid"> |
28 | | - <div class="card"> |
29 | | - <h4><a href="https://github.com/go-ruby-parser/parser">parser</a></h4> |
30 | | - <p>The front-end. <code>parser.Parse(src) (*ast.Program, error)</code>, with sub-packages <code>token</code>, <code>ast</code> and <code>lexer</code>. A stateful lexer (MRI <code>spaceSeen</code> semantics), a recursive-descent + Pratt parser with a scope stack, and a typed AST. 100% covered, differential-tested against MRI 4.0.5.</p> |
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | +<meta charset="utf-8"> |
| 5 | +<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | +<title>{{ .Site.Title }} — a Ruby front-end in pure Go: lexer, parser, AST, no cgo</title> |
| 7 | +<meta name="description" content="go-ruby-parser — a pure-Go (CGO=0) Ruby front-end: a stateful lexer, a recursive-descent + Pratt parser, and a typed AST for building Ruby tooling in Go without cgo or Prism."> |
| 8 | +<style> |
| 9 | + :root { |
| 10 | + --bg: #ffffff; --fg: #1b1f24; --muted: #57606a; --card: #f6f8fa; |
| 11 | + --border: #d0d7de; --accent: #DC2626; --accent-fg: #ffffff; |
| 12 | + --ready: #1a7f37; --active: #0969da; --planned: #9a6700; |
| 13 | + } |
| 14 | + /* System mode (no explicit choice) follows the OS preference. */ |
| 15 | + @media (prefers-color-scheme: dark) { |
| 16 | + :root:not([data-theme]) { |
| 17 | + --bg: #0d1117; --fg: #e6edf3; --muted: #9198a1; --card: #161b22; |
| 18 | + --border: #30363d; --accent: #EF4444; --accent-fg: #0d1117; |
| 19 | + --ready: #3fb950; --active: #4493f8; --planned: #d29922; |
| 20 | + } |
| 21 | + } |
| 22 | + /* Forced dark (manual toggle). */ |
| 23 | + :root[data-theme="dark"] { |
| 24 | + --bg: #0d1117; --fg: #e6edf3; --muted: #9198a1; --card: #161b22; |
| 25 | + --border: #30363d; --accent: #EF4444; --accent-fg: #0d1117; |
| 26 | + --ready: #3fb950; --active: #4493f8; --planned: #d29922; |
| 27 | + } |
| 28 | + .theme-toggle { |
| 29 | + position: fixed; top: 14px; right: 14px; z-index: 10; |
| 30 | + font: inherit; font-size: .8rem; cursor: pointer; padding: 6px 12px; |
| 31 | + color: var(--fg); background: var(--card); border: 1px solid var(--border); border-radius: 999px; |
| 32 | + } |
| 33 | + * { box-sizing: border-box; } |
| 34 | + body { |
| 35 | + margin: 0; background: var(--bg); color: var(--fg); |
| 36 | + font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; |
| 37 | + } |
| 38 | + .wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; } |
| 39 | + header { padding: 72px 0 32px; text-align: center; } |
| 40 | + .logo { width: 88px; height: 88px; margin: 0 auto 18px; display: block; } |
| 41 | + h1 { font-size: 2.6rem; margin: 0 0 .3em; letter-spacing: -.02em; } |
| 42 | + .tagline { font-size: 1.2rem; color: var(--muted); margin: 0 auto; max-width: 660px; } |
| 43 | + .pills { margin: 22px 0 0; } |
| 44 | + .pill { |
| 45 | + display: inline-block; margin: 4px; padding: 3px 10px; font-size: .82rem; |
| 46 | + color: var(--muted); background: var(--card); border: 1px solid var(--border); border-radius: 999px; |
| 47 | + } |
| 48 | + .cta { margin: 30px 0 0; } |
| 49 | + .badges { margin: 18px 0 0; } |
| 50 | + .badges a { margin: 0 3px; text-decoration: none; } |
| 51 | + .badges img { vertical-align: middle; } |
| 52 | + .btn { |
| 53 | + display: inline-block; padding: 10px 18px; margin: 4px; border-radius: 8px; text-decoration: none; |
| 54 | + font-weight: 600; border: 1px solid var(--border); |
| 55 | + } |
| 56 | + .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); } |
| 57 | + .btn.ghost { color: var(--fg); background: transparent; } |
| 58 | + .lead { color: var(--fg); max-width: 760px; margin: 8px auto 0; text-align: center; } |
| 59 | + .lead code { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; } |
| 60 | + .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; padding: 24px 0 8px; } |
| 61 | + .card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; } |
| 62 | + .card h3 { margin: 0 0 .35em; font-size: 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: 10px; } |
| 63 | + .card h3 a { text-decoration: none; } |
| 64 | + .card p { margin: 0; color: var(--fg); } |
| 65 | + .card p code { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; } |
| 66 | + .status { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; } |
| 67 | + .status.ready { color: var(--ready); } |
| 68 | + .status.active { color: var(--active); } |
| 69 | + .status.planned { color: var(--planned); } |
| 70 | + .principles { color: var(--muted); text-align: center; padding: 10px 0 0; } |
| 71 | + footer { color: var(--muted); text-align: center; padding: 40px 0 56px; font-size: .9rem; } |
| 72 | + a { color: var(--accent); } |
| 73 | +</style> |
| 74 | +<link rel="icon" type="image/svg+xml" href="/favicon.svg"> |
| 75 | +<script> |
| 76 | + // Set the saved theme before paint to avoid a flash; "system" leaves no attribute. |
| 77 | + (function(){var m=localStorage.getItem('theme');if(m&&m!=='system')document.documentElement.setAttribute('data-theme',m);})(); |
| 78 | +</script> |
| 79 | +</head> |
| 80 | +<body> |
| 81 | + <button id="theme-toggle" class="theme-toggle" type="button" aria-label="Toggle light, dark or system theme"><span id="theme-label">🖥️ System</span></button> |
| 82 | + <header class="wrap"> |
| 83 | + <img class="logo" src="/img/logo.svg" alt="go-ruby-parser logo" width="88" height="88"> |
| 84 | + <h1>go-ruby-parser</h1> |
| 85 | + <p class="tagline">A Ruby front-end in pure Go — lexer, parser, AST. No cgo, no Prism.</p> |
| 86 | + <div class="pills"> |
| 87 | + <span class="pill">pure Go · zero cgo</span> |
| 88 | + <span class="pill">stateful lexer</span> |
| 89 | + <span class="pill">recursive-descent + Pratt</span> |
| 90 | + <span class="pill">typed AST</span> |
| 91 | + <span class="pill">Ruby 4.0 subset</span> |
| 92 | + <span class="pill">pattern matching</span> |
| 93 | + <span class="pill">heredocs</span> |
| 94 | + <span class="pill">MRI 4.0.5 differential-tested</span> |
| 95 | + <span class="pill">100% coverage</span> |
| 96 | + <span class="pill">6 arches · WebAssembly</span> |
31 | 97 | </div> |
32 | | - <div class="card"> |
33 | | - <h4><a href="https://go-ruby-parser.github.io/docs/">docs</a></h4> |
34 | | - <p>Documentation site (MkDocs Material): the public API, what's parsed, and the known limitations. <a href="https://github.com/go-ruby-parser/docs">Source →</a></p> |
| 98 | + <div class="cta"> |
| 99 | + <a class="btn primary" href="/docs/">Documentation</a> |
| 100 | + <a class="btn ghost" href="https://github.com/go-ruby-parser/parser">GitHub</a> |
35 | 101 | </div> |
36 | | - <div class="card"> |
37 | | - <h4><a href="https://github.com/go-ruby-parser/brand">brand</a></h4> |
38 | | - <p>Logos and icons for the organization, in SVG / PNG / JPG / ICO / ICNS across colour, white and black variants.</p> |
| 102 | + <div class="badges"> |
| 103 | + <a href="/docs/"><img alt="Documentation (MkDocs Material + mike)" src="https://img.shields.io/badge/docs-mkdocs--material-9B1C2E"></a> |
| 104 | + <a href="https://github.com/go-ruby-parser/parser/blob/main/LICENSE"><img alt="License: BSD-3-Clause" src="https://img.shields.io/badge/license-BSD--3--Clause-blue"></a> |
| 105 | + <a href="https://go.dev/dl/"><img alt="Go 1.26.4+" src="https://img.shields.io/badge/go-1.26.4%2B-00ADD8"></a> |
| 106 | + <a href="https://github.com/go-ruby-parser/parser"><img alt="Coverage 100%" src="https://img.shields.io/badge/coverage-100%25-1a7f37"></a> |
39 | 107 | </div> |
40 | | - </div> |
41 | | -</section> |
| 108 | + </header> |
| 109 | + |
| 110 | + <main class="wrap"> |
| 111 | + <p class="lead">go-ruby-parser turns Ruby source into a syntax tree: a stateful lexer, |
| 112 | + a recursive-descent parser with a <strong>Pratt</strong> expression core, and a typed AST — |
| 113 | + all in <strong>pure Go, with cgo disabled</strong>. No cgo, no <strong>Prism</strong>, no |
| 114 | + shelling out to Ruby: the front-end the Go ecosystem lacked for building Ruby tooling |
| 115 | + (linters, formatters, analysers, doc generators, LSP servers, transpilers) in pure Go. |
| 116 | + It was extracted from <a href="https://github.com/go-embedded-ruby/ruby">go-embedded-ruby</a> — |
| 117 | + which now consumes it — and is grown test-first against <strong>MRI Ruby 4.0.5</strong>, with |
| 118 | + <strong>100% coverage</strong> enforced in CI across the six 64-bit targets.</p> |
| 119 | + |
| 120 | + <section class="grid"> |
| 121 | + {{ range .Site.Params.repos }} |
| 122 | + <article class="card"> |
| 123 | + <h3><a href="{{ .url }}">{{ .name }}</a> <span class="status {{ .status }}">{{ .status }}</span></h3> |
| 124 | + <p>{{ .blurb | markdownify }}</p> |
| 125 | + </article> |
| 126 | + {{ end }} |
| 127 | + </section> |
| 128 | + |
| 129 | + <p class="principles">A pure-Go, cgo-disabled front-end, so it cross-compiles and embeds |
| 130 | + anywhere — and, being CGO=0, also compiles to WebAssembly (<code>js/wasm</code> and |
| 131 | + <code>wasip1/wasm</code>). It parses a broad, practical subset of Ruby 4.0 to a typed AST, |
| 132 | + differential-tested against MRI's reference parser, over a clean |
| 133 | + <code>Parse → *ast.Program</code> API any Go tool can build on. It is a standalone, reusable |
| 134 | + module and the front-end member of the sibling family |
| 135 | + <a href="https://github.com/go-ruby-marshal">go-ruby-marshal</a> · |
| 136 | + <a href="https://github.com/go-ruby-regexp">go-ruby-regexp</a>, consumed by |
| 137 | + <a href="https://github.com/go-embedded-ruby">github.com/go-embedded-ruby</a>.</p> |
| 138 | + </main> |
42 | 139 |
|
43 | | -<section id="quality"> |
44 | | - <h2>Quality bar</h2> |
45 | | - <ul class="features"> |
46 | | - <li><strong>Pure Go.</strong> <code>CGO_ENABLED=0</code> — no cgo, no Prism, no Ruby process.</li> |
47 | | - <li><strong>100% test coverage.</strong> Gated in CI; the grammar is differential-tested against MRI Ruby 4.0.5.</li> |
48 | | - <li><strong>Reusable.</strong> A clean <code>Parse → *ast.Program</code> API any Go tool can build on (linters, formatters, LSP, doc generators).</li> |
49 | | - <li><strong>Multi-arch.</strong> Validated on all six 64-bit Go targets (amd64, arm64, riscv64, loong64, ppc64le, s390x).</li> |
50 | | - <li><strong>BSD-3-Clause</strong> on every source file.</li> |
51 | | - </ul> |
52 | | -</section> |
53 | | -{{ end }} |
| 140 | + <footer class="wrap"> |
| 141 | + BSD-3-Clause · <a href="https://github.com/go-ruby-parser">github.com/go-ruby-parser</a> |
| 142 | + </footer> |
| 143 | + <script> |
| 144 | + (function(){ |
| 145 | + var order=['system','light','dark'], root=document.documentElement; |
| 146 | + var labels={system:'🖥️ System',light:'☀️ Light',dark:'🌙 Dark'}; |
| 147 | + function apply(m){ if(m==='system'){root.removeAttribute('data-theme');}else{root.setAttribute('data-theme',m);} localStorage.setItem('theme',m); var el=document.getElementById('theme-label'); if(el)el.textContent=labels[m]; } |
| 148 | + var mode=localStorage.getItem('theme')||'system'; apply(mode); |
| 149 | + var btn=document.getElementById('theme-toggle'); |
| 150 | + if(btn) btn.addEventListener('click',function(){ mode=order[(order.indexOf(mode)+1)%order.length]; apply(mode); }); |
| 151 | + })(); |
| 152 | + </script> |
| 153 | +</body> |
| 154 | +</html> |
0 commit comments