200 likes | 355 Views
Eurologo 2003, Porto, Portugal. Pavel Boytchev www.elica.net. Error Reporting in Elica. Levels of error information Representing Logo commands Examples. Error Reporting in Elica. Levels of Error Information. Per-line location. Source file name.
E N D
Eurologo 2003, Porto, Portugal Pavel Boytchev www.elica.net
Error Reporting in Elica • Levels of error information • Representing Logo commands • Examples
Error Reporting in Elica Levels ofError Information
Per-line location Source file name The other part of ( is missing (Sample1.ELI) OK Help Link to level II Short error message Error Information Level I make"x10make"y20 if:x=:y[ print2*(:x+:y] [ print :x-:y ]
Hints • Context-sensitive • Dynamic • Some errors have 10+ hints • Customizable • Voting subsystem Short, normal and long explanations • Source Reference • Source extract • Source file name and line • Error fragment in red • Hyperlink to actual source • Hyperlink to Level IV for detailed explanation Error Information Level II Pair mismatch (…] • Elica found ( but did not find any matching ). Instead it found ] for which there is no [. • The ( symbol is used to identify the beginning of an expression or a command. The error has been reported because Elica was not able to find the end of the expression or the command which should be marked with ). Instead of ) Elica found the symbol ] which is used to identify the end of a list. An expression and a list could be either nested one in another or independent. They cannot crossintersect. Consider these options: • Check whether there is a mising ) that corresponds to the opening (, or missing [ that already have closing ]; [ VOTE ] • If the symbol ( really starts an expression or a command and the symbol really ends a list, then either the expression must be inside the list [ (…) ], or the list -- inside the expression ( […] ) or both of them not to cross at all (…) […]; [ VOTE ] • If there should be no expression or command in this place of the program then remove or comment (; [ VOTE ] 1 Location: New File 0 (line 3) Explain if :x=:y [print 2*(:x+:y] [print :x-:y]
The actual value that will cause an error Exception will be generated by SIN Place where the error must be fixed The execution of this command will cause an error message Another Error Example • to expr :x :y • print(1+:y)*( sin :x )-count :y • end • to try • local "a "b • make "a random 1 • make "b random 1 • expr "a :b • end • try
Action name, hyperlink to its definition and its local variables Error Information Level III Location: New File 0 (line 10) Action: trydefinitioninputs 4 Explain try Location: New File 0 (line 8) Action: exprdefinitioninputs 3 Explain expr "a :b Location: New File 0 (line 2) Action: sindefinitioninputs 2 Explain print (1+:y)*(sin :x)-count :y 1 Explain Location: Logo.eli (line 207) to logo.sin :angle output dll.logo.logosin end
Error Reporting in Elica RepresentingLogo CommandsError Information Level IV
Original Logo source: Error located within the shortest source region print (1+:y)*(sin :x)-count :y Logo source with parentheses: Colors used to easily match parentheses (print (((1+:y)*(sin :x))-(count :y))) print (1+:y)*(sin :x)-count :y
1 :y :x x y angle :y + sin x y thing count * x y thing print print (1+:y)*(sin :x)-count :y Brace notation (Function Machines): Shows inputs names, visualizes expression trees
1 :y :x :y print + * sin count print (1+:y)*(sin :x)-count :y Box notation (Boxer): Shows function nesting
print (1+:y)*(sin :x)-count :y (print (logo.- (logo.* (logo.+ 1 :y ) (logo.sin :x ) ) (logo.count :y ) )) Lisp notation: Converts source to prefix notation, shows complete names of functions
print (1+:y)*(sin :x)-count :y Assembler notation: Reveals internal compiled code, full function names, number of actual inputs and special cases (like treating : as a function) PUSH 1 PUSH y CALL :1 CALL logo.+2 PUSH x CALL :1 CALL logo.sin1 CALL logo.*2 PUSH y CALL :1 CALL logo.count1 CALL logo.-2 CALL print1 POPRET
Natural language: Converts Logo source to English (using parenthesised English) Print the difference of X1 and the number of elements in the value of y, where X1 is the product of X2 and the sine of the value of x. X2 is the sum of 1 and the value of y. print (1+:y)*(sin :x)-count :y Seminatural language: Converts Logo source into a parenthesised English statement. Print (the difference of (the product of (the sum of 1 and (the value of y)) and (the sine of (the value of x))) and (the number of elements in (the value of y))).
Logo-to-Natural Language • Translation entirely done by a Logo program • can be inspected and modified • AI/NLP module used to naturalize language: • controls desired sentence length and depth • splits sentences to keep readibility higher (number of ANDs, THATs, subject-object confusion, etc) • easy to teach AI/NLP module to handle new user-defined commands and functions
Identical header, different body Make a variable with name the text a and set its value to the number of elements in the reversed list of the list [1 2 three 4 5] without its first element. Teaching the AI/NLP Module to reverse :lst if ... end oninspector.add [ to reverse :lst output list se [the reversed list of] :lst end ] make "a count reverse bf [12 three 45]
More Examples Real-time examples of how Elica behaves in some error conditions