コード例 #1
0
ファイル: Evaluator.cs プロジェクト: envlang/env
 public static string EvaluateWrap(Ast.AstNode source)
 => Evaluate(source, new Dictionary <string, Ast.Val> {
     { "true", Ast.Val.Bool(true) },
     { "false", Ast.Val.Bool(false) }
 }.ToImmutableDictionary()).Match(
     Int: i => i.ToString(),
     String: s => s,
     Bool: b => b ? "true" : "false");
コード例 #2
0
        public ScopeInfo(Ast.AstNode ownerNode, string name = "")
        {
            Util.Check(ownerNode != null, "ScopeInfo owner node must not be null.");

            OwnerNode = ownerNode;
            Level     = Parent == null ? 0 : Parent.Level + 1;
            slots     = new SlotInfoDictionary();
            Name      = name;
        }
コード例 #3
0
        public void Create(Ast.AstNode ast, string url)
        {
            Visit(ast);

            Debug.Assert(m_assembly != null);

            m_assembly.SetEntryPoint(m_mainMethod, PEFileKinds.ConsoleApplication);
            m_assembly.Save(url);
        }
コード例 #4
0
ファイル: JS.cs プロジェクト: envlang/env
        public static string Compile(Ast.AstNode source)
        {
            return("process.stdout.write(String("
                   + "\"NO JavaScript COMPILATION FOR NOW\""

/*      + source.Match(
 *       Int: i => i.ToString(),
 *       String: s => $"'{s.ToString()}'"
 *      )*/
                   + "));");
        }
コード例 #5
0
ファイル: Evaluator.cs プロジェクト: envlang/env
 public static Ast.Val Evaluate(Ast.AstNode source, ImmutableDictionary <string, Ast.Val> env)
 // => Log(source.Str(), ()
 => source.Match(