Skip to content

Instantly share code, notes, and snippets.

View kleczkowski's full-sized avatar

Konrad Kleczkowski kleczkowski

  • Standard Chartered Bank
  • Warsaw, Poland
  • 17:22 (UTC +02:00)
View GitHub Profile
import Control.Monad (liftM, ap)
newtype Parser a = P (String -> [(a, String)])
doParse :: Parser a -> String -> [(a, String)]
doParse (P p) input = p input
instance Functor Parser where
fmap = liftM
@kleczkowski
kleczkowski / bfck.c
Last active August 22, 2016 23:12
Simple Brainfuck interpreter as fuck.
#include <stdio.h>
#include <stdlib.h>
void interpret(const char *code);
int main(int argc, char **argv) {
char *file_contents;
long input_file_size;
FILE *input_file;
/*
* MIT License
*
* Copyright (c) 2017 Konrad Kleczkowski
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
/*
* MIT License
*
* Copyright (c) 2017 Konrad Kleczkowski
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
/*
* MIT License
*
* Copyright (c) 2017 Konrad Kleczkowski
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
/*
* MIT License
*
* Copyright (c) 2017 Konrad Kleczkowski
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
/*
* MIT License
*
* Copyright (c) 2017 Konrad Kleczkowski
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@kleczkowski
kleczkowski / multi-module-pom.xml
Created February 1, 2018 14:10
Example POM for multi-module Maven projects in Java 9
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.repaj.my-project</groupId>
<artifactId>my-project</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
grammar SimpleImperativeLanguage;
@lexer::header {
package com.github.repaj.glang;
}
@parser::header {
package com.github.repaj.glang;
import java.lang.*;
-- |
-- Module : HsEmu.Core.Machine
-- Copyright : Konrad Kleczkowski 2019
-- License : BSD3
--
-- Maintainer : konrad.kleczkowski@gmail.com
-- Stability : experimental
-- Portability : unknown
--
-- Provides the monadic stack to preform computations