Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/haydn/ulm. Universal Language for Mathematics
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304import { strict as assert } from "assert";import parse from "./parse";import Token from "./Token";
const tokens: Token[] = [ { type: "OperatorName", value: "NumericEqualRelation", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "LeftParenthesis", value: "(", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "OperatorName", value: "NumericAdditionOperation", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "LeftParenthesis", value: "(", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RationalNumberLiteral", value: "12312", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RationalNumberLiteral", value: "0.33", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RightParenthesis", value: ")", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RationalNumberLiteral", value: "1/4", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RightParenthesis", value: ")", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RationalNumberLiteral", value: "0.33", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RationalNumberLiteral", value: "1/3", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RationalNumberLiteral", value: "-2", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RationalNumberLiteral", value: "+23/5", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RationalNumberLiteral", value: "5.5_8", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "NaturalNumberLiteral", value: "1_3n", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "WholeNumberLiteral", value: "3w", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "WholeNumberLiteral", value: "0w", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "IntegerNumberLiteral", value: "-34i", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "IntegerNumberLiteral", value: "2i", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "IntegerNumberLiteral", value: "33i", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RationalNumberLiteral", value: "1", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "OperatorName", value: "RationalNumber", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "LeftParenthesis", value: "(", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "IntegerNumberLiteral", value: "-13i", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "NaturalNumberLiteral", value: "25n", file: null, location: { index: 0, line: 0, column: 0 } }, { type: "RightParenthesis", value: ")", file: null, location: { index: 0, line: 0, column: 0 } }];
assert.deepEqual(parse(tokens), [ { type: "NumericEqualRelation", operands: [ { type: "NumericAdditionOperation", operands: [ { type: "RationalNumber", numerator: 12312, denominator: 1 }, { type: "RationalNumber", numerator: 33, denominator: 100 } ] }, { type: "RationalNumber", numerator: 1, denominator: 4 } ] }, { type: "RationalNumber", numerator: 33, denominator: 100 }, { type: "RationalNumber", numerator: 1, denominator: 3 }, { type: "RationalNumber", numerator: -2, denominator: 1 }, { type: "RationalNumber", numerator: 23, denominator: 5 }, { type: "RationalNumber", numerator: 558, denominator: 100 }, { type: "NaturalNumber", value: 13 }, { type: "WholeNumber", value: 3 }, { type: "WholeNumber", value: 0 }, { type: "IntegerNumber", value: -34 }, { type: "IntegerNumber", value: 2 }, { type: "IntegerNumber", value: 33 }, { type: "RationalNumber", numerator: 1, denominator: 1 }, { type: "RationalNumber", numerator: -13, denominator: 25 }]);