Skip to content

Instantly share code, notes, and snippets.

View languageNode.json
{
"category": "help",
"components": [
"want", "delimiters",
"create synonyms", "delimiters",
{"terminal": "a language node"},
{"regex": ".*"}
]
}
View languageNode.json
{
"category": "test",
"components": [
{"terminal": "test"}
]
}
View languageNode.json
{
"category": "main",
"components": [
"add language node"
],
"url": "/addLangNode.html"
}
@nathanathan
nathanathan / index.html
Created Oct 20, 2012
How does language work?
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Widget</title>
<style>
code {
display:block;
}
View languageNode.json
{
"category": "main",
"components": [
{"category": "s_exp"}
],
"url": "http://nathanathan.github.com/LanguageWidgets/interpreter.html"
}
View languageNode.json
{
"category": "s_list",
"components": [
{"category": "s_exp"}, {"regex" : "\\s+"},
{"category": "s_list"}
],
"implementation": "function (components) {return [components.at(0)].concat(components.at(2))}"
}
View languageNode.json
{
"category": "s_exp",
"components": [
"(",
{"category": "s_list"},
")"
],
"implementation": "function (components) {return components.at(1).at(0)(components.at(1).slice(1));}",
"asyncImpl": "components.at(1, function(component){ component.atAll(0, function(components) { callback(components[0](components.at(1).slice(1))); }); })"
}
View languageNode.json
{
"category": "s_exp",
"components": [
{"regex": "\\d+(\\.\\d+)?"}
],
"implementation": "function (components){return parseFloat(components[0], 10)}",
"asyncImpl": "components.at(0, function(component){ callback(parseFloat(component, 10)) })"
}
View languageNode.json
{
"category": "s_exp",
"components": [
{"regex": "[^\\s\\d'\"()]+"}
]
}
View languageNode.json
{
"category": "s_list",
"components": [
{"category": "s_exp"}
]
}