Skip to content

Commit aaf9c15

Browse files
add workflow for page deployment
1 parent 1d69303 commit aaf9c15

File tree

13 files changed

+671
-898
lines changed

13 files changed

+671
-898
lines changed

.github/workflows/hugo.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Sample workflow for building and deploying a Hugo site to GitHub Pages
2+
name: Deploy Hugo site to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches:
8+
- main
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
20+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
21+
concurrency:
22+
group: "pages"
23+
cancel-in-progress: false
24+
25+
# Default to bash
26+
defaults:
27+
run:
28+
shell: bash
29+
30+
jobs:
31+
# Build job
32+
build:
33+
runs-on: ubuntu-latest
34+
env:
35+
HUGO_VERSION: 0.134.2
36+
steps:
37+
- name: Install Hugo CLI
38+
run: |
39+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
40+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
41+
- name: Install Tree-Sitter cli
42+
run: sudo npm install -g tree-sitter-cli@0.22.6
43+
- name: Install GAWK
44+
run: sudo apt install gawk
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
with:
48+
submodules: recursive
49+
fetch-depth: 0
50+
- name: Install Node.js dependencies
51+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
52+
#- name: Fetch syntax highlighter
53+
# run: git clone https://github.com/hedyhli/tree-sitter-cognate
54+
- name: Build syntax-highlighting
55+
run: make BASEURL="${{ steps.pages.outputs.base_url }}/"
56+
- name: Setup Pages
57+
id: pages
58+
uses: actions/configure-pages@v5
59+
#- name: Build with Hugo
60+
# env:
61+
# HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
62+
# HUGO_ENVIRONMENT: production
63+
# TZ: America/Los_Angeles
64+
# run: |
65+
# hugo \
66+
# --gc \
67+
# --minify \
68+
# --baseURL "${{ steps.pages.outputs.base_url }}/"
69+
- name: Upload artifact
70+
uses: actions/upload-pages-artifact@v3
71+
with:
72+
path: ./public
73+
74+
# Deployment job
75+
deploy:
76+
environment:
77+
name: github-pages
78+
url: ${{ steps.deployment.outputs.page_url }}
79+
runs-on: ubuntu-latest
80+
needs: build
81+
steps:
82+
- name: Deploy to GitHub Pages
83+
id: deployment
84+
uses: actions/deploy-pages@v4
85+

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
AWK=awk
22
HUGO=hugo
3+
BASEURL=https://cognate-lang.github.io
34

45
.PHONY: build
56
build:
67
# NOTE: Requires gawk
7-
tree-sitter query --test scripts/doc-comments.scm prelude.cog | $(AWK) -v linkURL="https://github.com/cognate-lang/cognate/blob/master/src/" -f scripts/doc-comments.awk > content/reference/prelude.md
8-
$(HUGO)
8+
tree-sitter query --test scripts/doc-comments.scm prelude.cog --config-path tree-sitter.json | $(AWK) -v linkURL="https://github.com/cognate-lang/cognate/blob/master/src/" -f scripts/doc-comments.awk > content/reference/prelude.md
9+
$(HUGO) #--baseURL $(BASEURL)
910
make $(shell find public -type f -name "*.html")
1011

1112
public/%.html: .FORCE

public/categories/index.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1 @@
1-
2-
<!doctype html>
3-
<html>
4-
<head>
5-
<meta charset="UTF-8" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<link rel="stylesheet" href="/main.min.css" />
8-
<title>Categories</title>
9-
</head>
10-
<body>
11-
12-
<main>
13-
14-
<h1 id="title">Categories</h1>
15-
<ul>
16-
17-
</ul>
18-
19-
</main>
20-
<br /><br /><br />
21-
</body>
22-
</html>
1+
<!doctype html><html><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=wow/main.min.css><title>Categories</title></head><body><main><h1 id=title>Categories</h1><ul></ul></main><br><br><br></body></html>

public/categories/index.xml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2-
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
3-
<channel>
4-
<title>Categories on Cognate: Readable and concise concatenative programming</title>
5-
<link>https://cognate-lang.github.io/categories/</link>
6-
<description>Recent content in Categories on Cognate: Readable and concise concatenative programming</description>
7-
<generator>Hugo</generator>
8-
<language>en-us</language>
9-
<atom:link href="https://cognate-lang.github.io/categories/index.xml" rel="self" type="application/rss+xml" />
10-
</channel>
11-
</rss>
1+
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Categories on Cognate: Readable and concise concatenative programming</title><link>wow/categories/</link><description>Recent content in Categories on Cognate: Readable and concise concatenative programming</description><generator>Hugo</generator><language>en-us</language><atom:link href="wow/categories/index.xml" rel="self" type="application/rss+xml"/></channel></rss>

public/index.html

Lines changed: 56 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,56 @@
1-
2-
<!doctype html>
3-
<html>
4-
<head>
5-
<meta name="generator" content="Hugo 0.133.1">
6-
<meta charset="UTF-8" />
7-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8-
<link rel="stylesheet" href="/main.min.css" />
9-
<title>Cognate: Readable and concise concatenative programming</title>
10-
</head>
11-
<body>
12-
13-
<main>
14-
15-
<h1 id="cognate">Cognate</h1>
16-
<h2 id="readable-and-concise-concatenative-programming">Readable and concise concatenative programming</h2>
17-
<div class="code"><pre><code><span style='font-style: italic;color: #969896'>~~ Fizzbuzz in Cognate</span>
18-
19-
<span style='color: #0086b3'>Def</span> <span style='color: #795da3'>Multiple</span> <span style='color: #333333'>as</span> <span style='color: #4e4e4e'>(</span><span style='color: #183691'>Zero?</span> <span style='color: #183691'>Modulo</span><span style='color: #4e4e4e'>)</span>;
20-
21-
<span style='color: #0086b3'>Def</span> <span style='color: #795da3'>Fizzbuzz</span>
22-
<span style='color: #a71d5d'>Case</span> <span style='color: #4e4e4e'>(</span><span style='color: #795da3'>Multiple</span> <span style='color: #333333'>of</span> <span style='color: #0086b3'>15</span><span style='color: #4e4e4e'>)</span> <span style='color: #333333'>is</span> <span style='color: #183691'>&quot;fizzbuzz&quot;</span>
23-
<span style='color: #a71d5d'>Case</span> <span style='color: #4e4e4e'>(</span><span style='color: #795da3'>Multiple</span> <span style='color: #333333'>of</span> <span style='color: #0086b3'>3</span><span style='color: #4e4e4e'>)</span> <span style='color: #333333'>is</span> <span style='color: #183691'>&quot;fizz&quot;</span>
24-
<span style='color: #a71d5d'>Case</span> <span style='color: #4e4e4e'>(</span><span style='color: #795da3'>Multiple</span> <span style='color: #333333'>of</span> <span style='color: #0086b3'>5</span><span style='color: #4e4e4e'>)</span> <span style='color: #333333'>is</span> <span style='color: #183691'>&quot;buzz&quot;</span>
25-
<span style='color: #333333'>otherwise</span> <span style='color: #4e4e4e'>(</span><span style='color: #4e4e4e'>)</span>;
26-
27-
<span style='color: #a71d5d'>For</span> <span style='color: #333333'>each</span> <span style='color: #333333'>in</span> <span style='color: #183691'>Range</span> <span style='color: #0086b3'>1</span> <span style='color: #333333'>to</span> <span style='color: #0086b3'>100</span> <span style='color: #4e4e4e'>(</span><span style='color: #183691'>Print</span> <span style='color: #795da3'>Fizzbuzz</span><span style='color: #4e4e4e'>)</span>
28-
</code></pre></div><p>Cognate is a project aiming to create a human readable programming language with as little syntax as possible. Where natural language programming usually uses many complex syntax rules, instead Cognate takes them away. What it adds is simple, a way to embed comments into statements.</p>
29-
<div class="code"><pre><code><span style='font-style: italic;color: #969896'>~~ Towers of Hanoi in Cognate</span>
30-
31-
<span style='color: #0086b3'>Def</span> <span style='color: #795da3'>Move</span> <span style='color: #333333'>discs</span> <span style='color: #333333'>as</span> <span style='color: #4e4e4e'>(</span>
32-
33-
<span style='color: #0086b3'>Let</span> <span style='color: #795da3'>N</span> <span style='color: #333333'>be</span> <span style='color: #333333'>number</span> <span style='color: #333333'>of</span> <span style='color: #333333'>discs</span>;
34-
<span style='color: #0086b3'>Let</span> <span style='color: #795da3'>A</span> <span style='color: #333333'>be</span> <span style='color: #333333'>first</span> <span style='color: #333333'>rod</span>;
35-
<span style='color: #0086b3'>Let</span> <span style='color: #795da3'>B</span> <span style='color: #333333'>be</span> <span style='color: #333333'>second</span> <span style='color: #333333'>rod</span>;
36-
<span style='color: #0086b3'>Let</span> <span style='color: #795da3'>C</span> <span style='color: #333333'>be</span> <span style='color: #333333'>third</span> <span style='color: #333333'>rod</span>;
37-
38-
<span style='color: #a71d5d'>Unless</span> <span style='color: #183691'>Zero?</span> <span style='color: #795da3'>N</span> <span style='color: #4e4e4e'>(</span>
39-
<span style='color: #795da3'>Move</span> <span style='font-weight: bold;color: #4e4e4e'>-</span> <span style='color: #0086b3'>1</span> <span style='color: #795da3'>N</span> <span style='color: #333333'>discs</span> <span style='color: #333333'>from</span> <span style='color: #795da3'>A</span> <span style='color: #333333'>via</span> <span style='color: #795da3'>C</span> <span style='color: #333333'>to</span> <span style='color: #795da3'>B</span>;
40-
<span style='color: #183691'>Prints</span> <span style='color: #4e4e4e'>(</span><span style='color: #183691'>&quot;Move disc &quot;</span> <span style='color: #795da3'>N</span> <span style='color: #183691'>&quot; from &quot;</span> <span style='color: #795da3'>A</span> <span style='color: #183691'>&quot; to &quot;</span> <span style='color: #795da3'>C</span><span style='color: #4e4e4e'>)</span>;
41-
<span style='color: #795da3'>Move</span> <span style='font-weight: bold;color: #4e4e4e'>-</span> <span style='color: #0086b3'>1</span> <span style='color: #795da3'>N</span> <span style='color: #333333'>discs</span> <span style='color: #333333'>from</span> <span style='color: #795da3'>B</span> <span style='color: #333333'>via</span> <span style='color: #795da3'>A</span> <span style='color: #333333'>to</span> <span style='color: #795da3'>C</span>;
42-
<span style='color: #4e4e4e'>)</span>
43-
<span style='color: #4e4e4e'>)</span>;
44-
45-
<span style='color: #795da3'>Move</span> <span style='color: #0086b3'>5</span> <span style='color: #333333'>discs</span> <span style='color: #333333'>from</span> <span style='color: #183691'>&quot;a&quot;</span> <span style='color: #333333'>via</span> <span style='color: #183691'>&quot;b&quot;</span> <span style='color: #333333'>to</span> <span style='color: #183691'>&quot;c&quot;</span>
46-
</code></pre></div><p>As you can see, Cognate ignores words starting with lowercase letters, allowing them to be used to describe functionality and enhance readability. This makes Cognate codebases intuitive and maintainable.</p>
47-
<div class="code"><pre><code><span style='font-style: italic;color: #969896'>~~ Square numbers in Cognate</span>
48-
49-
<span style='color: #0086b3'>Def</span> <span style='color: #795da3'>Square</span> <span style='color: #333333'>as</span> <span style='color: #4e4e4e'>(</span><span style='font-weight: bold;color: #4e4e4e'>*</span> <span style='color: #183691'>Twin</span><span style='color: #4e4e4e'>)</span>;
50-
<span style='color: #183691'>Map</span> <span style='color: #4e4e4e'>(</span><span style='color: #795da3'>Square</span><span style='color: #4e4e4e'>)</span> <span style='color: #333333'>over</span> <span style='color: #183691'>Range</span> <span style='color: #0086b3'>1</span> <span style='color: #333333'>to</span> <span style='color: #0086b3'>10</span>;
51-
<span style='color: #183691'>Print</span>
52-
</code></pre></div><p>Cognate is a stack-oriented programming language similar to Forth or Factor, except statements are evaluated right to left. This gives the expressiveness of concatenative programming as well as the readability of prefix notation. Statements can be delimited at arbitrary points, allowing them to read as sentences would in English.</p>
53-
<div class="code"><pre><code><span style='font-style: italic;color: #969896'>~~ Prime numbers in Cognate</span>
54-
55-
<span style='color: #0086b3'>Def</span> <span style='color: #795da3'>Factor</span> <span style='color: #4e4e4e'>(</span><span style='color: #183691'>Zero?</span> <span style='color: #183691'>Modulo</span> <span style='color: #183691'>Swap</span><span style='color: #4e4e4e'>)</span>;
56-
57-
<span style='color: #0086b3'>Def</span> <span style='color: #795da3'>Primes</span> <span style='color: #4e4e4e'>(</span>
58-
<span style='color: #0086b3'>Let</span> <span style='color: #795da3'>U</span> <span style='color: #333333'>is</span> <span style='color: #333333'>upper</span> <span style='color: #333333'>bound</span>;
59-
<span style='color: #333333'>initially</span> <span style='color: #794da3'>List</span> <span style='color: #4e4e4e'>(</span><span style='color: #4e4e4e'>)</span>;
60-
<span style='color: #a71d5d'>For</span> <span style='color: #183691'>Range</span> <span style='color: #0086b3'>2</span> <span style='color: #333333'>to</span> <span style='color: #795da3'>U</span> <span style='color: #4e4e4e'>(</span>
61-
<span style='color: #0086b3'>Let</span> <span style='color: #795da3'>P</span> <span style='color: #333333'>is</span> <span style='color: #333333'>potential</span> <span style='color: #333333'>prime</span>;
62-
<span style='color: #0086b3'>Let</span> <span style='color: #795da3'>Found</span> <span style='color: #333333'>be</span> <span style='color: #333333'>list</span> <span style='color: #333333'>of</span> <span style='color: #333333'>found</span> <span style='color: #333333'>primes</span>;
63-
<span style='color: #0086b3'>Let</span> <span style='color: #795da3'>To-check</span> <span style='color: #333333'>be</span> <span style='color: #a71d5d'>Take-while</span> <span style='color: #4e4e4e'>(</span><span style='font-weight: bold;color: #4e4e4e'>&lt;=</span> <span style='color: #183691'>Sqrt</span> <span style='color: #795da3'>P</span><span style='color: #4e4e4e'>)</span> <span style='color: #795da3'>Found</span>;
64-
<span style='color: #a71d5d'>When</span> <span style='color: #183691'>All</span> <span style='color: #4e4e4e'>(</span><span style='font-weight: bold;color: #4e4e4e'>Not</span> <span style='color: #795da3'>Factor</span> <span style='color: #333333'>of</span> <span style='color: #795da3'>P</span><span style='color: #4e4e4e'>)</span> <span style='color: #795da3'>To-check</span> <span style='color: #4e4e4e'>(</span>
65-
<span style='color: #183691'>Append</span> <span style='color: #795da3'>P</span>
66-
<span style='color: #4e4e4e'>)</span> <span style='color: #333333'>to</span> <span style='color: #795da3'>Found</span>
67-
<span style='color: #4e4e4e'>)</span>
68-
<span style='color: #4e4e4e'>)</span>;
69-
70-
<span style='color: #183691'>Print</span> <span style='color: #795da3'>Primes</span> <span style='color: #333333'>up</span> <span style='color: #333333'>to</span> <span style='color: #0086b3'>1000</span>;
71-
</code></pre></div><p>Cognate borrows from other concatenative languages, but also adds unique features of its own.</p>
72-
<ul>
73-
<li>Point-free functions</li>
74-
<li>Operation chaining</li>
75-
<li>Multiple return values</li>
76-
<li>Combinator oriented programming</li>
77-
<li>Predicate pattern matching</li>
78-
<li>Natural language programming</li>
79-
</ul>
80-
<p>Interested? Read the <a href="/learn/">tutorial</a>, check out the <a href="https://cognate-playground.hedy.dev/">interactive web playground</a>, or visit our <a href="https://github.com/cognate-lang/cognate">GitHub repository</a>.</p>
81-
82-
83-
</main>
84-
<br /><br /><br />
85-
</body>
86-
</html>
1+
<!doctype html><html><head><meta name=generator content="Hugo 0.130.0"><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=wow/main.min.css><title>About</title></head><body><main><h1 id=cognate>Cognate</h1><h2 id=readable-and-concise-concatenative-programming>Readable and concise concatenative programming</h2><div class=code><pre><code>
2+
~~ Fizzbuzz in Cognate
3+
4+
Def Multiple as (Zero? Modulo);
5+
6+
Def Fizzbuzz
7+
Case (Multiple of 15) is "fizzbuzz"
8+
Case (Multiple of 3) is "fizz"
9+
Case (Multiple of 5) is "buzz"
10+
otherwise ();
11+
12+
For each in Range 1 to 100 (Print Fizzbuzz)
13+
</code></pre></div><p>Cognate is a project aiming to create a human readable programming language with as little syntax as possible. Where natural language programming usually uses many complex syntax rules, instead Cognate takes them away. What it adds is simple, a way to embed comments into statements.</p><div class=code><pre><code>
14+
~~ Towers of Hanoi in Cognate
15+
16+
Def Move discs as (
17+
18+
Let N be number of discs;
19+
Let A be first rod;
20+
Let B be second rod;
21+
Let C be third rod;
22+
23+
Unless Zero? N (
24+
Move - 1 N discs from A via C to B;
25+
Prints ("Move disc " N " from " A " to " C);
26+
Move - 1 N discs from B via A to C;
27+
)
28+
);
29+
30+
Move 5 discs from "a" via "b" to "c"
31+
</code></pre></div><p>As you can see, Cognate ignores words starting with lowercase letters, allowing them to be used to describe functionality and enhance readability. This makes Cognate codebases intuitive and maintainable.</p><div class=code><pre><code>
32+
~~ Square numbers in Cognate
33+
34+
Def Square as (* Twin);
35+
Map (Square) over Range 1 to 10;
36+
Print
37+
</code></pre></div><p>Cognate is a stack-oriented programming language similar to Forth or Factor, except statements are evaluated right to left. This gives the expressiveness of concatenative programming as well as the readability of prefix notation. Statements can be delimited at arbitrary points, allowing them to read as sentences would in English.</p><div class=code><pre><code>
38+
~~ Prime numbers in Cognate
39+
40+
Def Factor (Zero? Modulo Swap);
41+
42+
Def Primes (
43+
Let U is upper bound;
44+
initially List ();
45+
For Range 2 to U (
46+
Let P is potential prime;
47+
Let Found be list of found primes;
48+
Let To-check be Take-while (<= Sqrt P) Found;
49+
When All (Not Factor of P) To-check (
50+
Append P
51+
) to Found
52+
)
53+
);
54+
55+
Print Primes up to 1000;
56+
</code></pre></div><p>Cognate borrows from other concatenative languages, but also adds unique features of its own.</p><ul><li>Point-free functions</li><li>Operation chaining</li><li>Multiple return values</li><li>Combinator oriented programming</li><li>Predicate pattern matching</li><li>Natural language programming</li></ul><p>Interested? Read the <a href=/learn/>tutorial</a>, check out the <a href=https://cognate-playground.hedy.dev/>interactive web playground</a>, or visit our <a href=https://github.com/cognate-lang/cognate>GitHub repository</a>.</p></main><br><br><br></body></html>

0 commit comments

Comments
 (0)