25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

2 년 전
  1. using System;
  2. using System.IO;
  3. namespace SuperBASIC
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. try
  10. {
  11. Library lib = new Library();
  12. #if MEMORY
  13. lib.AddFunction(new Functions.MemoryLoad(), 1, "MEMLOAD");
  14. lib.AddFunction(new Functions.MemoryStore(), 2, "MEMSTORE");
  15. #endif
  16. lib.AddFunction(new Functions.Print(), 1, "PRINT");
  17. lib.AddFunction(new Functions.Multiply(), 2, "MULTIPLY");
  18. lib.AddFunction(new Functions.Add(), 2, "ADD");
  19. lib.AddFunction(new Functions.Compare(), 2, "COMPARE");
  20. lib.AddFunction(new Functions.JumpZero(), 2, "JZ");
  21. lib.AddFunction(new Functions.Goto(), 1, "GOTO");
  22. lib.AddFunction(new Functions.Pi(), 0, "PI");
  23. lib.AddFunction(new Functions.Euler(), 0, "EULER");
  24. Runtime r = new Runtime(lib);
  25. if (args.Length <= 1)
  26. {
  27. r.OpenFile(Directory.GetCurrentDirectory() + "\\Test.basic");
  28. }
  29. else
  30. {
  31. r.OpenFile(args[1]);
  32. }
  33. r.Run();
  34. } catch (Parser.ParseException e)
  35. {
  36. Console.WriteLine($"Parsing failed:\n{e}");
  37. }
  38. }
  39. }
  40. }