UNPKG

mframejs

Version:
40 lines (31 loc) 956 B
/** * Symbol template * Will be used by our symbol class as template for new symbols/infix/prefix * */ export class SymbolTemplate { /** * nud = null denotation * A nud does not care about the tokens to the left. A led does * A nud method is used by values (such as variables and literals) and by prefix operators * */ public nud() { console.error('Undefined.'); } /** * led = left denotation * A led t care about the tokens to the left. A nud does not * A led method is used by infix operators and suffix operators * */ public led() { console.error('Missing operator.'); } /** * note * A token may have both a nud method and a led method. * For example, - might be both a prefix operator (negation) and an infix operator (subtraction), so it would have both nud and led methods * */ }