Exemplo n.º 1
0
        public void GenerateCode()
        {
            _writer = null;
            _cg = null;

            SelectCodeGenerator();
            SM.Calculate();
            _cg.Emit(SM);
        }
Exemplo n.º 2
0
        private void SelectCodeGenerator()
        {
            if (null == _cg)
            {
                EstablishCodeWriter();

                switch (Parameters.Language)
                {
                    case "C#":
                        _cg = new CSharpCodeGenerator(_writer);
                        break;

                    case "jscript":
                        _cg = new JScriptCodeGenerator(_writer);
                        break;

                    case "pseudo":
                        _cg = new PseudoCodeGenerator(_writer);
                        break;

                    default:
                        throw new Exception("target language " + Parameters.Language + " is not supported.");
                }

                _cg.Parameters = Parameters;
            }
        }