Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operators description #2

Open
ArnaudBuchholz opened this issue Jul 19, 2024 · 3 comments
Open

Operators description #2

ArnaudBuchholz opened this issue Jul 19, 2024 · 3 comments

Comments

@ArnaudBuchholz
Copy link
Owner

[{
  "operator": "add",
  "description": "adds two integers",
  "labels": ["math", "number"],
  "signature": {
    "input": ["integer", "integer"],
    "output": ["integer"],
    "exceptions.comment": "TypeCheck and StackUnderflow are implicit",
    "exceptions": [],
  },
  "samples": [{
    "description": "Simple use case"
    "in": "1 2 add",
    "out": "3"
  }]
}, {
  "operator": "aload",
  "description": "dumps the content of the array on the operand stack",
  "labels": ["array", "load"],
  "signature": {
    "input": ["array"],
    "output": ["...any"],
    "exceptions": []
  },
  "samples": [{
    "description": "all the elements of an array",
    "in": "[1 2 3] aload",
    "out": "1 2 3"
  }, {
    "description": "all the elements of a block",
    "in": "{1 2 3} aload",
    "out": "1 2 3"
  }, {
    "description": "all the elements of a block (with calls)",
    "in": "{1 2 add} aload",
    "out.description": "How to distinguish things that must be evaluated from things that should not",
    "out": "1 2 add"
  }]
}, {
  "operator": "where",
  "description": "detect if the name is defined in the dictionary stack and, if found, returns the corresponding dictionary and true",
  "labels": ["dictionary stack"],
  "signature": {
    "input": ["string"],
    "output": {
      "name is found": ["dictionary", "boolean:true"]
      "name is unknown": ["boolean:false"]
    },
    "exceptions": [],
    "samples": []
  }
}]
@ArnaudBuchholz
Copy link
Owner Author

This will help generating :

  • documentation
  • test cases

@ArnaudBuchholz
Copy link
Owner Author

  • Define a schema to validate JSONs

@ArnaudBuchholz ArnaudBuchholz changed the title Operator descripitions Operator descriptions Jul 19, 2024
@ArnaudBuchholz
Copy link
Owner Author

{
    "type": "object",
    "properties": {
        "operator": {
            "type": "string"
        },
        "description": {
            "type": "string"
        },
        "labels": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "signature": {
            "type": "object",
            "properties": {
                "input": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "output": {
                    "oneOf": [
                        {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        {
                            "type": "object",
                            "properties": {}
                        }
                    ]
                }
            }
        }
    },
    "title": "schema"
}

@ArnaudBuchholz ArnaudBuchholz changed the title Operator descriptions Operators description Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant