Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE LambdaCase #-}
module Main where
program = drawingOf(codeWorldLogo)
testLayout1 = l1 +1
-- Open 2 nested contexts
where l1 = l2 + l3
l2 = 2
@nixorn
nixorn / index.html
Last active March 7, 2019 14:06
Sample of chevrotain based haskell lexer with indent support (poorly tested)
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
</head>
<body>
<div>
Input:
<textarea id="in" name="input" cols="40" rows="3""></textarea>
<button onclick="lex()"> Parse </button>
</div>
@nixorn
nixorn / moo.html
Last active March 6, 2019 12:43
Moo haskell ident sample(mostly stolen from https://gist.github.com/nathan/d8d1adea38a1ef3a6d6a06552da641aa)
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
</head>
<body>
<script type="text/javascript" src="./moo.js"> </script>
<script type="text/javascript">
const lexer = moo.compile({
plus: "+",
@nixorn
nixorn / test.hs
Last active March 9, 2019 12:14
Test programm to check parser for https://github.com/google/codeworld/issues/798
program = drawingOf(codeWorldLogo)
testIndent i = t1 i
where t1 i = 2 + t2 i
where t2 i = (t3 i) ** 2
where t3 i = i - 3
testIndent 0 = 5
pic1,pic2 :: Picture