Bosque by Microsoft

What is Bosque?

The Bosque programming language is a Microsoft Research project that is investigating language designs for writing code that is simple, obvious, and easy to reason about for both humans and machines. Bosque programming language is heavily inspired by Typescript syntax and types, as well as the semantics of ML and Node/JavaScript. If we have a JavaScript background, Bosque should look familiar and feel pretty natural.

The main aim of the Bosque language is to provide ways to avoid accidental complexity in the development, coding process, and improve developer productivity as well as software quality by enabling a range of new compilers and developer tooling experiences.

Mark Marron (Microsoft Researcher) created the Bosque programming language on March 3, 2019, and published it on April 15, 2019. He has mentioned the source of complexity in five different sections. Bosque is a Spanish word that means forest.

The Bosque Programming Language project is a ground-up language & tooling co-design effort focused on is investigating the theoretical and the practical implications of:

  1. Explicitly designing a code intermediate representation language (or byte code) that enables deep automated code reasoning and the deployment of next-generation development tools, compilers, and runtime systems.
  2. Leveraging the power of the intermediate representation to provide a programming language that is both easily accessible to modern developers andthat provides a rich set of useful language features for developing high reliability & high-performance applications.
  • Taking a cloud-development first perspective on programming to address emerging challenges as we move into a distributed cloud development model based around microservices, serverless, and Restful architectures.

Installation steps

  • Make sure Node.js and Typescript are installed on the PC.
  • Go to GitHub: & download the zip folder.
  • Extract the folder and copy it.
  • Create a new folder (ex: “Bosque”) in .vscode folder & paste the folder (ex: C:\Users\rvino\.vscode\ Bosque).
  • Open Node.js command prompt, go to the Bosque\ref_impl folder and execute the below command.

npm install && npm run-script build && npm test,

  • That’s it. Bosque is installed successfully.
  • Let’s write the “Hello World” program now.


To write the program, we are going to use Visual Studio code. Visual Studio Code extension is not available right now but we can add the extension manually. Copy the folder “Bosque-language-tools” into .vscode/extension folder.

Execute the command “Code hello.bsq”.

Type the below code in the Visual Studio editor & save it.

Type the below code in the Visual Studio editor & save it.


Features of language

The Bosque programming language is designed for writing code that is simple, obvious, and easy to reason about for both humans and machines. The design was driven heavily by the identification and elimination of various sources of accidental complexity and insights on how they can be alleviated via thoughtful language design. Some of the basic features of the language are:

  • All values in the Bosque language are immutable.
  • Local variables with block-structured code is a very appealing model for structuring code.
  • Bosque provides named argumentsalong with rest and spread These can be used to perform simple and powerful data manipulation as part of invocations and constructor operations
  • In addition to allowing multiple assignments to variables and multi-return values, the Bosque language also allows developers to thread parameters via refargument passing. This alternative to multi-return values simplifies scenarios where a variable (often some sort of environment) is passed to a method that may use and update it.
  • Bosque provides two favorable strings, SafeString<T>and StringOf<T>, to address various scenarios where including meta-data about the string in the type is useful.

The SafeString<T> type is parameterized with a Validator regular expression type which describes the language that the string belongs to. This supports a concise representation of many common string structures seen in a program, particularly at API call parameters, in a way that does not require exposing details of the program.

The StringOf<T> type is much richer at the cost of using customized logic and exposing internal information from the codebase. It is parameterized by any type implementing the Par-sable concept. The contents of the string are then restricted to the language of strings accepted by the static T::tryParse method — which may be arbitrarily complex code. This makes them ideal for working with data that comes in a custom format or simply for light validation and then to tag strings with a type to avoid confusion in code or APIs with multiple string-valued parameters.

Additionally, the StringOf construction provides a user-friendly object-literal and lightweight DSL format that can be used inside a Bosque program without requiring special extensions.

  • Bulk algebraic operationssupport for bulk reads and updates to data values. In other languages, you may use a strict with 3 fields, and need to update 2 of them on a field-by-field basis. With the bulk data operations, you can perform the update as an atomic operation and without manually extracting and copying fields.

What’s on the Bosque Roadmap?

Mark Marron says the Bosque roadmap has two key priorities in its early stage:

  1. The team thinks that the Bosque eliminates the complexity and enables deep understanding & reasoning concerning source code. To verify this, the team will build sophisticated symbolic analysis engines for the source code. For correctness and to be able to show that an app is bug-free, or that it has bugs.
  2. Perform resource analysis and answer the following questions: What is the Big O complexity of our entire application? How does its runtime scale as a function of our input? What is the maximum memory we can use? Then the team can start building tooling and perform a limit test of just how far they can push automated reasoning.