{"id":18246308,"url":"https://github.com/jsxgraph/jessiecode","last_synced_at":"2025-04-04T14:31:13.008Z","repository":{"id":3658742,"uuid":"4727039","full_name":"jsxgraph/JessieCode","owner":"jsxgraph","description":"JessieCode is a small DSL that acts as a middle layer between the user and JSXGraph. It's purpose is to restrict the user's access to the DOM and reduce the technical overhead and redundancy required to program JSXGraph mathlets.","archived":false,"fork":false,"pushed_at":"2025-01-22T15:28:50.000Z","size":1180,"stargazers_count":22,"open_issues_count":8,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-20T14:40:26.753Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://bin.sketchometry.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsxgraph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.LGPL","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-06-20T14:12:36.000Z","updated_at":"2025-03-11T05:41:24.000Z","dependencies_parsed_at":"2023-07-10T11:48:04.754Z","dependency_job_id":"3da41d2e-1db0-4c29-b925-65dcc710ac8a","html_url":"https://github.com/jsxgraph/JessieCode","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsxgraph%2FJessieCode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsxgraph%2FJessieCode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsxgraph%2FJessieCode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsxgraph%2FJessieCode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsxgraph","download_url":"https://codeload.github.com/jsxgraph/JessieCode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247193963,"owners_count":20899401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T09:25:22.914Z","updated_at":"2025-04-04T14:31:12.618Z","avatar_url":"https://github.com/jsxgraph.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"JessieCode - A script language for JSXGraph\n===========================================\n\n(c) 2011-2021\n    Michael Gerhäuser, michael.gerhaeuser@gmail.com\n    Alfred Wassermann, alfred.wassermann@uni-bayreuth.de\n\n\nAbout\n-----\n\nJessieCode is a scripting language designed to provide a interface to JSXGraph. It is\nsimilar to JavaScript, but prevents access to the DOM. Hence, it can be used in community\ndriven web sites which want to use JSXGraph to display interactive math graphics.\n\nJSXGraph (https://jsxgraph.org) is required to use JessieCode. \n\u003c!--See [SketchBin](https://bin.sketchometry.com) for a live editor.--\u003e\n\nCompile\n-------\n\nRequired npm tools:\n\n- Jison\n- uglify-js\n- jshint, jslint (optional)\n\nUse `make` to compile the .bnf file into a javascript parser and to concatenate\nthe parser and interpreter into a single .js file, see `Makefile`.\n\nLicense\n-------\n\nJessieCode is free software dual licensed under the GNU LGPL or MIT License.\n\nYou can redistribute it and/or modify it under the terms of the\n\n  * GNU Lesser General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version\n  OR\n  * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT\n\nJessieCode is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License and\nthe MIT License along with JessieCode. If not, see \u003chttps://www.gnu.org/licenses/\u003e\nand \u003chttps://opensource.org/licenses/MIT/\u003e.\n\n# JessieCode language reference\n\n## Datatypes\n\n- **Boolean**, *true* or *false* (case insensitive, *tRuE* is a valid boolean\n  constant).\n\n- **Strings** are defined using single quote marks. Quote marks inside a string\n  have to be escaped with a backslash.\n\n- **Number**, corresponds to the JavaScript *number* datatype.\n\n- **Objects**, can be created only via object literal notation **\\\u003c\\\u003c \\\u003e\\\u003e** and\n  the predefined element functions (see below). To access properties and\n  methods the operator is used. Example:\n\n```js\nobj = \u003c\u003c\n  property: 'string',\n  prop: 42,\n  method: function (x) {\n      return x*x;\n  }\n\u003e\u003e;\nsixteen = obj.method(4);\n```\n\n- **Functions** are declared with the *function* operator\n\n```js\nf = function (a, b, c) {\n  return a+b+c;\n};\n```\n\n## Comments\n\nOnly one line comments with // being the first non-whitespace characters are\nsupported right now.\n\n## Operators\n\n### Logical operators\n\n| Operator | Description |\n|:---------|:------------|\n| \\|\\|     | OR          |\n| \u0026\u0026       | AND         |\n| !        | NOT         |\n\n### Arithmetic operators\n\n| Operator | Description                   |\n|:---------|:------------------------------|\n| \\+       | Addition                      |\n| \\-       | Subtraction or unary negation |\n| \\*       | Multiplication                |\n| /        | Division                      |\n| %        | Modulus                       |\n| ^        | Exponentiation                |\n\n### Assignment operators\n\n| Operator | Description |\n|:---------|:------------|\n| =        | Assignment  |\n\n### Comparison operators\n\n| Operator | Description                                                   |\n|:---------|:--------------------------------------------------------------|\n| ==       | Equals                                                        |\n| \u003c=       | Lesser or equal                                               |\n| \\\u003e=      | Greater or equal                                              |\n| \\\u003c       | Lesser                                                        |\n| \\\u003e       | Greater                                                       |\n| !=       | Not equal                                                     |\n| \\~=      | Approximately equal, can be used to compare two float values. |\n\n### Conditional operator\n\n| Operator | Description |\n|:---------|:------------|\n| bool ? expr1 : expr2   | expr1 if bool is true, expr2 otherwise   |\n\n### String operators\n\n| Operator | Description          |\n|:---------|:---------------------|\n| \\+       | String concatenation |\n\n### Member operators\n\n| Operator | Description                                 |\n|:---------|:--------------------------------------------|\n| .         | Access the object\\'s properties and methods |\n\n## Control structures\n\nThe control structures are exactly the same as in JavaScript.\n\n### If\n\n```js\nif (\u003cexpression) {\n  \u003cStmt\u003e\n} else if (\u003cexpression\u003e) {\n  \u003cStmt\u003e\n} else {\n  \u003cStmt\u003e\n}\n```\n\n### While loop\n\n```js\nwhile (\u003cexpression\u003e) {\n  \u003cStmt\u003e\n}\n```\n\n### Do loop\n\n```js\ndo {\n  \u003cStmt\u003e\n} while (\u003cexpression\u003e);\n```\n\n### For loop\n\n```js\nfor (\u003cassignment\u003e; \u003cexpression\u003e; \u003cassignment\u003e) {\n  \u003cStmt\u003e\n}\n```\n\n## Predefined constants\n\n| Name     | Description                                            |\n|:---------|:-------------------------------------------------------|\n| \\$board  | Reference to the currently accessed board.             |\n| LN2      | Natural logarithm of 2                                 |\n| LN10     | Natural logarithm of 10                                |\n| LOG2E    | Base 2 logarithm of EULER                              |\n| LOG10E   | Base 10 logarithm of EULER                             |\n| PI       | Ratio of the circumference of a circle to its diameter |\n| EULER    | Euler\\'s number e = 2.718281828459045                  |\n| SQRT1\\_2 | Square root of 1/2                                     |\n| SQRT2    | Square root of 2                                       |\n\n## Predefined functions\n\n### Math functions\n\nSupported are all functions from the JavaScript `Math` object, like `sin`, `cos`, `abs, `random`, ...\nAdditionally supported are numerical JSXGraph functions from `JXG.Math`, see \u003chttps://jsxgraph.org/docs/symbols/JXG.Math.html\u003e.\n\n| Function           | Description                                                      |\n|:-------------------|:-----------------------------------------------------------------|\n| cos(x)             | Cosine of x                                                      |\n| cosh(x)            | Hyperbolic cosine of x                                           |\n| pow(b, e)          | e to the b                                                       |\n| log(x), ln(x)      | Natural logarithm                                                |\n| log(x, b)          | Logarithm to base b                                              |\n| log2(x), lb(x)     | Logarithm to base 2                                              |\n| log10(x), ld(x)    | Logarithm to base 10                                             |\n| tan(x)             | Tangent of x                                                     |\n| cot(x)             | Cotangent of x                                                     |\n| sqrt(x)            | Square root of x                                                 |\n| cbrt(x)            | Cube root of x                                                   |\n| nthroot(x)         | n-th root of x                                                   |\n| ceil(x)            | Get smallest integer n with n \\\u003e x.                              |\n| asin(x)            | arcsine                                                          |\n| abs(x)             | Absolute value of x                                              |\n| max(a, b, c, \\...) | Maximum value of all given values.                               |\n| min(a, b, c, \\...) | Minimum value of all given values.                               |\n| exp(x)             | EULER to the x                                                   |\n| atan2(y, x)        | Returns the arctangent of the quotient of its arguments.         |\n| random(max = 1)    | Generate a random number between 0 and max.                      |\n| round(v)           | Returns the value of a number rounded to the nearest integer.    |\n| floor(x)           | Returns the biggest integer n with n \\\u003c x.                       |\n| acos(x)            | arccosine of x                                                   |\n| atan(x)            | arctangent of x                                                  |\n| acot(x)            | arccotangent of x                                                |\n| sin(x)             | sine of x                                                        |\n| sinh(x)            | Hyperbolic sine of x                                             |\n| factorial(n)       | Calculates n!                                                    |\n| trunc(v, p = 0)    | Truncate v after the p-th decimal.                               |\n| V(s)               | Returns the value of the given element, e.g. sliders and angles. |\n| L(s)               | Calculates the length of the given segment.                      |\n| X(P) Y(P)          | Returns the x resp. y coordinate of the given point.             |\n| dist(P, Q)         | Compute the distance of two points.                              |\n| deg(A, B, C)       | Calculate the angle of three points in degree.                   |\n| rad(A, B, C)       | Calculate the angle of three points in rad.                      |\n| \\$(id)             | Look up the element to the given element id.                     |\n\n### \\$board methods\n\n| Method                                       | Description                                                                                                                                                                                                                                         |\n|:---------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| update()                                     | Update all dependencies and redraw the board.                                                                                                                                                                                                       |\n| on(event, handler, context=board)            | Register an event handler for the given event.                                                                                                                                                                                                      |\n| off(event, handler=)                         | Deregister a given event handler or deregister all event handlers.                                                                                                                                                                                  |\n| setView(array, keepaspectratio=false)        | Changes the viewport. An array with 4 numbers is expected, the four numbers represent the left, upper, right and lower bound of the viewport. If keepaspectratio is true, the viewport is adjusted to the same aspect ratio as the board container. |\n| setBoundingbox(array, keepaspectratio=false) | See setView.                                                                                                                                                                                                                                        |\n| migratePoint(P, Q)                           | Exchange point P by point Q.                                                                                                                                                                                                                        |\n| colorblind(type)                             | Emulate color blindness. Possible types are*protanopia, tritanopia,* and*deuteranopia.*                                                                                                                                                             |\n\n### Element functions\n\nEvery element known to the loaded JSXGraph version is available inside Jessie\nby its element type, e.g. points can be created by calling point()\n\n```js\nA = point(1, 2);\n```\n\nThe given parameters correspond to the parents array of the JXG.Board.create()\nmethod. Attributes are given after the function call itself in an object:\n\n```js\nA = point(1, 2) \u003c\u003c strokeColor: 'red', face: '[]', size: 7, fillColor: 'black' \u003e\u003e;\n```\n\nFor a possibly incomplete list including documentation, see [the JSXGraph\ndocs](//jsxgraph.org/docs/); For a complete list see the\n**Element reference** section below.\n\n## Accessing elements\n\n### Variable assignment\n\n```js\nA = point(1, 2);\nA.strokeColor = '#123456';\n```\n\n### \\$\n\n```js\npoint(1, 2) \u003c\u003c id: 'foo', name: 'bar' \u003e\u003e;\n$('foo').strokeColor = '#654321';\n```\n\n### Id\n\n```js\npoint(1, 2) \u003c\u003c id: 'foo', name: 'bar' \u003e\u003e;\nfoo.strokeColor = '#f00f00';\n```\n\nThis is possible only if **foo** is not used as a variable. This won\\'t work:\n\n```js\nfoo = 1;\n(function () {\n  point(1, 2) \u003c\u003c id: 'foo' \u003e\u003e;\n  return foo.X();\n})();\n```\n\n### Name\n\n```js\npoint(1, 2) \u003c\u003c id: 'foo', name: 'bar' \u003e\u003e;\nbar.strokeColor = '#541541';\n```\n\nThis is possible only if there is not a variable called **bar** in the current\nor any higher scope. See **Id** above for an example.\n\n## Element reference\n\nSee \u003chttps://jsxgraph.org/docs/\u003e\n\n### Attributes\n\nAttributes are set like object properties\n\n```js\nA.size = 10;\nA.face = '[]';\n```\n\nSee [the JSXGraph docs](//jsxgraph.uni-bayreuth.de/docs/) for available\nattributes. Texts and Points have two special attributes **X** and **Y** to set\ntheir coordinates.\n\n### Subelements\n\nSubelements like labels for points or the baseline in sliders or the dot\nindicating an angle element is a right angle can be accessed like properties\n\n```js\nA.label.strokecolor = 'red';\n```\n\nThe names used to access subelements correspond to their names used to set\ntheir attributes in`board.create`.\n\n### Methods\n\nNot all methods of an element class are accessible in JessieCode. Currently these\nmethods are available:\n\n- all elements\n  - setLabelText\n- point\n  - move\n  - glide\n  - free\n  - X\n  - Y\n- glider\n  - all from point\n  - setPosition\n- text\n  - setText\n  - free\n  - move\n- slider\n  - Value\n- angle\n  - Value\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsxgraph%2Fjessiecode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsxgraph%2Fjessiecode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsxgraph%2Fjessiecode/lists"}