Example #1
0
        public JsonResult Compile(CodeRequestDTO codeRequest)
        {
            try
            {
                IOrangeLanguage dstLanguage =
                    compiler.GetConcreteLanguageImplementation(codeRequest.DstLanguage);

                string compiledCode = compiler.Compile(dstLanguage, codeRequest.Code);

                CodeAnswerDTO translatedCode = new CodeAnswerDTO(compiledCode);

                return(Json(translatedCode));
            }
            catch (Exception ex)
            {
                // Log something somewhere ...maybe later
                return(Json(new CodeAnswerDTO("Error", ex.Message)));
            }
        }
Example #2
0
        public string Compile(IOrangeLanguage lang, string code)
        {
            ClanguageCompiler cl = new ClanguageCompiler();


            // PARSING

            // CALLING IOrangeLanguage METHODS IN ORDER TO PROCESS THE CODE
            string str     = " °°";
            string pattern = @"[^\n\}].*\((([^()]+)|)\)";
            string input   = code;

            RegexOptions options = RegexOptions.Multiline;

            //str = Regex.Matches(input, pattern, options).ToString();
            foreach (Match m in Regex.Matches(input, pattern, options))
            {
                str = str + m.Value + " °° ";
            }



            bool cazzivari = false;

            while (cazzivari)
            {
                // lang.processInstruction("in a = 6;");
            }

            cl.originalCode = code;
            cl.toXML();



            return("Blue Orange Compiler at Work " + (new Random().Next(0, 100)).ToString() + "\n\n" + cl.xmlCode);
        }
Example #3
0
 public string VariablesDefinition(string variablesToBeTranslated, IOrangeLanguage language)
 {
     throw new System.NotImplementedException();
 }