Guest User

RedScript

a guest
Jun 29th, 2012
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function compFile()
  2. print("File too compile from:")
  3.     filename = read()
  4.     reader=fs.open(filename,"r") -- Opening the fle to read from
  5. print("File too output too:")
  6.     name = read()
  7.     f=fs.open(name,"a") -- Opening the file too write/append too
  8. datTab={} -- Establishing the table of which things are parsed itno
  9.     print("Compiling now.")
  10. while true do -- The primary loop of which the prgoram is compiled in
  11.     line = reader.readLine() -- This reads the line
  12.     if (not line) then f.close() os.reboot() break end -- This checks and makes it stop when there is a blank line
  13.     datTab = strutils.seperate(line," ") -- This breaks up the line by spaces
  14.       -- Base Commands Here
  15.         if datTab[1]=="echo" then f.writeLine("print("..datTab[2]..")")  -- echo "texthere"
  16.         elseif datTab[1]=="var" then f.writeLine(datTab[2].."="..datTab[3]) -- var x 5
  17.         elseif datTab[1]=="if" then f.writeLine("if "..datTab[2]..datTab[3]..datTab[4].." then ") -- if x == 4
  18.         elseif datTab[1]=="seal" and datTab[2]=="condition" then f.writeLine("end") -- seal if
  19.         elseif datTab[1]=="math" then f.writeLine(datTab[2].."="..datTab[3]..datTab[4]..datTab[5]) -- math x 4 + 6
  20.         elseif datTab[1]=="loop" and datTab[2]=="begin" then f.writeLine("repeat") -- loop
  21.         elseif datTab[1]=="condition" then f.writeLine("until "..datTab[2]..datTab[3]..datTab[4]) -- condition x == 5
  22.         elseif datTab[1]=="function" then f.writeLine("function "..datTab[2].."()") -- function functionname
  23.         elseif datTab[1]=="call" then f.writeLine(datTab[2].."()")
  24.         elseif datTab[1]==("raw" or "lua") then f.writeLine(datTab[2])
  25.         elseif datTab[1]==("rem" or "//") then f.writeLine("--"..datTab[2])
  26.     -- Rednet Commands Here
  27.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="openport" and datTab[3]=="all" then f.writeLine("rednet.open('right') rednet.open('left') rednet.open('top') rednet.open('back')") -- net openport all
  28.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="openport" and datTab[3]~="all" then f.writeLine("rednet.open('"..datTab[3].."')") -- net openport side
  29.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="send" then f.writeLine("rednet.send("..datTab[3]..",('"..datTab[4].."')") -- net send id message
  30.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="close" and datTab[3]=="all" then f.writeLine("rednet.close('back') rednet.close('top') rednet.close('left') rednet.close('right')") -- net close all
  31.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="close" and datTab[3]~="all" then f.writeLine("rednet.close('"..datTab[4].."')") -- net close side
  32.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="test" then f.writeLine("rednet.announce()") -- net test
  33.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="broadcast" then f.writeLine("rednet.broadcast('"..datTab[3].."')") -- net broadcast message
  34.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="receive" then f.writeLine(datTab[3]..","..datTab[4]..","..datTab[5].."=rednet.receive("..datTab[6]..")") -- net receive varnameid varnamemessage varnamedistance time
  35.     -- Peripheral Commands Here
  36.         elseif datTab[1]==("external" or "peripheral") and datTab[2]=="present" then f.writeLine("peripheral.isPresent('"..datTab[3].."')") -- external present side
  37.         elseif datTab[1]==("external" or "peripheral") and datTab[2]=="wrap" then f.writeLine("peripheral.wrap('"..datTab[3].."')") -- external wrap side
  38.         elseif datTab[1]==("external" or "peripheral") and datTab[2]=="type" then f.writeLine("peripheral.getType('"..datTab[3].."')") -- external type side
  39.     -- Disk Commands Here
  40.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="ispresent" then f.writeLine("if disk.isPresent('"..datTab[3].."') then") -- disk ispresent side
  41.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="hasdata" then f.writeLine("if disk.hasData('"..datTab[3].."') then") -- disk hasdata side
  42.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="findlabel" then f.writeLine(datTab[3].."=disk.getLabel('"..datTab[4].. "')") -- disk findlabel varname side
  43.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="setlabel" then f.writeLine("disk.setLabel("..datTab[3]..","..datTab[4]..")") -- disk setlabel side name
  44.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="eject" then f.writeLine("disk.eject('"..datTab[3].."')") -- disk eject side
  45.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="playmusic" then f.writeLine("disk.playAudio('"..datTab[3].."')") -- disk playmusic side
  46.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="stopmusic" then f.writeLine("disk.stopAudio('"..datTab[3].."')") -- disk stopmusic side
  47.     -- Redstone/Cable Commands Here
  48.         elseif datTab[1]==("redstone" or "rs") and datTab[2]=="raw" and datTab[3]=="get" then f.writeLine(datTab[5]"=redstone.getInput('"..datTab[4].."')") -- redstone raw get side varname
  49.         elseif datTab[1]==("redstone" or "rs") and datTab[2]=="raw" and datTab[3]=="set" then f.writeLine("redstone.setOutput("..datTab[4]..","..datTab[5]..")") -- redstone raw set left true
  50.         elseif datTab[1]==("redstone" or "rs") and datTab[2]=="cable" and datTab[3]=="set" then f.writeLine("redstone.setBundledOutput("..datTab[4]..", colors."..datTab[5]..")") -- redstone cable set side color
  51.         elseif datTab[1]==("redstone" or "rs") and datTab[2]=="cable" and datTab[3]=="wipe" then f.writeLine("redstone.setBundledOutput("..datTab[4]..", 0)") -- redstone cable wipe side
  52.         elseif datTab[1]==("redstone" or "rs") and datTab[2]=="cable" and datTab[3]=="get" then f.writeLine(datTab[4]"=colors.test(redstone.getBundledInput('"..datTab[5].."'), colors."..datTab[6]..")") -- redstone cable get varname side color
  53.     -- Shell and Terminal Commands Here
  54.         elseif datTab[1]=="run" then f.writeLine("shell.run('"..datTab[2]..","..datTab[3].."')") -- run programname arguments
  55.         elseif datTab[1]=="exit" and datTab[2]=="program" then f.writeLine("shell.exit()") -- exit program
  56.         elseif datTab[1]=="clear" and datTab[2]=="screen" then f.writeLine("term.clear()")
  57.         elseif datTab[1]=="clear" and datTab[2]=="line" then f.writeLine("term.clearLine()")
  58.         elseif datTab[1]=="get" and datTab[2]=="cursor" then f.writeLine(datTab[3]..","..datTab[4].."=term.getCursorPos()") -- get cursor xvarname yvarname
  59.         elseif datTab[1]=="set" and datTab[2]=="cursor" then f.writeLine("term.setCursorPos("..datTab[3]..","..datTab[4]..")") -- get cursor xvarname yvarname
  60.         elseif datTab[1]=="blink" and datTab[2]=="set" then f.writeLine("term.setCursorBlink("..datTab[3]..")")
  61.         elseif datTab[1]=="get" and datTab[2]=="terminal" and datTab[2]=="size" then f.writeLine(datTab[4]..","..datTab[5].."=term.getSize()") -- get terminal size xvarname yvarname
  62.         elseif datTab[1]=="redirect" and datTab[2]=="monitor" then f.writeLine("term.redirect("..datTab[3]..")") -- redirect monitor size
  63.         elseif datTab[1]=="redirect" and datTab[2]=="terminal" then f.writeLine("term.restore()") -- redirect terminal
  64.     -- OS Commands Here
  65.         elseif datTab[1]=="version" then f.writeLine(datTab[2].."=os.version()") -- version varname
  66.         elseif datTab[1]=="id" then f.writeLine(datTab[2].."=os.computerID()") -- id varname
  67.         elseif datTab[1]==("loadapi" or "include") then f.writeLine("os.loadAPI('"..datTab[2].."')") -- loadapi apiname
  68.         elseif datTab[1]==("unloadapi" or "disinclude") then f.writeLine("os.unloadAPI('"..datTab[2].."')") -- unloadapi apiname
  69.         elseif datTab[1]=="getstring" then f.writeLine(datTab[2].."=read()") -- getstring varname
  70.         elseif datTab[1]==("cputime" or "clock")then f.writeLine(datTab[2].."=os.clock()") -- cputime varname
  71.         elseif datTab[1]=="sleep" then f.writeLine("sleep("..datTab[2]..")") -- sleep 5
  72.         elseif datTab[1]=="time" then f.writeLine(datTab[2].."=os.time()") -- time varname
  73.         elseif datTab[1]=="shutdown" and datTab[2]=="computer" then f.writeLine("os.shutdown()") -- shutdown computer
  74.         elseif datTab[1]=="reboot" and datTab[2]=="computer" then f.writeLine("os.reboot()") -- reboot computer
  75.     -- Fs/Io Commands Here
  76.         elseif datTab[1]=="list" then f.writeLine(datTab[3].."=fs.list('"..datTab[2].."')") -- list path/here/for/whatevers varname
  77.         elseif datTab[1]=="exists" then f.writeLine(datTab[3].."=fs.exists('"..datTab[2].."')") -- exists path/here/for/whatevers varname
  78.         elseif datTab[1]=="isreadonly" then f.writeLine(datTab[3].."=fs.isReadOnly('"..datTab[2].."')") -- isreadonly path/here/for/whatevers varname
  79.         elseif datTab[1]==("getname" or "fetchname") then f.writeLine(datTab[3].."=fs.getName('"..datTab[2].."')") -- getname path/here/for/whatevers varname
  80.         elseif datTab[1]==("makedir" or "mdir") then f.writeLine("fs.makeDir('"..datTab[2].."')") -- makedir path/here/for/whatevers
  81.         elseif datTab[1]=="move" then f.writeLine("fs.move('"..datTab[2].."','"..datTab[3].."')") -- move path/A path/B
  82.         elseif datTab[1]=="copy" then f.writeLine("fs.copy('"..datTab[2].."','"..datTab[3].."')") -- copy path/A path/B
  83.         elseif datTab[1]=="delete" then f.writeLine("fs.delete('"..datTab[2].."')") -- delete path/here/for/whatevers
  84.         elseif datTab[1]=="open" then f.writeLine(datTab[2].."=fs.open('"..datTab[3]..",'"..datTab[4].."')") -- open varname path/here/for/whatevers mode
  85.     -- Math Commands Here
  86.         elseif datTab[1]==("random" or "rand") then f.writeLine(datTab[2].."=math.random("..datTab[3]..")") -- random varname maxnumber
  87.         elseif datTab[1]==("absolute" or "abs") then f.writeLine(datTab[2].."math.abs("..datTab[3]..")") -- absolute varname number
  88.         elseif datTab[1]==("ceiling" or "ceil") then f.writeLine(datTab[2].."=math.ceil("..datTab[3]..")") -- ceiling varname number
  89.         elseif datTab[1]=="floor" then f.writeLine(datTab[2].."=math.floor("..datTab[3]..")") -- floor varname number
  90.         elseif datTab[1]==("power" or "pow") then f.writeLine(datTab[2].."=math.pow("..datTab[3]..","..datTab[4]..")") -- power varname numbera numberb
  91.         elseif datTab[1]=="pi" then f.writeLine(datTab[2].."=math.pi()") -- pi varname
  92.         elseif datTab[1]==("squareroot" or "sqrt") then f.writeLine(datTab[2].."=math.sqrt("..datTab[3]..")") -- squareroot varname number
  93.    
  94.     else print("ERROR: INCORRECT SYNTAX") -- Error code here
  95. end
  96. end
  97. end
  98.  
  99. function interpFile()
  100. state = "running" -- This is what I use to maintain the loop
  101. repeat -- Beginning the loop of which the code is interpreted in
  102. input = read() -- Harvesting the input
  103. datTab=nil -- Making sure that the table is blank and won't have any interruptions
  104. datTab={} -- Establishing the table of which the data is parsed into
  105. if input=="exit" then f.close() os.reboot() end -- Checking for the exit command
  106. if input~=nil then datTab = strutils.seperate(input," ") -- Making sure that the datTab table doesnt get any blank lines
  107.         if datTab[1]=="echo" then f.writeLine("print("..datTab[2]..")")  -- echo "texthere"
  108.         elseif datTab[1]=="var" then f.writeLine(datTab[2].."="..datTab[3]) -- var x 5
  109.         elseif datTab[1]=="if" then f.writeLine("if "..datTab[2]..datTab[3]..datTab[4].." then ") -- if x == 4
  110.         elseif datTab[1]=="seal" and datTab[2]=="condition" then f.writeLine("end") -- seal if
  111.         elseif datTab[1]=="math" then f.writeLine(datTab[2].."="..datTab[3]..datTab[4]..datTab[5]) -- math x 4 + 6
  112.         elseif datTab[1]=="loop" and datTab[2]=="begin" then f.writeLine("repeat") -- loop
  113.         elseif datTab[1]=="condition" then f.writeLine("until "..datTab[2]..datTab[3]..datTab[4]) -- condition x == 5
  114.         elseif datTab[1]=="function" then f.writeLine("function "..datTab[2].."()") -- function functionname
  115.         elseif datTab[1]=="call" then f.writeLine(datTab[2].."()")
  116.         elseif datTab[1]==("raw" or "lua") then f.writeLine(datTab[2])
  117.         elseif datTab[1]==("rem" or "//") then f.writeLine("--"..datTab[2])
  118.     -- Rednet Commands Here
  119.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="openport" and datTab[3]=="all" then f.writeLine("rednet.open('right') rednet.open('left') rednet.open('top') rednet.open('back')") -- net openport all
  120.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="openport" and datTab[3]~="all" then f.writeLine("rednet.open('"..datTab[3].."')") -- net openport side
  121.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="send" then f.writeLine("rednet.send("..datTab[3]..",('"..datTab[4].."')") -- net send id message
  122.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="close" and datTab[3]=="all" then f.writeLine("rednet.close('back') rednet.close('top') rednet.close('left') rednet.close('right')") -- net close all
  123.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="close" and datTab[3]~="all" then f.writeLine("rednet.close('"..datTab[4].."')") -- net close side
  124.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="test" then f.writeLine("rednet.announce()") -- net test
  125.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="broadcast" then f.writeLine("rednet.broadcast('"..datTab[3].."')") -- net broadcast message
  126.         elseif datTab[1]==("net" or "rednet") and datTab[2]=="receive" then f.writeLine(datTab[3]..","..datTab[4]..","..datTab[5].."=rednet.receive("..datTab[6]..")") -- net receive varnameid varnamemessage varnamedistance time
  127.     -- Peripheral Commands Here
  128.         elseif datTab[1]==("external" or "peripheral") and datTab[2]=="present" then f.writeLine("peripheral.isPresent('"..datTab[3].."')") -- external present side
  129.         elseif datTab[1]==("external" or "peripheral") and datTab[2]=="wrap" then f.writeLine("peripheral.wrap('"..datTab[3].."')") -- external wrap side
  130.         elseif datTab[1]==("external" or "peripheral") and datTab[2]=="type" then f.writeLine("peripheral.getType('"..datTab[3].."')") -- external type side
  131.     -- Disk Commands Here
  132.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="ispresent" then f.writeLine("if disk.isPresent('"..datTab[3].."') then") -- disk ispresent side
  133.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="hasdata" then f.writeLine("if disk.hasData('"..datTab[3].."') then") -- disk hasdata side
  134.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="findlabel" then f.writeLine(datTab[3].."=disk.getLabel('"..datTab[4].. "')") -- disk findlabel varname side
  135.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="setlabel" then f.writeLine("disk.setLabel("..datTab[3]..","..datTab[4]..")") -- disk setlabel side name
  136.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="eject" then f.writeLine("disk.eject('"..datTab[3].."')") -- disk eject side
  137.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="playmusic" then f.writeLine("disk.playAudio('"..datTab[3].."')") -- disk playmusic side
  138.         elseif datTab[1]==("disk" or "disc") and datTab[2]=="stopmusic" then f.writeLine("disk.stopAudio('"..datTab[3].."')") -- disk stopmusic side
  139.     -- Redstone/Cable Commands Here
  140.         elseif datTab[1]==("redstone" or "rs") and datTab[2]=="raw" and datTab[3]=="get" then f.writeLine(datTab[5]"=redstone.getInput('"..datTab[4].."')") -- redstone raw get side varname
  141.         elseif datTab[1]==("redstone" or "rs") and datTab[2]=="raw" and datTab[3]=="set" then f.writeLine("redstone.setOutput("..datTab[4]..","..datTab[5]..")") -- redstone raw set left true
  142.         elseif datTab[1]==("redstone" or "rs") and datTab[2]=="cable" and datTab[3]=="set" then f.writeLine("redstone.setBundledOutput("..datTab[4]..", colors."..datTab[5]..")") -- redstone cable set side color
  143.         elseif datTab[1]==("redstone" or "rs") and datTab[2]=="cable" and datTab[3]=="wipe" then f.writeLine("redstone.setBundledOutput("..datTab[4]..", 0)") -- redstone cable wipe side
  144.         elseif datTab[1]==("redstone" or "rs") and datTab[2]=="cable" and datTab[3]=="get" then f.writeLine(datTab[4]"=colors.test(redstone.getBundledInput('"..datTab[5].."'), colors."..datTab[6]..")") -- redstone cable get varname side color
  145.     -- Shell and Terminal Commands Here
  146.         elseif datTab[1]=="run" then f.writeLine("shell.run('"..datTab[2]..","..datTab[3].."')") -- run programname arguments
  147.         elseif datTab[1]=="exit" and datTab[2]=="program" then f.writeLine("shell.exit()") -- exit program
  148.         elseif datTab[1]=="clear" and datTab[2]=="screen" then f.writeLine("term.clear()")
  149.         elseif datTab[1]=="clear" and datTab[2]=="line" then f.writeLine("term.clearLine()")
  150.         elseif datTab[1]=="get" and datTab[2]=="cursor" then f.writeLine(datTab[3]..","..datTab[4].."=term.getCursorPos()") -- get cursor xvarname yvarname
  151.         elseif datTab[1]=="set" and datTab[2]=="cursor" then f.writeLine("term.setCursorPos("..datTab[3]..","..datTab[4]..")") -- get cursor xvarname yvarname
  152.         elseif datTab[1]=="blink" and datTab[2]=="set" then f.writeLine("term.setCursorBlink("..datTab[3]..")")
  153.         elseif datTab[1]=="get" and datTab[2]=="terminal" and datTab[2]=="size" then f.writeLine(datTab[4]..","..datTab[5].."=term.getSize()") -- get terminal size xvarname yvarname
  154.         elseif datTab[1]=="redirect" and datTab[2]=="monitor" then f.writeLine("term.redirect("..datTab[3]..")") -- redirect monitor size
  155.         elseif datTab[1]=="redirect" and datTab[2]=="terminal" then f.writeLine("term.restore()") -- redirect terminal
  156.     -- OS Commands Here
  157.         elseif datTab[1]=="version" then f.writeLine(datTab[2].."=os.version()") -- version varname
  158.         elseif datTab[1]=="id" then f.writeLine(datTab[2].."=os.computerID()") -- id varname
  159.         elseif datTab[1]==("loadapi" or "include") then f.writeLine("os.loadAPI('"..datTab[2].."')") -- loadapi apiname
  160.         elseif datTab[1]==("unloadapi" or "disinclude") then f.writeLine("os.unloadAPI('"..datTab[2].."')") -- unloadapi apiname
  161.         elseif datTab[1]=="getstring" then f.writeLine(datTab[2].."=read()") -- getstring varname
  162.         elseif datTab[1]==("cputime" or "clock")then f.writeLine(datTab[2].."=os.clock()") -- cputime varname
  163.         elseif datTab[1]=="sleep" then f.writeLine("sleep("..datTab[2]..")") -- sleep 5
  164.         elseif datTab[1]=="time" then f.writeLine(datTab[2].."=os.time()") -- time varname
  165.         elseif datTab[1]=="shutdown" and datTab[2]=="computer" then f.writeLine("os.shutdown()") -- shutdown computer
  166.         elseif datTab[1]=="reboot" and datTab[2]=="computer" then f.writeLine("os.reboot()") -- reboot computer
  167.     -- Fs/Io Commands Here
  168.         elseif datTab[1]=="list" then f.writeLine(datTab[3].."=fs.list('"..datTab[2].."')") -- list path/here/for/whatevers varname
  169.         elseif datTab[1]=="exists" then f.writeLine(datTab[3].."=fs.exists('"..datTab[2].."')") -- exists path/here/for/whatevers varname
  170.         elseif datTab[1]=="isreadonly" then f.writeLine(datTab[3].."=fs.isReadOnly('"..datTab[2].."')") -- isreadonly path/here/for/whatevers varname
  171.         elseif datTab[1]==("getname" or "fetchname") then f.writeLine(datTab[3].."=fs.getName('"..datTab[2].."')") -- getname path/here/for/whatevers varname
  172.         elseif datTab[1]==("makedir" or "mdir") then f.writeLine("fs.makeDir('"..datTab[2].."')") -- makedir path/here/for/whatevers
  173.         elseif datTab[1]=="move" then f.writeLine("fs.move('"..datTab[2].."','"..datTab[3].."')") -- move path/A path/B
  174.         elseif datTab[1]=="copy" then f.writeLine("fs.copy('"..datTab[2].."','"..datTab[3].."')") -- copy path/A path/B
  175.         elseif datTab[1]=="delete" then f.writeLine("fs.delete('"..datTab[2].."')") -- delete path/here/for/whatevers
  176.         elseif datTab[1]=="open" then f.writeLine(datTab[2].."=fs.open('"..datTab[3]..",'"..datTab[4].."')") -- open varname path/here/for/whatevers mode
  177.     -- Math Commands Here
  178.         elseif datTab[1]==("random" or "rand") then f.writeLine(datTab[2].."=math.random("..datTab[3]..")") -- random varname maxnumber
  179.         elseif datTab[1]==("absolute" or "abs") then f.writeLine(datTab[2].."math.abs("..datTab[3]..")") -- absolute varname number
  180.         elseif datTab[1]==("ceiling" or "ceil") then f.writeLine(datTab[2].."=math.ceil("..datTab[3]..")") -- ceiling varname number
  181.         elseif datTab[1]=="floor" then f.writeLine(datTab[2].."=math.floor("..datTab[3]..")") -- floor varname number
  182.         elseif datTab[1]==("power" then or "pow") f.writeLine(datTab[2].."=math.pow("..datTab[3]..","..datTab[4]..")") -- power varname numbera numberb
  183.         elseif datTab[1]=="pi" then f.writeLine(datTab[2].."=math.pi()") -- pi varname
  184.         elseif datTab[1]==("squareroot" or "sqrt") then f.writeLine(datTab[2].."=math.sqrt("..datTab[3]..")") -- squareroot varname number
  185.    
  186.     else print("ERROR: INCORRECT SYNTAX") -- Error code here
  187. end
  188. end
  189. until state~="running" -- Checking for if the loop has been broken
  190. end
  191.  
  192. function interpBegin() -- A precursor/preperation function for the actual interpFile()
  193. print("Name of file too output too:")
  194. local name=read()
  195.     f=fs.open(name,"a") -- Opening the file too write/append too
  196.     datTab={}
  197. print("Begin your scripting:")
  198. print("_____________________")
  199.     interpFile() -- Calling the main interpreter function
  200. end
  201.  
  202. function intro() -- The primary introduction function
  203. term.clear() -- Clearing the screen
  204. term.setCursorPos(1,1) -- Setting the cursor position
  205. print("Welcome to the RedScript Scripting Tool") -- Presenting the information about the input
  206. print("1 - Interpreter")
  207. print("2 - Compiler")
  208. while true do -- The input loop
  209. event, p1 = os.pullEvent() -- Harvesting input
  210. if event=="char" and p1=="1" then interpBegin() -- Checking for if they want too interpret
  211. elseif event=="char" and p1=="2" then compFile() -- Or if they want too compile
  212. end
  213. end
  214. end
  215. intro() -- Calling the introduction function
Advertisement
Add Comment
Please, Sign In to add comment