You can edit almost every page by Creating an account. Otherwise, see the FAQ.

Grace (programming language)

From EverybodyWiki Bios & Wiki

Script error: No such module "Draft topics". Script error: No such module "AfC topic".

Grace
The logo of the Grace programming language.
Screenshot
Snippet of Grace code
"Hello, world!" in grace
ParadigmDeclarative
Designed byJoe Alvarado
DeveloperJoe Alvarado
First appearedMay 13th, 2023
Typing disciplineStrongly-typed
ScopeGeneral-purpose
PlatformWindows
OSWindows 10
LicenseFree software
Filename extensions.grace
File formatsGrace script file format
Websitewww.gracelang.w3spaces.com
Major implementations
None
Dialects
None
Influenced by
Python, Cobol
Influenced
Nothing

Search Grace (programming language) on Amazon.

Grace is a strongly typed, general-purpose language that was designed to have a somewhat similar syntax to COBOL while having the functionality of Python. Currently, Grace is in extremely early development, having only a small pool of features implemented. Grace is based on tasks, which are snippets of code that are executed based on their head's sequence in id-div.

Syntax[edit]

Operators[edit]

Grace has a relatively small assortment of operators, most of them being mathematical. Grace has operators for:

  • Math (accessed using the math: operator in Grace): +, -, *, /
  • Logic (accessed using the logic {} block in Grace): =, <, >

Commands and Blocks[edit]

  • head {}, for the head data of a program
  • id-div {}, for defining task heads.
  • task-body {}, for defining the tasks themselves.
  • logic {}, for defining logic gates
  • else {}, for putting inside logic gates to execute code when the logic gate is not true.
  • function {}, for defining functions.
  • say: , for outputting text from the standard output
  • input: , for inputting text from the standard input.
  • prog-name: , for defining the name of the program.
  • prog-desc, for defining the description of the program.
  • task-head: , for defining the heads of tasks.
  • var: , for defining variables
  • list: , for defining lists
  • array: , for defining arrays
  • dict: ,for defining dictionaries.
  • math: , for doing math.

Example Code[edit]

Basic matrix in Grace:

head {
        prog-name: “Matrix”
        prog-desc: “Matrix demo”
}
id-div {
        task-head: name=”matrix” id=”1”
}
task-body (id=”1”) {
        say: “Basic matrix made of arrays!”
        array: arr1 = ([“1”, “2”, “3”])
        array: arr2 = ([“4”, “5”, “6”])
        array: arr3 = ([“7”, “8”, “9”])
        say: arr1
        say: arr2
        say: arr3
}

Number guessing game:

head {
        prog-name: “Number guessing game”
        prog-desc: “Fun little game!”
}
id-div {
        task-head: name=”game” id=”1”
}
task-body (id=”1”) {
        var: txt = input: “Guess a number”
        logic (log=”if txt = “5””) {
                say: “Well done!”
                else {
                        say: “Whoops! Looks like you guessed the wrong number!”
                }
        }
}

Custom "add" function:

head {
        prog-name: “Functions”
        prog-desc: “Functions demo”
}
id-div {
        task-head: name=”testtask” id=”1”
}
function (name=”add” args=”add1”, “add2”) {
        var: addition = math: add1 + add2
        say: addition
}
task-body (id=1) {
        add: add1=”1” add2=”1”
}

References[edit]


This article "Grace (programming language)" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Grace (programming language). Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.