This shows you the differences between two versions of the page.
|
alf:teme:tema4_en [2020/04/21 21:51] alexandru.radovici |
alf:teme:tema4_en [2020/04/25 12:15] (current) alexandru.radovici |
||
|---|---|---|---|
| Line 56: | Line 56: | ||
| symbol_table: {...}, // the symbol_table | symbol_table: {...}, // the symbol_table | ||
| ast: [...], // the ast with the type for very node that returns a value | ast: [...], // the ast with the type for very node that returns a value | ||
| - | error_list [] // the error list | + | errors [] // the error list |
| } | } | ||
| </code> | </code> | ||
| Line 298: | Line 298: | ||
| { | { | ||
| type: // string with the error type | type: // string with the error type | ||
| - | line: // the line number in the source (starting at 1) | + | elements: { |
| - | elements: // items for the error, each type of error has different items | + | // items for the error, each type of error has different items |
| + | line: // the line where the error is | ||
| + | }, | ||
| text: // the error text message | text: // the error text message | ||
| } | } | ||
| </code> | </code> | ||
| + | |||
| ==== Error type ==== | ==== Error type ==== | ||
| Line 313: | Line 316: | ||
| <code javascript> | <code javascript> | ||
| { | { | ||
| - | variable: // variable name | + | variable: // variable name, |
| } | } | ||
| </code> | </code> | ||
| Line 337: | Line 340: | ||
| </code> | </code> | ||
| - | === STRUCT_ELEMENT_ALREADY_DEFINED === | + | === STRUCT_PROPERTY_ALREADY_DEFINED === |
| The error occurs when a struct element definition is repeated. | The error occurs when a struct element definition is repeated. | ||
| == Elements == | == Elements == | ||
| { | { | ||
| - | struct: // struct type name | + | type: // struct type title |
| - | element: // element name | + | title: // property title |
| } | } | ||
| Line 352: | Line 355: | ||
| <code javascript> | <code javascript> | ||
| { | { | ||
| - | vector: // array type name | + | array: // array type name |
| - | low_index: // the lower index value | + | length: // the negative length |
| - | high_index: // the higher index value | + | |
| } | } | ||
| </code> | </code> | ||
| Line 367: | Line 369: | ||
| variable: // the name of the variable with the unresolved type | variable: // the name of the variable with the unresolved type | ||
| } | } | ||
| - | // struct element | + | // struct property |
| { | { | ||
| struct: // name of struct type | struct: // name of struct type | ||
| - | element: // name of struct element with the unresolved type | + | property: // name of struct element with the unresolved type |
| } | } | ||
| </code> | </code> | ||
| - | === UNDEFINED_MESSAGE === | + | === UNDEFINED_FUNCTION === |
| - | The error occurs when a function call is made to a function that is not defned. | + | The error occurs when a function call is made to a function that is not defined. |
| == Elements == | == Elements == | ||
| <code javascript> | <code javascript> | ||
| { | { | ||
| - | id: // message name | + | title: // function title |
| } | } | ||
| </code> | </code> | ||
| Line 391: | Line 393: | ||
| <code javascript> | <code javascript> | ||
| { | { | ||
| - | variable: // variable name | + | variable: // variable title |
| } | } | ||
| </code> | </code> | ||
| Line 400: | Line 402: | ||
| == Elements == | == Elements == | ||
| { | { | ||
| - | variable: // the variable that has that type | + | value: // the type that is undefined |
| - | type: // the type that is undefined | + | |
| } | } | ||
| Line 410: | Line 411: | ||
| <code javascript> | <code javascript> | ||
| { | { | ||
| - | struct: // struct name | + | type: // struct title |
| - | property: // element name | + | title: // property title |
| } | } | ||
| </code> | </code> | ||
| Line 435: | Line 436: | ||
| </code> | </code> | ||
| === ARRAY_INDEX_TYPE === | === ARRAY_INDEX_TYPE === | ||
| - | The error occurs when an index for an array is not a number or symbol | + | The error occurs when an index for an array is not an int |
| == Elements == | == Elements == | ||
| <code javascript> | <code javascript> | ||
| { | { | ||
| - | vector: // array type | + | type: // the index type |
| - | index: // supplied index type | + | |
| } | } | ||
| </code> | </code> | ||
| Line 476: | Line 476: | ||
| op: // if, while, repeat | op: // if, while, repeat | ||
| } | } | ||
| - | // for | + | // attribution (including for variable) |
| { | { | ||
| - | exp: // expression type | + | to: // to type, |
| - | op: "for" | + | op: "<-", |
| - | element: // variable, from, to or step | + | from: // from type |
| } | } | ||
| - | // value_of_function | + | // return |
| { | { | ||
| - | op: "value" | + | op: "return" |
| to: // return type | to: // return type | ||
| from: // provided type | from: // provided type | ||
| } | } | ||
| - | // is | + | // iteration (for i in exp go) |
| { | { | ||
| - | op: "is" | + | op: "iteration" |
| - | to: // to type | + | value: // the exp type |
| - | from: // from type | + | |
| } | } | ||
| - | // struct element type is undefined | + | // typecast |
| { | { | ||
| - | struct: // struct type, | + | op: "typecast", |
| - | element: // name of struct element | + | to: // to type, |
| + | from: // from type | ||
| } | } | ||
| - | // variable type is undefined | ||
| - | { | ||
| - | variable: // name of the variable | ||
| - | } | ||
| - | </code> | ||
| === LEXICAL === | === LEXICAL === | ||