Three modules are provided.
The Error module defines a single type, lisp Error that is a sub-type of Julia's Exception. Use it when your interpreter or parser encounters an error.
The Lexer module exports a single function lex. Lex accepts a string and outputs an array of reals, symbols or another array. The output of the lexer should be fed into the parser.
The repl module exports a single function repl(Source) which takes the name of the modle you wish to test. For example to test the Rudimentary interpreter If i had named my moudle RudInt I would call Repl.repl(“RudInt”). It also allows you interp expressions, parse expressions, test single cases, test multiple exprs using files, and reload your module after making changes. Run help to get further information.
(+ 1 2); (* 1 2); (- 1 2); (with 3); parse(+ 1 2);
3; 2; -1; error:REGEX_FOR_ERROR_MSG; Binop(op(+), Num(1), Num(2);
To test errors, simply use error:EXPECTED_MESSAGE, where expected_message is a regular expression to match to.
When returning custom defined types, like in the line above, the testing function automatically removes module namespace. So RudInt.Binop(….) would fail.