-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ c380758 🚀
- Loading branch information
0 parents
commit 958b40b
Showing
13 changed files
with
669 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
www.garden-lang.org |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>The Garden Programming Language</title> | ||
|
||
<link | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" | ||
crossorigin="anonymous" | ||
/> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<nav class="navbar navbar-expand-lg bg-body-tertiary"> | ||
<div class="container-fluid"> | ||
<h1 class="navbar-brand mb-0"> | ||
🌱 Garden | ||
</h1> | ||
|
||
<div class="navbar-collapse"> | ||
<ul class="navbar-nav"> | ||
<li class="nav-item"> | ||
<a class="nav-link active" href="/">Home</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/about.html">About</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/if.html">if</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://github.com/Wilfred/garden" | ||
>GitHub</a | ||
> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<h1>About Garden</h1> | ||
|
||
<p> | ||
Garden exists because I want a language that is interactively editable. This | ||
is impossible to add to an existing language. | ||
</p> | ||
|
||
<h2>Taking REPLs Seriously</h2> | ||
|
||
<p> | ||
Common Lisp and Smalltalk have a superpower: you can modify running programs. | ||
You can redefine functions and modify class definitions without restarting | ||
your program. | ||
</p> | ||
|
||
<p> | ||
Garden aims to provide that superpower in a conventional language design. I'm | ||
trying to provide a very familiar syntax and workflow. | ||
</p> | ||
|
||
<h2>Tooling First</h2> | ||
|
||
<p> | ||
Garden prioritises developer experience over language functionality. The | ||
syntax and semantics are deliberately small, so a small team (or just me!) can | ||
build a delightful, credible language experience. | ||
</p> | ||
|
||
<h2>Just Enough Typing</h2> | ||
|
||
<p>Types are a nice tool to have too.</p> | ||
|
||
<p> | ||
Most gradual type systems are intended for incremental adoption in a | ||
dynamically typed language. Garden is new, but requires a typing model that | ||
works with code of the form: | ||
</p> | ||
|
||
<code> | ||
<pre> | ||
function foo(): String { return "" } | ||
|
||
function bar(): Unit { | ||
eval("function foo(): Int { return 1 }"); | ||
let x = foo() + 1 | ||
} | ||
</pre | ||
> | ||
</code> | ||
|
||
<h2>Sandboxed Execution</h2> | ||
|
||
<p> | ||
Garden supports sandbox execution without third-party libraries. This is | ||
important for two workflows: | ||
</p> | ||
|
||
<p> | ||
(1) The IDE can speculatively evaluate snippets of code safely. This is | ||
convenient and enables 'mutation testing' for code completion. | ||
</p> | ||
|
||
<p> | ||
(2) Libraries can declare what capabilities they need, such as network or | ||
disk. This makes third-party libraries safer to install. This will be coarse | ||
permissions, similar to OpenBSD's Pledge. | ||
</p> | ||
|
||
<h2>Tooling Oriented Dynamism</h2> | ||
|
||
<p> | ||
Garden splits its semantics into (1) simple evaluation that is amenable to | ||
static analysis, and (2) reflective, dynamic evaluation that is friendly to | ||
developer experience. | ||
</p> | ||
|
||
<p> | ||
This means that errors in userland are plain <code>Result</code> types, but | ||
unhandled errors can be resumed in a Lisp/Smalltalk manner. | ||
</p> | ||
|
||
</div> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<h1>About Garden</h1> | ||
|
||
<p> | ||
Garden exists because I want a language that is interactively editable. This | ||
is impossible to add to an existing language. | ||
</p> | ||
|
||
<h2>Taking REPLs Seriously</h2> | ||
|
||
<p> | ||
Common Lisp and Smalltalk have a superpower: you can modify running programs. | ||
You can redefine functions and modify class definitions without restarting | ||
your program. | ||
</p> | ||
|
||
<p> | ||
Garden aims to provide that superpower in a conventional language design. I'm | ||
trying to provide a very familiar syntax and workflow. | ||
</p> | ||
|
||
<h2>Tooling First</h2> | ||
|
||
<p> | ||
Garden prioritises developer experience over language functionality. The | ||
syntax and semantics are deliberately small, so a small team (or just me!) can | ||
build a delightful, credible language experience. | ||
</p> | ||
|
||
<h2>Just Enough Typing</h2> | ||
|
||
<p>Types are a nice tool to have too.</p> | ||
|
||
<p> | ||
Most gradual type systems are intended for incremental adoption in a | ||
dynamically typed language. Garden is new, but requires a typing model that | ||
works with code of the form: | ||
</p> | ||
|
||
<code> | ||
<pre> | ||
function foo(): String { return "" } | ||
|
||
function bar(): Unit { | ||
eval("function foo(): Int { return 1 }"); | ||
let x = foo() + 1 | ||
} | ||
</pre | ||
> | ||
</code> | ||
|
||
<h2>Sandboxed Execution</h2> | ||
|
||
<p> | ||
Garden supports sandbox execution without third-party libraries. This is | ||
important for two workflows: | ||
</p> | ||
|
||
<p> | ||
(1) The IDE can speculatively evaluate snippets of code safely. This is | ||
convenient and enables 'mutation testing' for code completion. | ||
</p> | ||
|
||
<p> | ||
(2) Libraries can declare what capabilities they need, such as network or | ||
disk. This makes third-party libraries safer to install. This will be coarse | ||
permissions, similar to OpenBSD's Pledge. | ||
</p> | ||
|
||
<h2>Tooling Oriented Dynamism</h2> | ||
|
||
<p> | ||
Garden splits its semantics into (1) simple evaluation that is amenable to | ||
static analysis, and (2) reflective, dynamic evaluation that is friendly to | ||
developer experience. | ||
</p> | ||
|
||
<p> | ||
This means that errors in userland are plain <code>Result</code> types, but | ||
unhandled errors can be resumed in a Lisp/Smalltalk manner. | ||
</p> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>The Garden Programming Language</title> | ||
|
||
<link | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" | ||
crossorigin="anonymous" | ||
/> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<nav class="navbar navbar-expand-lg bg-body-tertiary"> | ||
<div class="container-fluid"> | ||
<h1 class="navbar-brand mb-0"> | ||
🌱 Garden | ||
</h1> | ||
|
||
<div class="navbar-collapse"> | ||
<ul class="navbar-nav"> | ||
<li class="nav-item"> | ||
<a class="nav-link active" href="/">Home</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/about.html">About</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/if.html">if</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://github.com/Wilfred/garden" | ||
>GitHub</a | ||
> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<h1>`if` keyword</h1> | ||
|
||
<p>`if` evaluates a conditional.</p> | ||
|
||
</div> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>The Garden Programming Language</title> | ||
|
||
<link | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" | ||
crossorigin="anonymous" | ||
/> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<nav class="navbar navbar-expand-lg bg-body-tertiary"> | ||
<div class="container-fluid"> | ||
<h1 class="navbar-brand mb-0"> | ||
🌱 Garden | ||
</h1> | ||
|
||
<div class="navbar-collapse"> | ||
<ul class="navbar-nav"> | ||
<li class="nav-item"> | ||
<a class="nav-link active" href="/">Home</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/about.html">About</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/if.html">if</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://github.com/Wilfred/garden" | ||
>GitHub</a | ||
> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<div class="form-floating mt-5"> | ||
<textarea | ||
class="form-control is-invalid" | ||
placeholder="Your program here" | ||
id="parse-input" | ||
> | ||
fun f() {}</textarea | ||
> | ||
<label for="parse-input">Parser Playground</label> | ||
</div> | ||
|
||
<span id="parse-status"></span> | ||
|
||
<script type="module" src="main.js"></script> | ||
|
||
</div> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="form-floating mt-5"> | ||
<textarea | ||
class="form-control is-invalid" | ||
placeholder="Your program here" | ||
id="parse-input" | ||
> | ||
fun f() {}</textarea | ||
> | ||
<label for="parse-input">Parser Playground</label> | ||
</div> | ||
|
||
<span id="parse-status"></span> | ||
|
||
<script type="module" src="main.js"></script> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import init, { check_parse } from "./pkg/garden_lang_web.js"; | ||
|
||
function showParseState(textarea) { | ||
let src = textarea.value; | ||
const result = check_parse(src); | ||
|
||
let parseStatusSpan = document.getElementById("parse-status"); | ||
if (result == null) { | ||
textarea.classList.remove("is-invalid"); | ||
parseStatusSpan.innerHTML = ""; | ||
} else { | ||
textarea.classList.add("is-invalid"); | ||
parseStatusSpan.innerHTML = result; | ||
} | ||
} | ||
|
||
async function run() { | ||
await init(); | ||
|
||
let parseInput = document.getElementById("parse-input"); | ||
let src = parseInput.value; | ||
showParseState(parseInput); | ||
|
||
parseInput.addEventListener("input", () => showParseState(parseInput), false); | ||
} | ||
|
||
run(); |
Oops, something went wrong.