Ideas and discussion for Regnus 5.5

The place to read and discuss the Regnus language and the updates to the specification.
User avatar
Ryan
Site Admin
Posts: 142
Joined: Wed Nov 11, 2009 pm30 8:19 pm
Contact:

Re: Ideas and discussion for Regnus 5.5

Post by Ryan » Fri Oct 11, 2013 am31 9:57 am

Update: added the following additional consideration to point 2):

One question is whether an entirely new expression type would be the best approach (as above), or whether it would be more elegant to add this functionality to the existing literal expression type instead? In this case, literal expressions would be treated in the same way as they are currently, but if they contain an unescaped separator character, would be treated as above. Since in the above suggestion, "##{Hello!};" would have the exact same effect as the already-supported "##(Hello!);", this may make more sense. The downsides would be that additional processing overhead would be added to parsing of the existing expression type, and of course, in the unlikely event that the chosen separator character is already used unescaped within literal expressions in existing scripts, these would need to be updated to include escape characters (a very minor point of backwards-compatibility which might not affect a single script).


Ryan

thunderclap
Posts: 16
Joined: Mon Jan 28, 2013 am31 1:35 am

Re: Ideas and discussion for Regnus 5.5

Post by thunderclap » Sun Oct 13, 2013 pm31 9:49 pm

It sounds like the processing overhead would be much greater for () as it is used much more often than {} in any script. That by itself might make me lean towards {} but then I thought of something else.

It could also be hard to spot inline used in a large script, if () were used. I'm not sure if it might be more desirable for inline to actually stand out a bit. I suppose all I can say is that for me, having {} on the ends would make it easy to tell at a glance where an inline starts and ends, whereas () would make that much more difficult, especially with more complicated usage that also included () inside the inline itself, for things like storage or whatever.

To put it another way, I've already got scripts with things like this:

Code: Select all

#>(2):(#+(AffectVerb##[0];););

I don't want to think about how confusing it would be if an inline were to include something like that and be denoted by parenthesis itself as well :wtf:

Most inlines wouldn't do something overly complicated like that of course. But I think distinction for inline might actually be a good thing.


Btw should bugs with the current version be posted in this thread? I think I found something wrong with Multi.

User avatar
Ryan
Site Admin
Posts: 142
Joined: Wed Nov 11, 2009 pm30 8:19 pm
Contact:

Re: Ideas and discussion for Regnus 5.5

Post by Ryan » Sun Oct 13, 2013 pm31 10:15 pm

thunderclap wrote:It could also be hard to spot inline used in a large script, if () were used. I'm not sure if it might be more desirable for inline to actually stand out a bit.


That's a good point, and I'm inclined to agree that it might be nicer for readability. I'll take that into consideration. :)

thunderclap wrote:Btw should bugs with the current version be posted in this thread? I think I found something wrong with Multi.


Bugs with current parsers should ideally be posted to the appropriate parser forum. I'll move the report to the VB parser forum and respond there. :)

Ryan

thunderclap
Posts: 16
Joined: Mon Jan 28, 2013 am31 1:35 am

verb tenses - worth adding new rtc?

Post by thunderclap » Sat Oct 19, 2013 pm31 8:36 pm

I wasn't sure if this would be better here or in the 5.5 discussion thread. With almost every script I've encountered this problem. But recently I've been working a script that has verbs up to wazoo in all three tenses. This is just a small sample:

Code: Select all

GROUP AffectVerbCr
ENTRY crack
ENTRY crack-up
ENTRY cram
ENTRY crumple

GROUP AffectVerbedCr
ENTRY cracked
ENTRY cracked-up
ENTRY crammed
ENTRY crumpled

GROUP AffectVerbingCr
ENTRY cracking
ENTRY cracking-up
ENTRY cramming
ENTRY crumpling


As you can see this is basically just the same group having to be redone twice for separate tenses. It would be a lot quicker (not to mention far less error prone) to be able to make one group with present tense, and be able to modify the verbs for other tenses at runtime. Similar to how ~ works.

I've tried to figure out a way to do this with functionality available now. But as there's no way to dynamically add an extra "m" to "cram" for "crammed" or "cramming," or to treat something like "crack-up" properly, I'm not sure it's possible without being so complicated as to defeat the purpose.

If an automatic way to modify tenses were added the main problem would be unusual things like "crack-up". There would probably have to be a way to explicitly define fringe cases like how MULTI does.

thunderclap
Posts: 16
Joined: Mon Jan 28, 2013 am31 1:35 am

Re: Ideas and discussion for Regnus 5.5

Post by thunderclap » Sat Oct 19, 2013 pm31 8:37 pm

The inline group idea made me think of something. Can #/ exclude multiple things, or is it limited to just one exclude?

User avatar
Ryan
Site Admin
Posts: 142
Joined: Wed Nov 11, 2009 pm30 8:19 pm
Contact:

Re: Ideas and discussion for Regnus 5.5

Post by Ryan » Sun Oct 20, 2013 pm31 8:27 pm

thunderclap wrote:It would be a lot quicker (not to mention far less error prone) to be able to make one group with present tense, and be able to modify the verbs for other tenses at runtime. Similar to how ~ works.


It would be great, but the big problem with this is that English doesn't just have the same kind of consistent rules for tenses of verbs in the same way as for plurals of nouns...

thunderclap wrote:I wasn't sure if this would be better here or in the 5.5 discussion thread.


Well, it's a suggestion for a language addition, so probably best here in the 5.5 thread. :)

thunderclap wrote:The inline group idea made me think of something. Can #/ exclude multiple things, or is it limited to just one exclude?


Each use of the comparative exclusion reference can only include one expression against which the result is kept exclusive, but of course, there's nothing to prevent you stacking these:

Code: Select all

GROUP ReferenceExample
ENTRY <Example>#/(apple):(#/(banana):Fruit;);

GROUP Fruit
ENTRY apple
ENTRY banana
ENTRY pear


(So, the above script would always return "pear".)

Ryan

thunderclap
Posts: 16
Joined: Mon Jan 28, 2013 am31 1:35 am

Re: Ideas and discussion for Regnus 5.5

Post by thunderclap » Tue Oct 29, 2013 pm31 5:36 pm

Ryan wrote:
thunderclap wrote:It would be a lot quicker (not to mention far less error prone) to be able to make one group with present tense, and be able to modify the verbs for other tenses at runtime. Similar to how ~ works.


It would be great, but the big problem with this is that English doesn't just have the same kind of consistent rules for tenses of verbs in the same way as for plurals of nouns...

It hadn't occurred to me just how complicated verbs can get. I've been thinking about this some more and these are the specifics that would be useful to me, at least:
"ed" form: if base verb ends with "e" add "d", else add "ed". Double consonant before "ed" if base verb ends with vowel and single consonant.
"ing" form: if base verb ends with "e" replace "e" with "ing", else just add "ing". Double consonant before "ing" if base verb ends with vowel and single consonant.
I think that covers it...

I believe there's enough verbs which follow those rules that even that simple functionality would be of help (at least for me). Count could always be used to allow selection between these and non-standard verbs. As it's pretty basic though I don't know how useful this would be for other people. :rubchin:

User avatar
Ryan
Site Admin
Posts: 142
Joined: Wed Nov 11, 2009 pm30 8:19 pm
Contact:

Re: Ideas and discussion for Regnus 5.5

Post by Ryan » Tue Oct 29, 2013 pm31 6:08 pm

thunderclap wrote:"ed" form: if base verb ends with "e" add "d", else add "ed". Double consonant before "ed" if base verb ends with vowel and single consonant.


The thing is that even here, there are lots of exceptions ("sell"/"sold", "shelf"/"shelved", for example, not to mention that the double consonant rule isn't always followed by every style-guide - it's particularly common in the US to drop it and create "traveled" rather than "travelled", for instance) - and there's still a huge number of words which don't even fit these criteria ("fly"/"flew", "drink"/"drank", etc.), which makes me think that it would be such a frequently thwarted function that it would be of very limited use.

thunderclap wrote:"ing" form: if base verb ends with "e" replace "e" with "ing", else just add "ing". Double consonant before "ing" if base verb ends with vowel and single consonant.
I think that covers it...


Yes, the present-imperfect (continuous/progressive) tense is a definitely little more consistent than the past-perfect tense. But again, I still wonder how useful this would actually be, especially if other tense functions aren't included? Remember, some verbs even change in the plu-perfect (double-past) tense ("drink"/"drunk" etc.), so including functions for some tense changes but not others seems a little incomplete.

English is just such a very complicated language. ;)

Ryan

veryalien
Posts: 13
Joined: Wed Apr 16, 2014 am30 9:13 am

Re: Ideas and discussion for Regnus 5.5

Post by veryalien » Wed Apr 16, 2014 am30 9:55 am

I have a few ideas and suggestions for future Regnus versions:

Please excuse any stupid comments below, or any that don't fit with the intended use of Regnus, I've only been using Regnus for about 3 days!!!


Numeric Expressions and Calculations

Regnus doesn't currently have good support for including random numbers and performing calculations. Numbers can be simulated in Regnus by having a set of text numbers in a group. For example a 6-sided dice is trivial:

Code: Select all

GROUP d6
ENTRY 1
ENTRY 2
ENTRY 3
ENTRY 4
ENTRY 5
ENTRY 6


However, there is no possibility to do any calculations on numbers, so even something 'as simple as' d6+1 can't easily be done by adding 1 to the result from the d6 table. Again, I think the only way to do it is to use a hard-coded group like:

Code: Select all

GROUP d6_1
ENTRY 2
ENTRY 3
ENTRY 4
ENTRY 5
ENTRY 6
ENTRY 7


Some kind of script commands to enhance literal expressions to allow dynamic numerical values would be a great development. Allowing calculations and manipulations of storage slot contents would also have a major impact on the functionality.

The addtional commands could allow conditional (if/else), math(rand,sqrt,arithmetic) and string manipulation functions(trim,substr) - so it would itself be a kind of mini scripting language. A suitable set of commands would need to be found for all of the Regnus flavours so everything works exactly the same in PHP, Java, Windows, command line, etc.

As Ryan knows, I've already done a very quick and very dirty hack along these lines, purely for myself, which works well for my needs in PHP. So the proof of concept is done!


Specific/Sequential group entry access via index

Is there any way to force a particular group entry without it being a random result? My brain says that Instead of just using Animal; to always get a random entry from the Animal group, a simple extension would be Animal[2]; to always access entry 2 in the group. Sorry if that's already possible, if it is I didn't find it yet. Maybe this is already possible using other methods?

I think that would be really useful and avoid hard-coding literals like ##(spider); within scripts when they could be more elegantly stored in groups and accessed using the entry index.

Automatically stepping through all group entries in an ordered sequence each time a group is accessed would also be a nice feature. Regnus keeps an index of which entry was last accessed and returns the next one in the sequence.
Something like:

Code: Select all

ORDER Sequence
ENTRY Tom
ENTRY Richard
ENTRY Harry


Each access of Sequence; would return first Tom, the second returns Richard, the third Harry and then it repeats from Tom.
Maybe something like this is also already possible, but I didn't get the right syntax yet?

HTML tags

As I am writing for web pages I would like to include HTML tags within the Regnus output. I know this can be done in PHP outside of Regnus, but being able to add dynamic HTML and CSS tags and values directly within Regnus would be very useful.
Again, I'm not sure if this is already possible, but HTML tags probably conflict with the Regnus label < > syntax, and they are stripped out, so I don't know how I could format the scripts correctly.
EDIT: escaping the tags with *< and *> sort of works, but isn't so nice.

User avatar
Ryan
Site Admin
Posts: 142
Joined: Wed Nov 11, 2009 pm30 8:19 pm
Contact:

Re: Ideas and discussion for Regnus 5.5

Post by Ryan » Wed Apr 16, 2014 am30 11:57 am

veryalien wrote:Some kind of script commands to enhance literal expressions to allow dynamic numerical values would be a great development.


I definitely think that some type of numerical processing ability for generating the results of complex dice-roll-style expressions would be very useful. As you say, it's currently quite convoluted even to generate a number inside a set range, so that's definitely a good idea. I'll give some thought as to an implementation that might work. :)

veryalien wrote:Allowing calculations and manipulations of storage slot contents would also have a major impact on the functionality.


I'm not sure about this, as I think it starts to push storage slots towards being treated as variables as in a traditional programming language, which would be better achieved by another method if it were to be added. I'd rather keep the text processing as simple/elegant as possible, and encourage Regnus to be used as a module within other languages if more complex processing is required.

veryalien wrote:The addtional commands could allow conditional (if/else), math(rand,sqrt,arithmetic) and string manipulation functions(trim,substr) - so it would itself be a kind of mini scripting language.


I'd probably want to create something a little simpler than a full maths processor, or duplicate existing string processing functionality which doesn't fit into the existing tree-structure of a Regnus script.

It's actually already possible to use existing functionality to perform conditional statements using data from storage slots, by using conditional or exclusion references to select between different results or groups. You could even include a reference which returns no content at all if a certain condition isn't met. :)

veryalien wrote:Is there any way to force a particular group entry without it being a random result? My brain says that Instead of just using Animal; to always get a random entry from the Animal group, a simple extension would be Animal[2]; to always access entry 2 in the group. Sorry if that's already possible, if it is I didn't find it yet. Maybe this is already possible using other methods?


This isn't currently possible as a built-in function - the way to achieve the effect, if desired, would probably be to add numbered labels to each entry in a group and then use a label reference to return the desired result.

I have to admit that I'm not sure I can think of any obvious use for this type of functionality, though? If you already know the result you want to return, would it not be easier to simply include it as text, rather than via a reference?

veryalien wrote:Automatically stepping through all group entries in an ordered sequence each time a group is accessed would also be a nice feature. Regnus keeps an index of which entry was last accessed and returns the next one in the sequence.


Again, I'm not sure I can think of an obvious use for this, since you're achieving a non-random result? It's already possible to ensure the return of every entry in a group in a random order, but if the object is to return the entries in a set order, would it not be simpler to just add those entries directly to the content, rather than via a reference?

If the aim is to ensure that three selected entries remain in the same order once generated, you could do something like this:

Code: Select all

GROUP Example
ENTRY <Repeat Three Names In The Same Order>#>(0):(#&Names;, #&Names; and #&Names;); always referred to themselves in the same order: ##[0];.

GROUP Names
ENTRY Tom
ENTRY Dick
ENTRY Harry


veryalien wrote:As I am writing for web pages I would like to include HTML tags within the Regnus output. I know this can be done in PHP outside of Regnus, but being able to add dynamic HTML and CSS tags and values directly within Regnus would be very useful.
Again, I'm not sure if this is already possible, but HTML tags probably conflict with the Regnus label < > syntax, and they are stripped out, so I don't know how I could format the scripts correctly.


The overstep (escape character) AGC will do this. :)

Code: Select all

ENTRY *<p*>This is a paragraph!*</p*>


Edit: perhaps it would be interesting to consider adding some method of switching off parsing of particular characters for an entire entry, rather than necessitating the use of escape characters for every reference? You're quite right that it becomes a little messy when overstepping a lot of AGCs in one entry - especially when dealing with HTML! I'll give it some thought. :)

Ryan

Post Reply