Skip to content
This repository has been archived by the owner on Feb 28, 2020. It is now read-only.

Latest commit

 

History

History
121 lines (78 loc) · 1.76 KB

README.md

File metadata and controls

121 lines (78 loc) · 1.76 KB

MDR, a markdown runner

Build Status

mdr is a small (less than 500 Haskell SLOC 🍾) program and markup designed to facilitate documentation and testing.

logo

I started it to ease Gwion's devellopment, but it is not tied in any way to this project.

Let' walktrough... 😄

Hello World

let's write our first litterate progam.

Define program structure

@[[Includes]]

int main(int argc, char** argv) {
  @[[Print]]
}

Add Headers

As we need the puts function, we need stdio headers.

#include <stdio.h>

Print function

puts("Hello, World!");

Compile

with this line

@exec cc hello_world.c -o hello_world

we compile hello_world.c.

Yes, there should be no output, and that good news.

Check

Let's look at hello_world.c

@exec cat hello_world.c
#include <stdio.h>

int main(int argc, char** argv) {
  puts("Hello, World!");
}

That's the content of the source file we generated (and compiled).

Test

Then we run it

./hello_world
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

OK

Building

As a haskell programm, it seemed natural to use cabal as a build system.

cabal build

Installing

As easy as before, just type.

cabal install

generated from this file