N Code Tools
Home ] Up ] N Code Execution Model ] N Code Language ] N Code Data Types ] N Code Expressions ] N Code Statements ] N Code Variables and Scoping Rules ] N Code Filters ] N Code Function Definition ] [ N Code Tools ] N Code Triggers ]


N Code Tools

test-nfrd

Among the suite of tools, is a command called test-nfrd. That command provides a way of testing both the syntax, and semantics of .nfr code. If some .nfr code doesn't meet syntax checking, test-nfrd will try to display the location in the .nfr code where the syntax is broken. More importantly, though test-nfrd directly interprets the code handed to it, allowing many of the examples shown in this document to be executed.

Here's an example:

% ./test-nfrd - echo( strcasecmp( "abc", "ABC" ), "\n" );

echo( strcasecmp( "abc", "aBc" ), "\n" );

echo( strcasecmp( "aBc", "AbC" ), "\n" );

echo( strcasecmp( "aBc", "def" ), "\n" ); ^D 0 0 0 -3 %

Here's an example of a syntax error:

% cat .nfr echo( strcasecmp( "abc", "ABC" ), "\n" );

echo( strcasecmp( "abc", "aBc" ) "\n" );

echo( strcasecmp( "aBc", "AbC" ), "\n" );

echo( strcasecmp( "aBc", "def" ), "\n" ); % ./test-nfrd .nfr 0 1:

echo( strcasecmp( "abc", "ABC" ), "\n" );

Error: syntax error line: 2, syntax error in procedure call

2: echo( strcasecmp( "abc", "aBc" )"\n"> )

3: echo( strcasecmp( "aBc", "AbC" ), "\n" );

4: echo( strcasecmp( "aBc", "def" ), "\n" );

5:

The code was partially executed (the "0" on the first line after the invocation of the command) when the syntax error took place. The syntax error will prevent any further execution from happening, and will prevent certain types of semantic checking to be possible.

Notice that the syntax error is bracketed by the "n". There are two places where the syntax error is seen on "line: 2"... the missing comma, and the end of the statement (where parsing resynchronization takes places). ./test-nfrd is also able to generate html, to describe where an error takes place, and later versions of the gui will include a mechanism to check .nfr code, and display syntax errors in the browser.

By using test-nfrd, tests can be executed to verify language features, or to test code fragments.

 


Back ] Home ] Up ] Next ]