Giter VIP home page Giter VIP logo

ekdohibs / joujou Goto Github PK

View Code? Open in Web Editor NEW
86.0 86.0 4.0 521 KB

A compiler from a small functional language to C. Especially features algebraic effects and handlers with multishot continuations, and a static type system with inference of types and effects, with subtyping.

License: Apache License 2.0

OCaml 88.13% Makefile 0.63% Standard ML 0.30% C 4.38% TeX 6.56%
algebraic-effects compiler continuations functional-programming handlers type-inference

joujou's People

Contributors

ekdohibs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

joujou's Issues

Fatal error: exception Stack overflow

effect get = Get : int
effect set = Set : int -> int

let test_state = fun x ->
  let _ = print 0 in
  let _ = print Get in
  let _ = Set 42 in
  let _ = print Get in
  let _ = print Get in
  let _ = print Get in
  let _ = Set 12 in
  let _ = print (Set 17) in
  let _ = print 213812 in
  print Get

let run_state = fun f ->
  match f 0 with
  | x -> fun s -> x
  | effect Get k -> fun s -> k s
  | effect Set s k -> fun _ -> k 0

let _ = let zz = run_state test_state 23 in print zz

Oops! A nonexistent case has been taken

effect exit = Exit : int;;
type unit = Tt;;
type ('a, !r) typ = T of (unit -[exit | !r]-> 'a -[!r]-> 'a);;
type ('a, !r) typ2 = T2 of (unit -[!r]-> 'a -[!r]-> 'a);;

effect test2 = Test : int;;

let g = fun m ->
  let w = fun x -> match x with Tt -> let n = ifzero m then Test else Exit in fun z -> ifzero n then z else z+1 in
  let ww = T w in
  ww

let g1 = fun m -> match (match g m with | T w -> w Tt) with effect Test k -> k 8 | effect Exit k -> k 0 | z -> z;;

let _ =
  match (
  let _ = print (g1 0 18) in
  print (g1 1 18)) with
  effect Test k -> k 990
  | z -> z

let f =
  let w = fun x -> match x with Tt -> let n = Test in fun z -> ifzero n then z else z in
  let ww = T w in
  let yolo = fun z ->
  let aux = fun t -> match t with T g -> 0 in
  let aux2 = fun t2 -> match t2 with T2 g -> aux (T g) in
  z 0 in
  0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.