You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1003 B

3 years ago
  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.Compare(), 2, "COMPARE");
  19. lib.AddFunction(new Functions.JumpZero(), 2, "JZ");
  20. lib.AddFunction(new Functions.Goto(), 1, "GOTO");
  21. lib.AddFunction(new Functions.Pi(), 0, "PI");
  22. lib.AddFunction(new Functions.Euler(), 0, "EULER");
  23. Runtime r = new Runtime(lib);
  24. if (args.Length <= 1)
  25. {
  26. r.OpenFile(Directory.GetCurrentDirectory() + "\\Test.basic");
  27. }
  28. else
  29. {
  30. r.OpenFile(args[1]);
  31. }
  32. r.Run();
  33. } catch (Parser.ParseException e)
  34. {
  35. Console.WriteLine($"Parsing failed:\n{e}");
  36. }
  37. }
  38. }
  39. }