Skip to content

Commit

Permalink
Add initial files 😁
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhodgins committed Oct 4, 2017
1 parent ed12628 commit f0f195c
Show file tree
Hide file tree
Showing 8 changed files with 1,465 additions and 2 deletions.
130 changes: 128 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,128 @@
# bil
Basic Instruction Language
# BIL ➸ Basic Instruction Language

## What is BIL?

BIL is a superset of [HTML](https://w3c.github.io/html) that adds twelve new tags and uses doctype of `<!DOCTYPE bil>`.


## Why use BIL?

BIL attempts to bridge the gap between natural languages like english, and more structured forms of language like [computer programming languages](https://en.wikipedia.org/wiki/Programming_language), [legalese](https://en.wikipedia.org/wiki/Legal_English), and [forms](https://en.wikipedia.org/wiki/Form_%28document%29).

The challenge is to reduce ambiguity in written instructions by introducing additional markup and information about the parts of speech used, and to adhere to a consistent contextual structure for illustrating the relationships between the words.

The goal is to arrive at an instruction language that acts both as a superset of HTML as well as a simplified subset of the natural language you are marking up as BIL. The aim is to present information in a way that a reader of the same natural language who has never seen BIL can understand it with a minimal learning curve to replace confusing instructions, verbose language, and ambiguous phrasing.


## BIL Reference

### Words

- child of: any word tag, `<block>`, or `<phrase>`
- parent of: any word tag, or `<block>`

Words are the elementary building blocks of BIL. You may nest word tags inside of each other infinitely deep (this is called putting words 'in the context of' another word) and this context-based nesting is the core idea of BIL.

#### Noun

- attribute(s): `proper`

A `<noun>` tag wraps any noun or proper noun. Nouns are analogous to _generic objects_ in programming language.

The `proper` attribute can be added to signify a proper noun. This is analogous to a _named variable_ in a programming language.

#### Verb

A `<verb>` tag wraps any verb, action, or set of actions. Verbs are analogous to _functions_ in a programming language.

#### Number

A `<number>` tag wraps any numeric value.

#### Adjective

An `<adjective>` tag wraps any adjective. These are analogous to _properties_ or _attributes_ in a programming language.

#### Pronoun

A `<pronoun>` tag wraps any pronoun. These address specific instances of nouns based on context.

#### Preposition

A `<preposition>` tag wraps any preposition. These usually refer to the directionality, location, orientation, or state in which a verb or noun exists.

#### Adverb

An `<adverb>` tag wraps any adverb. When used to modify verbs adverbs are analogous to _function arguments_ in programming languages.

#### Conjunction

A `<conjunction>` tag wraps any conjunction. Conjunctions are analogous to a lot of logical keywords like `if` and `while`.

#### Interjection

An `<interjection>` tag wraps any interjection.


### Grouping Operators

#### Block

- child of: `<context>`
- parent of: any word tags, and `<context>`

A `<block>` tag is a grouping operator containing one or more words and a `<context>` tag

#### Context

- child of: `<block>`
- parent of: any word tags, and `<phrase>`

A `<context>` tag is a grouping operator containing `<phrase>` tags and and/or `<block>` tags.

#### Phrase

A `<phrase>` tag is a grouping operator containing multiple word tags.


## How to write BIL

Always begin a BIL document with a containing `<block>` tag:

```html
<block></block>
```

This containing block may contain one or more word tags, plus a `<context>` tag. This block is a `<noun>` block and will contain more words that define something in the context of a `<noun>` called 'BIL example':

```html
<block>
<noun>BIL example</noun>
<context></context>
</block>
```

This `<context>` tag may contain one or more word tags, more `<block>` tags, or if there are multiple separate groupings of word tags each of these gropuings can be wrapped in `<phrase>` tags:

```html
<block>
<noun>BIL example</noun>
<context>
<phrase><verb>demo <noun>item 1</noun></verb></phrase>
<phrase><verb>demo <noun>item 2</noun></verb></phrase>
</context>
</block>
```

Here we could say that the `<noun>` 'item 1' is in the context of the `<verb>` 'demo', to demonstrate. We could also say that doing something with 'item 1' and 'item 2' are in the context of a `<noun>` called 'BIL example'.

## BIL Demos

- [How to decide which browser versions to support](examples/bil-browser.html)
- [How to make a Vegan Iced Mocha](examples/bil-mocha.html)
- [How to Make a S'more](examples/bil-smore.html)
- [How to Make a Static HTML Website](examples/bil-static.html)
- [How to Extract Audio from Youtube Videos](examples/bil-youtube.html)


> Made with &hearts; by [@innovati](https://twitter.com/innovati)
54 changes: 54 additions & 0 deletions examples/bil-browser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!DOCTYPE bil>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1">
<script src=../interpreter/bil.js></script>
<title>How to decide which browser versions to support</title>

<h1>How to decide which browser versions to support</h1>
<h2>in Basic Instruction Language</h2>

<h3>Prose</h3>

<p>For each browser version, the revenue per user is the total revenue divided by the total users.</p>
<p>The potential profit is the revenue per user multiplied by the users of this browser version.</p>
<p>The labour cost is the hourly rate multiplied by the estimated hours to support this browser version.</p>
<p>If the potential profit is greater than the labour cost, support this browser version.</p>

<h3>Syntax</h3>

<p><preposition>For</preposition> <pronoun>each</pronoun> <noun>browser</noun> <number>version</number>, the <number>revenue per user</number> is the <number>total revenue</number> <verb>divided</verb> <preposition>by</preposition> the <number>total users</number>.</p>
<p>The <number>potential profit</number> is the <number>revenue per user</number> <verb>multiplied</verb> <preposition>by</preposition> the <number>users</number> of <pronoun>this</pronoun> <noun>browser</noun> <number>version</number>.</p>
<p>The <number>labour cost</number> is the <number>hourly rate</number> <verb>multiplied</verb> <preposition>by</preposition> the <verb>estimated</verb> <number>hours</number> <preposition>to</preposition> <verb>support</verb> <pronoun>this</pronoun> <noun>browser</noun> <number>version</number>.</p>
<p><conjunction>If</conjunction> the <number>potential profit</number> is <verb>greater</verb> <preposition>than</preposition> the <number>labour cost</number>, <verb>support</verb> <pronoun>this</pronoun> <noun>browser</noun> <number>version</number>.</p>

<h3>BIL</h3>

<block>
<preposition>for <pronoun>each <noun>browser <number>version</number></noun></pronoun></preposition>
<context>
<block>
<number>revenue per user</number>
<context>
<phrase><verb>divide <number>total revenue</number> <preposition>by</preposition> <number>total users</number></verb></phrase>
</context>
</block>
<block>
<number>potential profit</number>
<context>
<phrase><verb>multiply <number>revenue per user</number> <preposition>by</preposition> <pronoun>this <noun>browser <number>version <number>users</number></number></noun></pronoun></verb></phrase>
</context>
</block>
<block>
<number>labour cost</number>
<context>
<phrase><verb>multiply <number>hourly rate</number> <preposition>by</preposition> <verb>estimate <number>hours</number> <preposition>to</preposition> <verb>support <pronoun>this <noun>browser <number>version</number></noun></pronoun></verb></verb></verb></phrase>
</context>
</block>
<block>
<conjunction>if <verb>greater <number>potential profit</number> <preposition>than</preposition> <number>labour cost</number></verb></conjunction>
<context>
<phrase><verb>support <pronoun>this <noun>browser <number>version</number></noun></pronoun></verb></phrase>
</context>
</block>
</context>
</block>
49 changes: 49 additions & 0 deletions examples/bil-mocha.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE bil>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1">
<script src=../interpreter/bil.js></script>
<title>How to make a Vegan Iced Mocha</title>

<h1>How to make a Vegan Iced Mocha</h1>
<h2>in Basic Instruction Language</h2>

<h3>Prose</h3>

<p>How to make a vegan iced mocha.</p>
<p>For materials you will need a cup, a spoon, 250 ml of chocolate almond milk, and 250 ml of iced coffee.</p>
<p>The instructions are to put the milk and coffee inside the cup and mix with the spoon for 15 seconds.</p>

<h3>Syntax</h3>

<p>How to <verb>make</verb> a <adjective>vegan</adjective> <adjective>iced</adjective> <noun>mocha</noun>.</p>
<p>For <noun>materials</noun> you will need a <noun>cup</noun>, a <noun>spoon</noun>, <number>250 ml</number> of <adjective>chocolate</adjective> <adjective>almond</adjective> <noun>milk</noun>, and <number>250 ml</number> of <adjective>iced</adjective> <noun>coffee</noun>.</p>
<p>The <noun>instructions</noun> are to <verb>put</verb> the <noun>milk</noun> <conjunction>and</conjunction> <noun>coffee</noun> <preposition>inside</preposition> the <noun>cup</noun> and <verb>mix</verb> <preposition>with</preposition> the <noun>spoon</noun> for <number>15 seconds</number>.</p>

<h3>BIL</h3>

<block>
<noun>mocha <adjective>vegan</adjective> <adjective>iced</adjective></noun>
<context>
<block>
<verb>make</verb>
<context>
<block>
<noun>materials</noun>
<context>
<phrase><noun>cup</noun></phrase>
<phrase><noun>spoon</noun></phrase>
<phrase><noun>milk <adjective>almond</adjective> <adjective>chocolate</adjective> <number>250 ml</number></noun></phrase>
<phrase><noun>coffee <adjective>iced</adjective> <number>250 ml</number></noun></phrase>
</context>
</block>
<block>
<noun>instructions</noun>
<context>
<phrase><verb>put <noun>milk</noun> <conjunction>and</conjunction> <noun>coffee</noun> <preposition>inside</preposition> <noun>cup</noun></verb></phrase>
<phrase><verb>mix <preposition>with</preposition> <noun>spoon</noun> <number>15 seconds</number></verb></phrase>
</context>
</block>
</context>
</block>
</context>
</block>
77 changes: 77 additions & 0 deletions examples/bil-smore.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!DOCTYPE bil>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1">
<script src=../interpreter/bil.js></script>
<title>How to Make a S'more</title>

<h1>How to Make a S'more</h1>
<h2>in Basic Instruction Language</h2>

<h3>Prose</h3>

<p>How to make a s'more.</p>
<p>For materials you'll need a fire, a skewer, and the following ingredients: a marshmallow, 2 graham crackers, and 2 chocolate wafers.</p>
<p>Instructions: To make the bottom layer put 2 chocolate wafers on a graham cracker. Then put the skewer inside the middle of the marshmallow. Next put the skewer near the fire. Rotate the skewer slowly until the marshmallow's color is equal to golden brown. Then remove the skewer from the fire and put the skewer on the bottom layer. Finally put the graham cracker on top of the marshmallow and remove the skewer from the marshmallow.</p>

<h3>Syntax</h3>

<p>How to <verb>make</verb> a <noun>s'more</noun>.</p>
<p>For <noun>materials</noun> you'll need a <noun>fire</noun>, a <noun>skewer</noun>, and the following <noun>ingredients</noun>: a <noun>marshmallow</noun>, <number>2</number> <noun>graham crackers</noun>, and <number>2</number> <noun>chocolate wafers</noun>.</p>
<p><noun>Instructions</noun>: To <verb>make</verb> the <noun>bottom layer</noun> <verb>put</verb> <number>2</number> <noun>chocolate wafers</noun> <preposition>on</preposition> a <noun>graham cracker</noun>. Then <verb>put</verb> the <noun>skewer</noun> <preposition>inside</preposition> the <adjective>middle</adjective> of the <noun>marshmallow</noun>. Next <verb>put</verb> the <noun>skewer</noun> <preposition>near</preposition> the <noun>fire</noun>. <verb>Rotate</verb> the <noun>skewer</noun> <adverb>slowly</adverb> <preposition>until</preposition> the <noun>marshmallow's</noun> <adjective>color</adjective> is <verb>equal</verb> <preposition>to</preposition> <adjective>golden brown</adjective>. Then <verb>remove</verb> the <noun>skewer</noun> <preposition>from</preposition> the <noun>fire</noun> and <verb>put</verb> the <noun>skewer</noun> <preposition>on</preposition> the <noun>bottom layer</noun>. Finally <verb>put</verb> the <noun>graham cracker</noun> <preposition>on</preposition> top of the <noun>marshmallow</noun> and <verb>remove</verb> the <noun>skewer</noun> <preposition>from</preposition> the <noun>marshmallow</noun>.</p>

<h3>BIL</h3>

<block>
<noun>s'more</noun>
<context>
<block>
<verb>make</verb>
<context>
<block>
<noun>materials</noun>
<context>
<phrase><noun>fire</noun></phrase>
<phrase><noun>skewer</noun></phrase>
<block>
<noun>ingredients</noun>
<context>
<phrase><noun>marshmallow</noun></phrase>
<phrase><noun>graham cracker <number>2</number></noun></phrase>
<phrase><noun>chocolate wafer <number>2</number></noun></phrase>
</context>
</block>
</context>
</block>
<block>
<noun>instructions</noun>
<context>
<block>
<noun>bottom layer</noun>
<context>
<block>
<verb>make</verb>
<context>
<phrase><verb>put <noun>chocolate wafer <number>2</number></noun> <preposition>on</preposition> <noun>graham cracker</noun></verb></phrase>
</context>
</block>
</context>
</block>
<phrase><noun>bottom layer <verb>make</verb></noun></phrase>
<phrase><verb>put <noun>skewer</noun> <preposition>inside</preposition> <noun>marshmallow <adjective>middle</adjective></noun></verb></phrase>
<phrase><verb>put <noun>skewer</noun> <preposition>near</preposition> <noun>fire</noun></verb></phrase>
<block>
<preposition>until <verb>equal <noun>marshmallow <adjective>color</adjective></noun> <preposition>to</preposition> <adjective>golden brown</adjective></verb></preposition>
<context>
<phrase><verb>rotate <noun>skewer</noun> <adverb>slowly</adverb></verb></phrase>
</context>
</block>
<phrase><verb>remove <noun>skewer</noun> <preposition>from</preposition> <noun>fire</noun></verb></phrase>
<phrase><verb>put <noun>skewer</noun> <preposition>on</preposition> <noun>bottom layer</noun></verb></phrase>
<phrase><verb>put <noun>graham cracker</noun> <preposition>on</preposition> <noun>marshmallow</noun></verb></phrase>
<phrase><verb>remove <noun>skewer</noun> <preposition>from</preposition> <noun>marshmallow</noun></verb></phrase>
</context>
</block>
</context>
</block>
</context>
</block>
Loading

0 comments on commit f0f195c

Please sign in to comment.