MPC(1)MPC(1)

## NAME

mpc – extended precision arithmetic code generator

## SYNOPSIS

`mpc`*file ...*

## DESCRIPTION

*Mpc**mp*(2)

## LANGUAGE

The language consists of a series of function definitions of the form:

*name**parameter list **statements*

All variables and parameters are extended precision integers and are passed by reference. Statements are separated by semicolon and the following statemens are defined:

*name*`=`*expression*

`if`*condition**statements*`else if `*condition**statements*`else`*statements*

`while`*condition**statements*

`break`

*name
*(
*parameter list *

`mod
`(
*modulus**statements*

There is no distinction between input and output parameters, but
conventionally, the outputs are put at the end of the
*parameter list *

*F**X*,*Y*,*Z**Y*,*Z*`=`*F**X*

Expressions are composed out of the following arithmetic operations:

`+`

addition.

`-`

subtraction.

`*`

multiplication.

`/`

division, or multiplicative inverse when enclosed in
`mod`

`%`

division remainder.

`^`

exponentiation.

`>>`

*constant*

right shift by a constant.

`<<`

*constant*

left shift by a constant.

*condition*

`?`

*a*

`:`

*b*

pick
*a**condition is true, otherwise**b*

Conditions can use the following operations:

`==`

equality.

`!=`

inequality.

`>`

bigger than.

`<`

smaller than.

`!`

*condition*

negation.

## SOURCE

`/sys/src/cmd/mpc.y`