AARCHMRS Schema 2.5.3

↚ Home

AST.UnaryOp object

A model representing a unary operation over an expression, for example:

  • !TRUE
  • !(A == 2)
  • -15

object

Properties Type Description
_meta Meta
See Meta for more information.
_type
Enum
AST.UnaryOp
expr BinaryOp

The expression to which the unary operation will be applied.

See definitions.expression in BinaryOp for more information.
op

The operation to be performed on expr.

Enum
! - NOT
Additional Properties
Not Allowed
◊ Required
Properties marked with ◊ are required properties.
Examples
{
    "_type": "AST.UnaryOp", 
    "op": "!", 
    "expr": {
        "_type": "AST.Bool", 
        "value": true
    }
}
{
    "_type": "AST.UnaryOp", 
    "op": "!", 
    "expr": {
        "_type": "AST.BinaryOp", 
        "left": {
            "_type": "AST.Identifier", 
            "value": "A"
        }, 
        "op": "==", 
        "right": {
            "_type": "AST.Integer", 
            "value": 2
        }
    }
}
{
    "_type": "AST.UnaryOp", 
    "op": "-", 
    "expr": {
        "_type": "AST.Integer", 
        "value": 15
    }
}

Schema http://json-schema.org/draft-04/schema#

{
  "additionalProperties": false,
  "info": [
    "A model representing a unary operation over an expression, for example:",
    [
      " - `!TRUE`",
      " - `!(A == 2)`",
      " - `-15`"
    ]
  ],
  "examples": [
    {
      "_type": "AST.UnaryOp",
      "op": "!",
      "expr": {
        "_type": "AST.Bool",
        "value": true
      }
    },
    {
      "_type": "AST.UnaryOp",
      "op": "!",
      "expr": {
        "_type": "AST.BinaryOp",
        "left": {
          "_type": "AST.Identifier",
          "value": "A"
        },
        "op": "==",
        "right": {
          "_type": "AST.Integer",
          "value": 2
        }
      }
    },
    {
      "_type": "AST.UnaryOp",
      "op": "-",
      "expr": {
        "_type": "AST.Integer",
        "value": 15
      }
    }
  ],
  "properties": {
    "_meta": {
      "$ref": "../Meta.json"
    },
    "_type": {
      "enum": [
        "AST.UnaryOp"
      ]
    },
    "op": {
      "info": [
        "The operation to be performed on `expr`."
      ],
      "enum": [
        "!",
        "-",
        "NOT"
      ]
    },
    "expr": {
      "info": [
        "The expression to which the unary operation will be applied."
      ],
      "$ref": "BinaryOp.json#/definitions/expression"
    }
  },
  "required": [
    "expr",
    "op"
  ],
  "title": "UnaryOp",
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema#"
}