generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Lua++ Syntax [Suggestions Welcome]

Previous Thread :: Next Thread 
branefreez is not online. branefreez
Joined: 29 Dec 2011
Total Posts: 321
18 May 2014 07:46 PM
Heya, I'm here for some syntactic suggestions from fellow scripters.

Here's a brief description:

Lua++ is a mesh of Java, Lua, Perl, and C++ operators, Lua & C++ syntax, and additional MoonScript functionality.

Its goal is to make dynamic lua programming look more static [like C-based languages] in order to make it easier to debug and to read.

The Lua++ interpreter (written in pure Lua) is still in development and more syntactic changes are going to be made in the near future.

I was wondering if you have any suggestions for the syntax to make it easier to read. [it will eventually be turned into pure Lua when interpreted].

Please don't flame at me for posting this here, as this isn't a 'Help' request, but rather a request for opinions on how I should design a syntactically differing scripting language that is a semi-abstraction of (RBX)Lua.

`sub' is interpreted as `function'
`{' can mean `{', `then', or `do'
`}' can mean `}' or `end'
`auto&' means nothing, but is there just as a purely symbolic clarificatory keyword in for-loops.
`->' means `.' in dot-notation.
`?->b' means`:FindFirstChild("b")' in RBX.Lua
`event' is a data type clarificator* in order to avoid confusion in RBX.Lua
`||' means `or'
`&&' means `and'
`a|b' means `bit.or(a,b)'
`a&b' means `bit.and(a,b)'
`a^b' means `bit.xor(a,b)'
`~a' means `bit.not(a)'
`a**b' means `a^b'
`NULL' means `nil'
`a..=b' means `a=a..b'
`a+=b' means `a=a+b'
`a-=b' means `a=a-b'
`a*=b' means `a=a*b'
`a/=b' means `a=a/b'
`a%=b' means `a=a%b'
`a|=b' means `a=bit.or(a,b)'
`a&=b' means `a=bit.and(a,b)'
`a^=b' means `a=bit.xor(a,b)'
`a..~b' means `a=~(a..b)' in Lua++ `a=bit.not(a..b)'
`a+~b' means `a=~(a+b)' in Lua++ or `a=bit.not(a+b)'
`a-~b' means `a=~(a-b)' in Lua++ or `a=bit.not(a-b)'
`a*~b' means `a=~(a*b)' in Lua++ or `a=bit.not(a*b)'
`a/~b' means `a=~(a/b)' in Lua++ or `a=bit.not(a/b)'
`a%~b' means `a=~(a%b)' in Lua++ or `a=bit.not(a%b)'
`a||~b' means `a=~(a||b)' in Lua++ or `a=bit.not(a and b)'
`a&&~b' means `a=~(a&&b)' in Lua++ or `a=bit.not(a or b)'
`a|~b' means `a=~bit.or(a,b)' in Lua++ or `a=bit.not(bit.or(a,b))'
`a&~b' means `a=~bit.and(a,b)' in Lua++ or `a=bit.not(bit.and(a,b))'
`a^~b' means `a=~bit.xor(a,b)' in Lua++ or `a=bit.not(bit.xor(a,b))'

Any non-flaming suggestions [other than telling me to 'get out'] will be greatly appreciated.
Example code: pastebin/b55YjLYH

*clarificator: Latin (second/third)-person singular future passive imperative of clarifico
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
18 May 2014 07:57 PM
Sounds interesting. You should implement ! as not and have + concatentate strings, those are the two things that anger me about Lua(those and tables not begining at zero).
Report Abuse
branefreez is not online. branefreez
Joined: 29 Dec 2011
Total Posts: 321
18 May 2014 07:58 PM
I can actually do that right now. Thank you for replying; it's unnerving not being able to know what people think.
Report Abuse
CurrentlyNull is not online. CurrentlyNull
Joined: 24 Jan 2014
Total Posts: 100
18 May 2014 08:00 PM
Lua is extremely readable as is. However, yes, tables should begin at zero, not one.
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
18 May 2014 08:02 PM
Basically, you want to 1) remove the things that make Lua good and 2) introduce ambiguity, and then make an overcomplicated parser, compiler, and interpreter, and then merge a bunch of completely different languages into one evil conglomerate.

Yep. Sounds like C++.
Report Abuse
branefreez is not online. branefreez
Joined: 29 Dec 2011
Total Posts: 321
18 May 2014 08:05 PM
What I'm trying to do is make it possible to do everything in more than one way, and make it easy for me to organize blocks of code with brackets instead of words.

This is basically going to be like a Perl-ized version of Lua; hacky, and cumbersome to understand if you don't know the language itself.
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
18 May 2014 08:19 PM
Hacky = Bad
Cumbersome to understand = Bad

You're also introducing ambiguity that will make it impossible to compile to normal Lua, and thus you'd have to make it it's own, separate language with a compiler and interpreter. Now THAT'S cumbersome.
Report Abuse
branefreez is not online. branefreez
Joined: 29 Dec 2011
Total Posts: 321
18 May 2014 08:23 PM
I already have a working interpreter for Lua++. It isn't that cumbersome for me to use.

It's only cumbersome to understand if you can't translate the Lua++ operators into Lua functions mentally.

Hacky doesn't necessarily mean bad. Perl is VERY hacky and has many supporters and is used for web servers. I personally like Perl, and I like the way it does some things; I'm just trying to implement extra functionality into interpreted operators. [Because they have no direct conversion in Lua]
Report Abuse
branefreez is not online. branefreez
Joined: 29 Dec 2011
Total Posts: 321
18 May 2014 08:26 PM
BTW I forgot to mention that the entire interpreter is only 70 lines in length [so it isn't too cumbersome] and is only that large because of whitespace and my having it be a module for use in my other scripts.
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
18 May 2014 08:33 PM
That's not an interpreter, and you have not yet introduced (or you've just blatantly ignored) ambiguity issues.
Report Abuse
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
18 May 2014 09:45 PM
Post some pseudo code for us to examine.
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
18 May 2014 09:45 PM
...when showcasing a language, you don't use pseudocode. That's just silly.
Report Abuse
branefreez is not online. branefreez
Joined: 29 Dec 2011
Total Posts: 321
19 May 2014 08:02 AM
I put some example code in the original post.

Here it is again:

pastebin/b55YjLYH

I'm also working on something to help speed up my script writing for RBLX.

pastebin/xc70QK6z

Changes:
I updated the syntax last night and have added `~>' which acts as `GetService'

Current Test:
I am also in the process of translating the Lua BitOp lib into Lua++ to see how readable it is.
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
19 May 2014 09:42 AM
How did you fit it into 70 lines?

I wrote a recursive descent parser for Lua in Python (still not actually finished - idk how to handle the case for 'statement ::= variableList "=" expressionList' and 'statement ::= functionCall' without lots of look ahead and idk how it responds to comments - I know it tokenizes them but idk what happens when the parser consumes one), and the main file is over 1100 lines long. Add another 400 for the tokenizer, and then some more for all the other little files (like debug log and lists of operators, keywords etc).
lua_parser.py: pastebin/xj5zWenn
tokenizer.py: pastebin/fNVd6ZGF
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
19 May 2014 10:46 AM
Because he does loadstring(code:gsub("case1","lua1"):gsub("etc","etc"))() and calls it a parser.
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
19 May 2014 10:48 AM
"Its goal is to make dynamic lua programming look more static [like C-based languages] in order to make it easier to debug and to read."

Those languages are not easy to read or debug because they use lots of fancy symbols for the syntax.

They are easy to read and debug because they are statically and mostly strongly typed. If you want to improve Lua, you have to make it not be dynamic.

The only of your improvements that make sense is adding compound assignment operators since they make code shorter and thus easier to read. I dont know why you felt the need to write down each one explicitly though.

Replacing the boolean and bitwise operators is a mistake IMO, since having them be actual words makes them easier to type and understand. I doubt you are going to do massive amounts of bitwise operations in general programming (especially since this is a scripting language...) so cannot justify giving them special syntax especially since it necessiates changes in existing syntax (the ^ operator).

Adding NULL is pointless. In the original language it was just a synonym for the integer '0', so it isnt even the same as 'nil' and youre going to confuse people. Modern C++ has nullptr that is more like nil but theres no pointers in Lua so...

Creating special syntax for a single roblox function of a single class of objects is just stupid. Might as well instead get the behavior of these objects modified such that obj["Idontexist"] doesnt error if the object is nil. Or just add a shorter named method. Or make your own function.

Theres no need to add a synonym for 'function'. If you dont want to type stuff just remove the need for such a keyword completely in situations where its not strictly necessary.

I dont know what auto& even means, I hope you didnt take it from C++ because I dont see how it has anything to do with Lua for loops. If you need random clarificatory syntax that doesnt do anything im sure you can come up with something simpler than 'auto&'. Not that im suggesting you should have such syntax. Can it even be called syntax if it does nothing...?

"->" meaning "." is not logical, since the operator is syntactic sugar for something like (*obj).whatever, but you dont need to do such things in Lua where we only have one way to access objects. The syntax is pretty pointless in the original language anyways...

What is a data type clarificator in a language where you dont really have explicit types in the first place?

{ and } would make sense for a tiny bit of extra clarity if we did not have indentation, but we do. I dont have anything against this though, reduces some typing effort and simplifies the language. However, it will not work that well in if statements:
if bleh then
else
end
becomes
if bleh
{
}
else
{
}
which contains redundancy.
Report Abuse
branefreez is not online. branefreez
Joined: 29 Dec 2011
Total Posts: 321
19 May 2014 03:03 PM
I can't seem to change the words in my post to satisfy ROBLOX's filters, so I have to put it on pastebin. If you are interested in reading the numerous changes and revisions I have made to the psuedo-language, you can find the full text at pastebin/hHw1gcTf
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image