Example #1
0
        private void FixupProdRefNodes()
        {
            foreach (var node in _astNodeFactory.AllNodes.Where(p => p.AstNodeType == AstNodeType.ProdRef))
            {
                var prodRefNode = (IProdRefNode)node;
                var prodInfo    = Productions.FirstOrDefault(p => p.Name == prodRefNode.ProdName);
                if (prodInfo == null)
                {
                    throw new SemanticErrorException($"Definition for production {prodRefNode.ProdName} not found.");
                }

                prodRefNode.Expression = prodInfo.Statement.Expression;
            }
        }