public ErlangExpression Parse(string code) { var expression = ErlangSyntaxNode.ParseExpression(new TokenBuffer(ErlangToken.Tokenize(new TextBuffer(code)))); var compiledExpr = ErlangExpression.Compile(expression); return(compiledExpr); }
private static bool TryBind(string code, ErlangValue value) { var frame = new ErlangStackFrame("test", "test", 0); var expression = ErlangSyntaxNode.ParseExpression(new TokenBuffer(ErlangToken.Tokenize(new TextBuffer(code)))); var compiledExpr = ErlangExpression.Compile(expression); return(ErlangBinder.TryBindParameter(compiledExpr, value, frame)); }
private static ErlangValue BindAndFetchVariable(string code, ErlangValue valueToBind, string variable) { var frame = new ErlangStackFrame("test", "test", 0); var expression = ErlangSyntaxNode.ParseExpression(new TokenBuffer(ErlangToken.Tokenize(new TextBuffer(code)))); var compiledExpr = ErlangExpression.Compile(expression); Assert.True(ErlangBinder.TryBindParameter(compiledExpr, valueToBind, frame), $"Failure binding to '{code}'."); return(frame.GetVariable(variable)); }
public void ParseOtp() { foreach (var file in Directory.EnumerateFiles(OTPSources, "*.erl")) { Console.WriteLine($"Parsing {file}."); var code = File.ReadAllText(file); var expression = ErlangSyntaxNode.ParseExpression(new TokenBuffer(ErlangToken.Tokenize(new TextBuffer(code)))); var compiledExpr = ErlangExpression.Compile(expression); } }
private static ErlangToken[] Tokenize(string text) { return(ErlangToken.Tokenize(new TextBuffer(text)).ToArray()); }