2018-11-17 13:01:37 -06:00
|
|
|
+++
|
|
|
|
title = "The UCG Language Reference"
|
|
|
|
slug = "reference"
|
2019-02-25 21:02:26 -06:00
|
|
|
weight = 3
|
2018-11-17 13:01:37 -06:00
|
|
|
sort_by = "weight"
|
|
|
|
in_search_index = true
|
|
|
|
+++
|
|
|
|
An Overview
|
|
|
|
-----------
|
|
|
|
|
2019-03-29 12:57:26 -04:00
|
|
|
UCG is an immutable, expression oriented, functional programming language
|
|
|
|
specialized for generating configurations. It has limited IO and a form of
|
|
|
|
forward type inference.
|
2018-11-17 13:01:37 -06:00
|
|
|
|
2019-03-29 12:57:26 -04:00
|
|
|
A valid UCG file is composed of a series of statements. Statements can be an
|
|
|
|
expression, introduce named bindings, or create different outputs. All
|
|
|
|
statements must be terminiated by a semicolon. Statements are executed in order.
|
|
|
|
All expressions in ucg return a value. Expressions can see anything declared in
|
|
|
|
their enclosing scope up to the point of their execution.
|
|
|
|
|
|
|
|
Scopes in UCG are defined by the ucg file, a function, or a module body.
|
2018-11-17 13:01:37 -06:00
|
|
|
|
2019-03-29 12:57:26 -04:00
|
|
|
Some words are reserved in UCG and can not be used as a named binding.
|
2018-11-17 13:01:37 -06:00
|
|
|
|
|
|
|
* self
|
|
|
|
* assert
|
|
|
|
* true
|
|
|
|
* false
|
|
|
|
* let
|
|
|
|
* import
|
|
|
|
* as
|
2019-01-24 20:05:08 -06:00
|
|
|
* in
|
|
|
|
* is
|
|
|
|
* not
|
|
|
|
* fail
|
2018-11-17 13:01:37 -06:00
|
|
|
* select
|
2019-01-24 20:05:08 -06:00
|
|
|
* func
|
2018-11-23 12:50:47 -06:00
|
|
|
* module
|
2018-11-17 13:01:37 -06:00
|
|
|
* env
|
|
|
|
* map
|
|
|
|
* filter
|
2019-01-31 19:23:28 -06:00
|
|
|
* reduce
|
2018-11-17 13:01:37 -06:00
|
|
|
* NULL
|
|
|
|
* out
|
|
|
|
|
|
|
|
Next: <a href="types">Types</a>
|