# 4 Core Programs

In this section, we give a context-free grammar for Core Oz programs.

## 4.1 The Base Language

Statements

> <statement> | ::= | <statement> <statement>
> | | | `local` { <variable> }+ `in` <statement> `end`
> | | | `proc` { <atom> } "`{`" <variable> { <variable> } "`}`"
> |  | <statement>
> |  | `end`
> | | | "`{`" <variable> { <variable> } "`}`"
> | | | `lock` <variable> `then` <statement> `end`
> | | | `thread` <statement> `end`
> | | | `try` <statement>
> |  | `catch` <variable> `then` <statement>
> |  | `end`
> | | | <variable> "`=`" "`@`" <variable>
> | | | <variable> "`:=`" <variable>
> | | | <variable> "`=`" <variable> "`:=`" <variable>
> | | | <variable> "`=`" <expression>
> | | | `skip`

Expressions

> <expression> | ::= | <variable>
> | | | <atom> | <int> | <float>
> | | | <label> "`(`" { <feature> "`:`" <expression> } [ "`...`" ] "`)`"

> <label> | ::= | <variable label> | <atom label>

> <feature> | ::= | <variable> | <atom> | <int>

## 4.2 Class Extensions

> <statement> | += | `class` <variable>
> |  | [ `from` { <variable> }+ ]
> |  | [ `prop` { <variable> }+ ]
> |  | [ `attr` { "`!`" <variable> [ "`:`" <variable> ] }+ ]
> |  | [ `feat` { "`!`" <variable> [ "`:`" <variable> ] }+ ]
> |  | { <method> }
> |  | `end`
> | | | `lock` <statement> `end`
> | | | <variable> "`<-`" <variable>
> | | | <variable> "`=`" <variable> "`<-`" <variable>
> | | | <variable> "`,`" <variable>
> | | | <variable> "`=`" `self`

Methods

> <method> | ::= | `meth` "`!`" <variable> "`(`" "`...`" "`)`" "`=`" <variable>
> |  | <statement>
> |  | `end`