This repository has been archived by the owner on Feb 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.mdr
118 lines (76 loc) · 1.85 KB
/
README.mdr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# MDR, a markdown runner
[![Build Status](https://travis-ci.org/fennecdjay/mdr.svg?branch=master)](https://travis-ci.org/fennecdjay/mdr)
mdr is a **small** (less than **500 Haskell SLOC** :champagne:) *program* and *markup*
designed to facilitate documentation and testing.
![logo](logoreadme.png "The Mdr logo! (WIP)")
I started it to ease [Gwion](https://github.com/fennecdjay/gwion)'s devellopment,
but it is not tied in any way to this project.
Let' walktrough... :smile:
## Hello World
let's write our first litterate progam.
### Define program structure
@``` hello_world.c
@[[Includes]]
int main(int argc, char** argv) {
@[[Print]]
}
@```
### Add Headers
As we need the *puts* function, we need **stdio** headers.
@``` Includes .c
#include <stdio.h>
@```
### Print function
@``` Print .c
puts("Hello, World!");
@```
### Compile
with this line
``` sh
@@exec cc hello_world.c -o hello_world
```
we compile *hello_world.c*.
``` sh
@exec cc hello_world.c -o hello_world
```
Yes, there should be no output, and that good news.
### Check
Let's look at hello_world.c
``` sh
@@exec cat hello_world.c
```
``` c
@exec cat hello_world.c
```
That's the content of the source file we generated (and compiled).
### Test
Then we run it
``` sh
./hello_world
```
``` sh
@exec ./hello_world
```
Do we read *Hello World!* ?
Assuming yes, let's continue.
### More test
Let's try it
```
[ "$(./hello_world)" = "Hello, World!" ] && echo "OK" || echo "NOT_OK"
```
and the result is
``` sh
@exec [ "$(./hello_world)" = "Hello, World!" ] && echo "OK" || echo "NOT_OK"
```
## Building
As a haskell programm, it seemed natural to use [cabal](https://www.haskell.org/cabal/)
as a build system.
``` sh
cabal build
```
## Installing
As easy as before, just type.
``` sh
cabal install
```
generated from [this file](https://github.com/fennecdjay/mdr/blob/master/README.mdr)