This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Super simple "compiler" that uses OpenAI's Codex model. | |
# The Codex API was free before being discontinued on March 23, 2023. | |
# | |
# Usage: | |
# ./codex_compiler.sh input_file > out | |
# | |
# Requirements: | |
# - OpenAI API key (set the environment variable OPENAI_API_KEY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ca.uwaterloo.flix | |
import ca.uwaterloo.flix.api.{Flix, InvokableUnsafe, WrappedType} | |
import ca.uwaterloo.flix.language.ast.Type | |
import ca.uwaterloo.flix.runtime.{Model, Value} | |
object BugRepro { | |
// To run this repro: | |
// Drop this file in main/src/ca/uwaterloo/flix/BugRepro.scala |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.language.higherKinds | |
// https://apocalisp.wordpress.com/2009/09/02/more-scala-typehackery/ | |
// http://scala-lang.org/blog/2016/02/17/scaling-dot-soundness.html | |
// There is a proposed fix to disallow this, but there may be other ways to | |
// get Turing-completeness. | |
trait Lambda { | |
type subst[U <: Lambda] <: Lambda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
inkscape --export-png="poster.png" poster.svg | |
inkscape --export-png="poster00.png" --export-area=0:0:900:675 --export-dpi=300 poster.svg | |
inkscape --export-png="poster01.png" --export-area=900:0:1800:675 --export-dpi=300 poster.svg | |
inkscape --export-png="poster02.png" --export-area=1800:0:2700:675 --export-dpi=300 poster.svg | |
inkscape --export-png="poster03.png" --export-area=2700:0:3600:675 --export-dpi=300 poster.svg | |
inkscape --export-png="poster04.png" --export-area=3600:0:4320:675 --export-dpi=300 poster.svg | |
inkscape --export-png="poster10.png" --export-area=0:675:900:1350 --export-dpi=300 poster.svg | |
inkscape --export-png="poster11.png" --export-area=900:675:1800:1350 --export-dpi=300 poster.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AST: | |
def f: Int = | |
match () with { _ => 11 } | |
SAST: | |
def f: Int = | |
let matchVar1 = () in | |
let case2 = λ() -> MatchError in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* B. C. Pierce, Types and Programming Languages. MIT Press, 2002, ch. 22, sec 7. *) | |
(* This progam is well typed, but demonstrates worst-case exponential time of the typechecker. *) | |
(* In practice, typechecking takes linear time. *) | |
let f0 = fun x -> (x,x) in | |
let f1 = fun y -> f0(f0 y) in | |
let f2 = fun y -> f1(f1 y) in | |
let f3 = fun y -> f2(f2 y) in | |
let f4 = fun y -> f3(f3 y) in | |
let f5 = fun y -> f4(f4 y) in | |
f5 (fun z -> z) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Online Graphviz: http://webgraphviz.com/ | |
// https://i.imgur.com/NHmoDnj.png | |
digraph g{ | |
node [shape="box",style=rounded]; | |
"a.out" -> "C.o" | |
"a.out" -> "B.o" | |
"a.out" -> "A.o" | |
"C.o" -> "C.cpp" | |
"B.o" -> "B.cpp" |