Juniper
Concurrency
on 2KB of RAM
Version 4.0.0

Functional Reactive Programming for the Arduino

Lightweight and Effective

Not only does functional programming allow for strong scalability of compact, readable and effective code, but functional reactive programming is specifically designed to handle timing based events in an intuitive way. Juniper is designed to carry these advantages, as well as be lightweight enough to function viably on Arduino.

Features

Juniper supports many features typical of functional programming languages, including algebraic data types, tuples, records, pattern matching, full type inference, immutable data structures, parametric polymorphic functions, and anonymous functions (lambdas).

Some imperative programming concepts are also present in Juniper, such as for, while and do while loops, the ability to mark variables as mutable, and mutable references.

Since Juniper transpiles to C++, integration with existing C/C++ libraries is easy and straightforward.

Completely Open Source

The Juniper compiler, standard library and documentation are all open sourced under the MIT License. The Juniper compiler itself is written in F#, an open source language originally developed by Microsoft Research.

Latest News & Publications

Juniper 4.0.0 Released

November 25, 2023

New features:

  • New syntax for sequences, lambdas, match expressions, templates and more.
  • Upgrade the Juniper compiler to use .NET8.
  • Binary for OSX-ARM64 added.
  • Syntax should now be stable now that the language is mostly feature complete.
  • Add inout parameters, removing remaining need for ref cells.
  • stdlib updates, particularly around inout parameters.
  • Bug fixes for pattern matching on integers and reals.
  • smartpointer constructor is now a stdlib function.
  • rawpointer renamed to ptr, pointer renamed to rcptr.
  • Function arguments can now be set to mut.
  • Fixed bugs relating to reference counting garbage collection
  • Removed parens from syntax for loops.
  • Added assignment operation operators (ie: +=, -=, /=, ...)
  • to keyword in for loops now changed to ..
  • downto keyword in for loops removed.
  • Record fields inside record expressions are now assigned with := instead of =
  • Record fields are now separated by commas.
  • Added support for if statements without else branches (these if statements return unit)
  • Colors added to compiler error messages
  • mutable keyword changed to mut
  • Lambdas now use fat arrow syntax, no need for end keyword
  • You can now mutate fields stored in a ref with a right arrow (->)
  • Added support for wildcards in type expressions via an underscore (_)
  • Various compiler output bugfixes.
  • Constructing an array is now done with stdlib (see Prelude:array) instead of built in array keyword.
  • Added sizeof operator.
  • The closure in function types is now optional in many cases, it desugars to use a type wildcard.
  • Tuple types are now written in paren enclosed comma separated list, instead of asterisk separated lists. ie, we now use (a, b, c) and not a * b * c.
  • In a template you now denote an type level integer argument via ": int". This replaces the semicolon separated list.
  • A for range loop is now inclusive, exclusive [a, b) instead of [a, b].
  • Added prune-unreachable flag to the compiler for ignoring dead code.
  • Cases in match expressions no longer need to be separated with commas.
  • Added suffix for double literals "d"

New Website Design

November 25, 2023

Juniper has a newly designed website and logo. The new website is substantially more modern and aesthetically pleasing. There is also a new tutorial series on a DIY smartwatch using the Adafruit CLUE board.

Juniper 3.1.0 Released

December 19, 2021

New features:

  • Bug fixes for ensuring that C++ code compiles.
  • Upgrade the Juniper compiler to use .NET6.

Juniper: A Functional Reactive Programming Language for the Arduino

The paper that started it all is available for viewing on arXiv. This publication introduced the motivation and design behind the Juniper programming language. Since the publication's release in 2016 the language has continued to evolve, but the core philosophy remains the same.

Solving the Funarg Problem with Static Types

This paper covers the implementation of closures in the Juniper programming language. The publication is available for viewing on arXiv.