Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class compiler{
- string filename = "main.m";
- string[] functions;
- string text;
- char[] letters;
- int length;
- public compiler()
- {
- FileUtils.get_contents (filename, out text);
- }
- char[] string_to_char_array(string str) {
- char[] char_array = new char[str.length];
- for (int i = 0; i < str.length; i++){
- char_array[i] = (char)str.get_char(str.index_of_nth_char(i));
- }
- return char_array;
- }
- void doit ()
- {
- stdout.printf("1");
- char[] char_array = string_to_char_array(text);
- stdout.printf("2");
- for (int i=0; i < char_array.length; i++) {
- //stdout.printf("-");
- //stdout.printf("%c", char_array[i]);
- //stdout.printf("-");
- if(char_array[i] == (char)"-")
- {
- stdout.printf("4");
- if(char_array[i + 1] == (char)" ")
- {
- stdout.printf("5");
- if(char_array[i + 2] == (char)"(")
- {
- stdout.printf("6");
- //int a = i + 2;
- //functions += assemble(char_array, a, get_howlong(char_array, a));
- bool quit = false;
- int index = i + 2;
- int start = index;
- string finale_string;
- stdout.printf("7");
- while (quit == false)
- {
- stdout.printf("8");
- if(char_array[index] == (char)")")
- {
- stdout.printf("9");
- quit = true;
- length = index - start;
- }
- else
- {
- stdout.printf("10");
- index++;
- }
- }
- stdout.printf("11");
- for(var k = i + 2; k < length; k++)
- {
- stdout.printf("12-");
- letters += char_array[k];
- }
- stdout.printf("13");
- finale_string = (string)letters;
- functions += finale_string;
- stdout.printf("14");
- //end
- }
- }
- }
- }
- for(var a = 0; a < functions.length; a++)
- {
- stdout.printf("%s\n + hey", functions[a]);
- }
- }
- static int main (string[] args) {
- compiler _compiler = new compiler();
- _compiler.doit();
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement