116 posts
Posted 25 June 2012 - 06:12 PM
RedScript
RedScript, is a language that is compiled and interpreted inside of CC. It takes input in RedScript and outputs it as Lua. I (Sledger721) created it as a single Lua program, and please don't criticize my scripting, especially the formatting. I make things work, I don't make them pretty :P/>/>. Documentation is coming soon, but it is already in the code, after each command there is a comment showing how too use the command.Download:
http://pastebin.com/3aLeK1fLRedscript code example:
http://imgur.com/HFF7pLua code example:
http://imgur.com/A9WYFAnd some code examples from Lua too RedScript:
-----------------------------------------Lua
-- This is the server code. For the client, go to http://pastebin.com/peCQzp0E
print("Running eMail server")
rednet.open("right")
while true do
id, message = rednet.receive()
if message == "con" then
rednet.broadcast("Computer " .. id .. " connected to the BBS")
print("Computer " .. id .. " connected to the BBS via Modem.")
end
if message == "readmail" and fs.exists(id) then
mail = fs.open(id, "r")
print("Computer " .. id .. " read his Mail.")
readmail = mail.readAll()
rednet.broadcast(readmail)
mail.close()
fs.delete(id)
end
if message == "sendmail" then
id1, to = rednet.receive()
mail = fs.open(to, "w")
mail.writeLine("From: " .. id)
mail.writeLine("To: " .. to)
id2, tm = rednet.receive()
mail.write(tm)
mail.close()
print("Computer " .. id .. " sent Mail to " .. to)
end
end
----------------------------------------------Redscript
rem This is the server code. For the client, go to [linkhere that i just didnt want too type]
echo "Running eMail Server"
net openport right
var never 1
loop begin
net receive id message distance 10000 rem Yes, here, I couldnt get the infinite time, but that should definetly be enough
if message == "con"
net broadcast "Computer "..id.." connected to the BBS via Modem."
echo "Computer "..id.." connected to the BBS via Modem."
seal condition
var a 0
var b 2
if message == "readmail"
var a = 1
seal condition
if exists id then
var b = 1
seal condition
if a == b
open mail id r
echo "Computer "..id.." read his Mail."
var readmail mail.readAll()
net broadcast readmail
raw mail.close()
delete id
seal condition
if message == "sendmail"
463 posts
Location
Germany
Posted 25 June 2012 - 06:43 PM
Great! But why did you make a redscript interpreter?
116 posts
Posted 25 June 2012 - 06:46 PM
I just felt like making a programming language, the interpreter came out first and I later turned it into the compiler and kept both.
463 posts
Location
Germany
Posted 25 June 2012 - 07:05 PM
:P/>/>
116 posts
Posted 25 June 2012 - 07:30 PM
:P/>/>
26 posts
Posted 26 June 2012 - 02:21 AM
I just felt like making a programming language, the interpreter came out first and I later turned it into the compiler and kept both.
That's 'scripting', Sir DerpsaLot :P/>/>
718 posts
Location
Hawaii
Posted 26 June 2012 - 02:38 AM
:P/>/>, tommyroyall and adera broke the rules?
No 1 word posts.
Also, nice language, i'm gonna try to create a program with it.
116 posts
Posted 26 June 2012 - 03:24 AM
Yes, I did, I'm sorry :P/>/>.
And thanks man, the language itself is really easy to add too and to mod, so it's quite versatile, it can interpret and compile, etc.
And thanks for using it, I'm thinking of maybe even making it embeddable into Lua :)/>/>.
278 posts
Posted 26 June 2012 - 09:33 AM
OMFG! Awesome! I can finally start teaching lua without using lua (Translation :P/>/>) You don't mind do you?
EDIT: Dis is gonna take some getting used to… x_x :)/>/>
116 posts
Posted 26 June 2012 - 04:32 PM
Go ahead mrminer, also, if you look deeply at the code, it's very pliable and easy too change the syntax and add new commands :P/>/>. Tell me if you want a little help with the modding/additions. Also, please use it as much as you can :)/>/>.
278 posts
Posted 27 June 2012 - 04:25 AM
Well, thanks to some inspiring code (By you) I am working on my own scripting language for my OS, ShadOS. The main difference is: running files straight off, example: 'SScript run test', and that will read the file - 'test', create a file, write to it, run it, and delete it. It will also have a compiler/decompiler.
Forgot to say:
Long commands like shell.run(blah) are handled like this:
'run
SScript
test'
that will make it run SScript, which will interpret the file called test.
116 posts
Posted 27 June 2012 - 04:48 AM
Wow, thanks mrminer, thanks man :)/>/>.
Also, please do tell me if you need help or advice with that language, it sounds like it'll be quite fun :P/>/>.
And a good idea that people have been throwing around, is too have the OS run file extensions, so like, maybe if your language is called ShadowScript, have the extension be .shs, then there's .txt, .lua, .sys (system), and of course, .red (redscript) :3
278 posts
Posted 27 June 2012 - 04:56 AM
Wow, thanks mrminer, thanks man :)/>/>.
Also, please do tell me if you need help or advice with that language, it sounds like it'll be quite fun :P/>/>.
And a good idea that people have been throwing around, is too have the OS run file extensions, so like, maybe if your language is called ShadowScript, have the extension be .shs, then there's .txt, .lua, .sys (system), and of course, .red (redscript) :3
I had a better look at the start of your code, it seems easy enough to make it run on one line. Redesining now…
Oh yesh: Do you have a custom lua code command? Example of mine: 'custom printer.drawChar("H",1,1)' It will write the 'printer.drawChar("H",1,1)' to the file.
9 posts
Posted 27 June 2012 - 09:21 AM
I just felt like making a programming language, the interpreter came out first and I later turned it into the compiler and kept both.
That's 'scripting', Sir DerpsaLot :P/>/>
Scripting languages are still programming languages. Furthermore, the term "scripting language" is heavily debatable (much like whether a system is 8-bit or 16-bit), whereas "programming language" isn't under such debate. I suggest you just change it back to what it was.
Anyhow, after all those stupid viruses it's nice to see an actual programming language for once (=
278 posts
Posted 27 June 2012 - 02:14 PM
Anyhow, after all those stupid viruses it's nice to see an actual programming language for once (=
LMAO…
I'm working on my own spreading virus… After I finish my language… (SScript (Extention: .shs))
116 posts
Posted 27 June 2012 - 03:14 PM
Lol, nice mrminer, I'll make sure to scan all .shs files :P/>/>
Also GreaseMonkey, thanks, and I do agree.
I'm thinking about maybe setting up a networking architecture, that runs with applets, and a small scripting language for the data :3 it'll be quite the project, but I think that I can do it.
496 posts
Location
New Zealand
Posted 29 June 2012 - 12:09 AM
Have you even tried using this yourself it is filled with errors.
116 posts
Posted 29 June 2012 - 12:13 AM
I'm aware Tomass, this was just a proto-type, a proof of concept showing that it could be done. This was barely test, and is by no means a finished product.
496 posts
Location
New Zealand
Posted 29 June 2012 - 01:45 AM
I'm aware Tomass, this was just a proto-type, a proof of concept showing that it could be done. This was barely test, and is by no means a finished product.
Yeh I understand that it may be work in progress type thing but it doesn't even run without fixing it first.
116 posts
Posted 29 June 2012 - 05:04 AM
It starts up fine and runs fine for me with no errors, maybe it's because I called the strutils stringutils. Oh god, I just remembered that *facepalm*.
537 posts
Location
Copenhagen, Denmark
Posted 29 June 2012 - 05:26 PM
This is a very bad way of interpreting something. If you do, say "var x 5"(notice the 2 spaces), it will not work. Bad idea, just saying. A simple typo will ruin the programme.
2 posts
Posted 30 June 2012 - 05:59 PM
do you think you could pull this off with Java?
116 posts
Posted 30 June 2012 - 06:10 PM
I highly doubt that I could do this with Java, the power of Lua is far below that of Java, and java is an entirely different type of language, I do apologize :P/>/>.
496 posts
Location
New Zealand
Posted 01 July 2012 - 03:23 AM
do you think you could pull this off with Java?
Are you meaning make this interpreter in Java,
Or are you meaning interpret Java with this?
278 posts
Posted 02 July 2012 - 05:27 AM
Well, my SScript is way too buggy to run (Error: Error: Error: x_x) so, instead of making a new program, I am changing & adding commands, doing options, making command subtypes and messing with the code generally. I'll give you the code soon, it's almost done! :P/>/>:)/>:D:D:D :D/>/>
116 posts
Posted 02 July 2012 - 06:16 PM
Nice mrminer, I hope to see it. After-all, this was just a proof-of-concept to get people writing their own :P/>/>.
474 posts
Posted 02 July 2012 - 08:30 PM
Nice mrminer, I hope to see it. After-all, this was just a proof-of-concept to get people writing their own :P/>/>.
I might add this on my server so you can do ./script.red (like in Terminal) and it runs RedScript files.
278 posts
Posted 03 July 2012 - 03:47 AM
Nice mrminer, I hope to see it. After-all, this was just a proof-of-concept to get people writing their own :)/>/>.
I have PM'd you my prototype, I am still going to add table API etc and maybe more. It will be released when I finish table and maybe more (A week I'd say :P/>/>) :D/>/> Later