|
| 10 Nov 2016 08:04 PM |
read: I've been at this off and on for a few months now, but it's finally starting to pan out.
A long while back, I thought it'd be pretty cool if I could add modding support to a game. But then I thought, 'Crap, I don't want to use loadstring() or something of the sort.' So I decided to work on a language, which is currently unnamed. There's only one thing I don't have sorted out-- writing a VM. I'm not really sure how to do this in any environment. Anybody have any pointers on how I should go about creating a (of course, virtual) bytecode format that I could compile a high-level language to?
Also, I'm wondering about how I should go about writing a preprocessor (for macro support!). Would regular expressions work well for this, or should I use another method? (I've already ported LuLPeg to modulescripts for that reason.)
I'm writing this in Python, and planning to transplant it to Lua once I'm done. (I'll make sure to limit usage of classes and functionality like that when writing in Py to make my work easier).
I need help, as I'd like to actually release this to all ROBLOX devs for free for implementation in their games to engage user interactivity, i.e., developers would be able to write APIs in Lua and give docs to users, but users would be able to upload mods (ideally to pbin) and load them in their own servers. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:06 PM |
| Sorry, technically I should've categorized this as a scripting language since it doesn't compile to object code. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:12 PM |
| Ah, I really should get onto the ######### I wouldn't get just cricket chirps there. But alas, I have literally no creations that could get me onto there, however, I know I'm on par as far as my coding conventions and knowledge goes. Even hearing someone like Flux or cnt say, "You can't do this, ###### ## ####### would be preferable compared to this lack of input. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:12 PM |
dev forum**,
you're an imbecile** |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:13 PM |
| if it doesnt run on another known language then it would be harder to make so i recommend just learning how to make a compiler and then use it to compile a bit of sample code |
|
|
| Report Abuse |
|
|
Crimsonal
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1795 |
|
|
| 10 Nov 2016 08:14 PM |
You can't do this, you're an imbecile.
jk |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Nov 2016 08:14 PM |
You have a few solutions:
1. compile to Lua bytecode and just pass it into loadstring -> this won't work on Roblox because you can't loadstring bytecode anymore 2. write an already-designed VM in Lua (a few people have actually already made a Lua Bytecode Interpreter so you can actually compile your language to Lua bytecode) 3. design your own VM (which is what I always do)
The thing about preprocessing is you can't necessarily just "find and replace" because what if it's in a string: #define ABC 123 print("ABC defg") should not print 123 defg for example
|
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:15 PM |
🔪 I'm Not Random 🔪 ⚜️ I'm Legendary ⚜️
I don't know, anyways bump.. I like to post crap sorry.
🔪 I'm Not Random 🔪 ⚜️ I'm Legendary ⚜️ |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Nov 2016 08:15 PM |
| Well if you're initially writing it in Python, then you have more solutions but if you plan on writing it in Lua later (which I assume also make it work for Roblox) you pretty much just have those 3.` |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:16 PM |
I already know about how to make a compiler, but I want this to run on Lua so people can make "moddable"/UGC enabled games on ROBLOX. I'm wondering:
1). How to make a virtual machine, as a base for compilation
2). (less important) How to write a macro preprocessor, similar to (Lisp)
I was wondering if anybody could share some insight about the two subjects. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:16 PM |
🔪 I'm Not Random 🔪 ⚜️ I'm Legendary ⚜️
I'm sort of a crap poster, hehe. Anyways, I am a crap poster. I am crapping post right now, did you notice?
🔪 I'm Not Random 🔪 ⚜️ I'm Legendary ⚜️ |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:17 PM |
| go crap post in ot nobody cares |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:17 PM |
| Ah. Didn't see ##### post before I posted. Thanks for that. Also, for creating virtual RAM/ROM, should I use ##### strings to represent 8-bit WORDs in memory? |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:17 PM |
🔪 I'm Not Random 🔪 ⚜️ I'm Legendary ⚜️
Honestly, I like to get more total posts. AHHAHHAHHAHH!
🔪 I'm Not Random 🔪 ⚜️ I'm Legendary ⚜️ |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:18 PM |
| and pretty soon ur getting 0 posts cuz ur gonna get removed for spam and siggies that take up too many lines |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Nov 2016 08:20 PM |
Making a VM is actually probably much easier than writing the compiler itself because there isn't much to "deal with" IMO. If you plan on designing your own ISA then make sure to optimize it for your language.
"Also, for creating virtual RAM/ROM, should I use ##### strings to represent 8-bit WORDs in memory?" ASCII strings? I mean you could just have your memory be a long string since each character is a byte anyways but I'd prefer to use a table because I just don't like the idea of using a string but I mean entirely up to you. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:23 PM |
i was wondering how khol did his parser for strings to lua, does anyone here know how yet? id like to use it for my scripting game where you can run code and output it to solve puzzles |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:23 PM |
| So, in that case (regarding the fact that I shouldn't use purely regular expressions), should I write the parser before the preprocessor, so I have a nice idea of how to properly tokenize/lex the files? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Nov 2016 08:25 PM |
"i was wondering how khol did his parser for strings to lua" Calling it a parser alone is not the whole story but he didn't do it (assuming you're referring to his commands that can run code like :ls or whatever it's called).
In the past he used loadstring, but now if it still works he's either probably using HttpService and uploading it then inserting it (IIRC that's how oxcool's SB works but I don't remember) or just combined a Lua compiler already created for Lua and a VM.
Here's an example of the latter: https://www.roblox.com/library/376277589/Loadstring-Simulator |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Nov 2016 08:26 PM |
"So, in that case (regarding the fact that I shouldn't use purely regular expressions), should I write the parser before the preprocessor, so I have a nice idea of how to properly tokenize/lex the files?" Well yeah it might be best to save the preprocessor for later. The thing is there are a lot of ways to do it and sometimes it might be easier to make the preprocessor another "mini compiler" so you can properly handle everything. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Nov 2016 08:27 PM |
| I don't know anything about Lisp but in languages like C/C++ you can evaluate constant expressions using the preprocessor which is why it's really not a 'copy-and-paste' sort of thing. |
|
|
| Report Abuse |
|
|
|
| 10 Nov 2016 08:27 PM |
so you can return functions and recieve them with http get too? wouldn't they have to be funcs for you to run the loaded code? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Nov 2016 08:28 PM |
"so you can return functions and recieve them with http get too? wouldn't they have to be funcs for you to run the loaded code?" I'm saying that HttpService is used to send a request to Roblox to _upload_ your source as a model (as a script) and then just insert that script into your game. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Nov 2016 08:29 PM |
can be used* blah
flood check i love you
|
|
|
| Report Abuse |
|
|