User Tools

Site Tools


cs330_f2016:julia

This is an old revision of the document!


Julia

Julia IDE

In class, I've been using the uber-juno IDE.

Note that on a Mac, you need to have the xcode command line developer tools installed (and you need to have accepted the license agreement).

Provided tools

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.

Test Files

Test:

(+ 1 2);
(* 1 2);
(- 1 2);
(with 3);
parse(+ 1 2);

Answers:

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.

cs330_f2016/julia.1504552665.txt.gz · Last modified: 2021/06/30 23:40 (external edit)