Beispiel #1
0
    private Macaca.Object TestEvaluate(string input)
    {
        var lexer     = new Macaca.Lexer(input);
        var parser    = new Macaca.Parser(lexer);
        var evaluator = new Macaca.Evaluator(parser.ParseProgram());

        return(evaluator.Eval());
    }
Beispiel #2
0
    public void REPL()
    {
        var lexer     = new Macaca.Lexer(mInputField.text);
        var parser    = new Macaca.Parser(lexer);
        var evaluator = new Macaca.Evaluator(parser.ParseProgram());
        var sb        = new System.Text.StringBuilder(mInputField.text);

        sb.Append('\n');
        sb.Append(evaluator.Eval().Inspect());
        sb.Append('\n');

        mInputField.text = sb.ToString();
    }