Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnitValues

A typed language for numerical quantities.

Overview

License DSL Status

UnitValues is a set of domain-specific typed languages for numerical quantities. The set consists of two languages:

  • Unit Types (.ut) for defining units from fundamental dimensions.
  • Unit Informed Values (.uiv) import Unit Types and uses dimensional construction to encode numerical quantities.

Important

Language specification for .ut and .uiv can be found within docs/language.pdf

Example

.ut

# Example Units - Derived from Fundamental Dimensions (kg, m, s, A, etc.)
[version]
format: 0.1.0
 
[units]
# name: unit
ρ: kg/m^3                             # Defines the unit for pressure
V: kg*m^2*s^-3*A^-1                   # Defines the unit for voltage

Note

The fundamental unit semantics and prefixes (kg, m, s, A, etc.) & (u, m, k, M, etc.) is defined by the runtime environment.

.uiv

[version]
format: 0.1.0
unit_frame: units.ut

[model]
# name: value prefix(unit)
num_samples: 100                        # Implicitly dimensionless
sample_size: 10         (∅)             # Explicitly dimensionless
output_energy: 1.0      (kg*m^2*s^-2)   # Defines unit via construction
output_signal: 5.0      (V)             # Defined unit `V` for voltage
inlet_pressure: 101     k(ρ)            # Defined unit `ρ` for pressure with kilo prefix

Implementation

UnitValues is implemented by PicoUnits.
You can try the language today by installing PicoUnits:

pip install PicoUnits

Local Installation

To install the UnitValues extension locally for Visual Studio Code:

Windows

npx @vscode/vsce package
code --install-extension .\UnitValues-0.0.1.vsix --force

MacOS/Linux

npx @vscode/vsce package
code --install-extension ./uiv-0.0.1.vsix --force

Documentation

All internal documentation can be found within this repo's issues.

About

A Typed Language For Dimensional Numerical Quantities

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors