While testing tscc with the https://github.com/Hadron67/tscc-compiler/blob/master/examples/zend/jzend_parser.y and intentionally commenting this line:
When trying to execute it on https://hadroncfy.com/tscc-compiler/web-demo/
Uncaught TypeError: Cannot read properties of undefined (reading 'pr')
at Object.defineRulePr (tscc.js:2963:28)
at jjdoReduction (tscc.js:5873:24)
at jjtryReduce (tscc.js:6060:13)
at jjacceptToken (tscc.js:6042:21)
at jjdoLexAction (tscc.js:5300:36)
at jjacceptChar (tscc.js:5388:21)
at nextToken (tscc.js:4861:17)
at Object.parse (tscc.js:4900:17)
at yyparse (tscc.js:6237:12)
at Object.compile (tscc.js:8480:17)
With this change it seems to work:
else {
var pt = _pseudoTokens[token.val];
if(!pt){
singlePosErr(`pseudo token "${token}" is not defined`, token);
}
else _top().pr = pt.pr; ///<<< adding `else` before
}
While testing
tsccwith the https://github.com/Hadron67/tscc-compiler/blob/master/examples/zend/jzend_parser.y and intentionally commenting this line:When trying to execute it on https://hadroncfy.com/tscc-compiler/web-demo/
With this change it seems to work: