Beispiel #1
0
        private static void Evaluate(string line, Env stdLibEnv)
        {
            Node node = Parse(line);

            if (node != null)
            {
                node = MacroExpander.ExpandMacros(node, stdLibEnv);
                Evaluator.Evaluate(node, stdLibEnv);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Create environment with standard libraries loaded.
        /// </summary>
        /// <returns></returns>
        public static Env CreateStdLibEnv()
        {
            Env stdLibEnv = new Env(null);

            BuiltinFunsSetter.AddStdBuiltins(stdLibEnv);

            LoadStdLib(stdLibEnv);

            // Make a final pass over all functions in the stdLibEnv to expand all macros.
            MacroExpander.ExpandAllMacros(stdLibEnv);

            return(stdLibEnv);
        }