Coder Social home page Coder Social logo

rockstar's Introduction

 _____     _____    ______     ___  ______________ ____  ______   
|   _  \  /  _  \  /  ___/ /| /  / /  ______    _//    ||   _  \ 
|  |_)  )/  / \  \/  /    / |/  / (  (___   |  | /     ||  |_)  )
|      /(  (   )    (     |     \  \____  \ |  |/  /|  ||      /
|  |\  \ \  \_/  /\  \___ |  |\  \ _____)  )| //  / |  ||  |\  \ 
|__| \  \ \_____/  \_____||__| \__\\______/ |//__/  |__||__| \__\
      \  | ------------------------------------------------------
       \ | h t t p s : // c o d e w i t h r o c k s t a r . c o m
        \| ------------------------------------------------------

Rockstar is a dynamically typed computer programming language, designed for creating programs that are also song lyrics. Rockstar is heavily influenced by the lyrical conventions of 1980s hard rock and power ballads.

But why?

Mainly because if we make Rockstar a real (and completely pointless) programming language, then recruiters and hiring managers won't be able to talk about 'rockstar developers' any more.

Also 'cos it's kinda fun and any language based on the idea of compiling Meatloaf lyrics has to be worth a look, right?

Plus we can make stickers. Who doesn't want a sticker on their laptop saying 'CERTIFIED ROCKSTAR DEVELOPER'?

What's here?

Implementations

The official reference implementation is Satriani - written in JavaScript, it runs in browsers and supports NodeJS for server-side and larger projects.

Rocky is a fully spec-compliant Rockstar implementation written in Java, and is currently the only Rockstar implementation that includes support for the DEC64 numeric type that was described in the original language specification.

Other implementations:

Social Spaces

Media Coverage

See Also

  • Enterprise™ - "The world is not made only of Rockstar programmers. For all the non hipsters out there, now there's Enterprise™"

rockstar's People

Contributors

0xflotus avatar adotinthevoid avatar aitorres avatar ascheja avatar bqpd avatar cwfitzgerald avatar dependabot[bot] avatar dylanbeattie avatar earl-brown avatar faradzhev avatar gruen avatar jcsahnwaldt avatar lkwq007 avatar maxcruz avatar mikesep avatar mzuidweg avatar nbrevu avatar otflorian avatar palfrey avatar philipmasser avatar ra100 avatar sirosen avatar snoyes avatar suloch avatar timtwalsh avatar vielmetti avatar wolfgang42 avatar young-steveo avatar yyyyyyyan avatar zmarkan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rockstar's Issues

Operator comparison (greater than or equal to)

The only way that the fizzbuzz example works is if the line "While your heart is higher than your soul" is logically "while (your heart >= your soul)" yet comparative operators are described as being < and >

Meatloaf syntax for conditionals

For if blocks, Rockstar should support Meatloaf syntax:

I would do <function> for <condition>
But I won't do <another function>

This syntax would evaluate the <condition>, and if it is true, then call <function>, else it will call <another function>.

For example, you could declare two functions, anything and that, and a Boolean variable called love, and the syntax would be

I would do anything for love
But I won't do that

For this to work, Rockstar would need to be able to call functions without parameters. Maybe a syntax where the function takes nothing, for example:

Anything takes nothing and gives back truth
That takes nothing but gives back everything
Listen to your love

I would do anything for love
but I won't do that

This would listen on STDIN, and set that value into the variable love. Then it would evaluate love, and if true call out to Anything returning the value of the variable truth, if false call out to that and get back the value of the variable everything.

Taking

"taking" doesn't sound so great for function calls.

Did you consider using "with"?

Just for fun, I've written an example using the with syntax.

Looking Back takes Pain and All
Fear is Pain
Until Fear is nothing then
   Knock Fears down
   The Way is Looking Back with Fear and Pain
   Until The Way is nothing then
     Knock The Way down
     Build All up
Give back All

That Guy is 22
All Of It is nothing
Looking Back with That Guy, All Of It

I think this is what I mean in python:

def LookingBack(Pain, All):
  Fear = Pain
  while Fear != 0:
    Fear -= 1
    TheWay = LookingBack(Fear, Pain)
    while TheWay != 0:
      TheWay -= 1
      All += 1
  return All

ThatGuy = 22
AllOfIt = 0
LookingBack(ThatGuy, AllOfIt)

Blank line placement in example

The current example has

Give back your heart
{blank line}
{blank line}
Desire is a lovestruck ladykiller

It should be

Take your soul from your heart 
{blank line} 
Give back your heart 
{blank line} 
Desire is a lovestruck ladykiller

since it should return the the value after exiting the while loop

Loop problems

Loop examples included in the README:

Tommy was a dancer
While Tommy ain't nothing
Shout it
Knock it down
And around we go

and

Modulus takes Number and Divisor
While Number is higher than Divisor
Take Divisor from Number
Give back Number

Couple of problems:

  • Around we go appears to be the "multi-line loop" statement, but that's not documented.
  • There's no indication about whether a while loop is multi-line or one block. So, the first example above just has two blocks, as the And around we go is one block with Knock it down but Shout it is also another block. OTOH the second example has no Around we go but seems to just implicitly treat the Take Divisor from Number as a single-block while loop?

Thoughts?

Strings must use double quotes

If single-quoted strings are allowed, words like isn't and doesn't become harder to parse. Even worse, wakin' and 'bout are impossible.

Tommy and Gina reserved keywords

I think we should make tommy and gina reserved keywords, in the spirit of Bon Jovi fans.

tommy could denote a class, while gina could denote an interface.

Exit script

Currently there is no way to exit script.
My current proposal:

Goodbye (exit with code 0) 
Goodbye world (exit with code 5) 

Poetic number literals & status of the single quote character

The specification declares:

My dreams were ice. A life unfulfilled; wakin' everybody up, taking booze and pills - initialises my dreams with the value 3.1415926535

it also declares

The single quote character in Rockstar is treated as a letter of the alphabet

by that measure, shouldn't the "dreams" value contain 3.1416926535 ?

Wants

I don't know how this can be applied, but please consider adding some syntax construction support that will allow to write next line of code:

Polly wants a cracker

Say

The documentation is missing the specification that after Say or one of its aliases a literal is also valid. However, it's not clear if poetic numbers are allowed or if the rest of the line is parsed as a string. Requiring quotes at this would be useful for numeric output

Else / el((s(e ?)?)?if / multi-word keywords

I don't think there are else and else if keywords/blocks. This is indeed minimalistic, but it might be more practical to have them. Otherwise could be an alias for else (without if). I don't have a clue for a single keyword for else if at the moment. In general, one word keywords are better maintainable. What if the parser expects a long keyword like take it to the top and the code accidentally misses a letter? An error should be thrown instead of unexpected behaviour. This is clear, but during implementation, one might forget this at some point and this is not too easy to maintain, if you always have to check that again...

Increment and Decrement Aliasing / Syntax generalization

I was thinking about various possible aliases for the increment and decrement. Reading through some random 80s rock lyrics I found a few possibilities.

Build {variable} up

  • Burn {variable} up
  • Break {variable} up
  • Throw {variable} up
  • Live {variable} up
  • Move {variable} up

Knock {variable} down

  • Burn {variable} down
  • Break {variable} down
  • Throw {variable} down
  • Live {variable} down
  • Move {variable} down

Many of them seemed to be able to be interchangeably used between increment and decrement.

So I propose that the syntax for increment and decrement be changed to.

Increment: [Ignored word] {variable} up
Decrement: [Ignored word] {variable} down

Perhaps default to "Move" or something else that is very generic and computer code like, as there are many possible variations on the word to use here.

around we go

In the example

Tommy was a dancer
While Tommy ain't nothing,
Knock down Tommy
And around we go

the usage/effect of around we go is unclear. It could be an alias for continue. But it is definitely not needed because any line that doesn't start with And ends the block. For a parser this could be difficult if the file doesn't end with a newline, don't forget to clean up opened blocks or throw an error (unexpected EOF) if you write a parser

Block syntax proposal

Currently, Rockstar implements blocks as starting with If, While, Until, or ... taking and ending with a blank line. This requires multiple blank lines to end multiple blocks, and results in awkward-looking runs of whitespace.

Here's my 2¢ suggestion about how this could work instead:

  • For flow control statements (If, While, Until):
    • by default, flow control operations only work on the following statement.
    • To start a block, end the line with then, let's, i'll, do
    • To end a block: take it to the top, end if/while/until (additional keyword suggestions appreciated)
      • If an outer block is ended, the inner block will also end (so take it to the top ends an If inside a While)
      • End of file ends all blocks
  • For functions:
    • Functions always start a block
    • If there is no inner block, Give back ends the function. (Additional Give back statements may be used in inner functions, but a function must always end with a return value.)

Minimalist Rockstar example, full syntax:

Modulus takes Number and Divisor
    While Number is as high as Divisor
        Put Number minus Divisor into Number
    Give back Number

Limit is 100
Counter is 0
Fizz is 3
Buzz is 5
Until Counter is Limit do
    Build Counter up
    If Modulus taking Counter, Fizz is 0 and Modulus taking Counter, Buzz is 0 do
        Say "FizzBuzz!"
        Continue
    End if
    If Modulus taking Counter and Fizz is 0 do
        Say "Fizz!"
        Continue
    End if
    If Modulus taking Counter and Buzz is 0 do
        Say "Buzz!"
        Continue
    End if
    Say Counter
End

Minimalist Rockstar example, leaving out unnecessary end statements:

Modulus takes Number and Divisor
    While Number is as high as Divisor
        Put Number minus Divisor into Number
    Give back Number

Limit is 100
Counter is 0
Fizz is 3
Buzz is 5
Until Counter is Limit do
    Build Counter up
    If Modulus taking Counter, Fizz is 0 and Modulus taking Counter, Buzz is 0 do
        Say "FizzBuzz!"
        Continue
    If Modulus taking Counter and Fizz is 0 do
        Say "Fizz!"
        Continue
    If Modulus taking Counter and Buzz is 0 do
        Say "Buzz!"
        Continue
    Say Counter

Ideomatic Rockstar example:

Midnight takes your heart and your soul
While your heart is as high as your soul
Put your heart without your soul into your heart
Give back your heart

Desire is a lovestruck ladykiller
My world is nothing 
Fire is ice
Hate is water
Until my world is Desire I'll
Build my world up
If Midnight taking my world, Fire is nothing and Midnight taking my world, Hate is nothing let's
Shout "FizzBuzz!"
Take it to the top
If Midnight taking my world, Fire is nothing let's
Shout "Fizz!"
Take it to the top
If Midnight taking my world, Hate is nothing let's
Say "Buzz!"
Take it to the top
Whisper my world

Related: #4, #11, #29.

Chorus as macro?

A lot of languages add metaprogramming via macros to generate more code at compile-time. It might be useful to add something like this to the language to easily repeat a lot of similar code, but changing things inside it. I.e. change which variable something is assigned to after a wordy calculation.

It might also make more sense to add choruses instead as a simple anonymous function you can repeatedly call (until the next chorus is defined).

composer

A composer will take a Rockstar program, and generate a musical score.

This might be hard to do.

Other Data Types

I know this is a relatively basic language but I feel like you could make it more legitimate and allow for more complex programs with the inclusion of more complex data types such as an array.

Syntax could work where filled with denotes the start of what to fill the array with and you separate the items with but, and, or or. The value of the first data entry that isn't null or an alias of it would determine what data type the array is.

a shout was loud
a scream was quiet
the nights filled with nothing but a shout and a scream

would fill the array the nights with null at 0, 4 at 1, and 5 at 2. Because a shout is a number it makes the nights an array containing number types, meaning accessing position 0 would return 0 because that is the number equivalent of null.

You could also chose not to fill the array at it's initialization which would require stating how large it needs to be which could be done using poetic number literals that are preceded by the phrase full of. The data type which is contained by the array would remain mysterious until a non-null value was input into it.

the nights full of darkness
would create the array the nights of type mysterious having 8 spots.

To reference a specific position in the array, to either get the value stored there or assign it a new value, you would state the array name, then the reserved word at, followed by a poetic number literal, and then either is to assign or into to retrieve. To access the zeroth position you would have null or any of its aliases following at, this must be done because you obviously can't use a word of no length.

the man at dawn is "weary"
would fill the 4th position in the man with the string literal "weary".

put the man at rest into a casket
would take the value in the 4th position of the man and assign it to the variable a casket.

Do commas have a syntactical meaning?

Some of the example loops have a comma at the end of them:

Tommy was a dancer
While Tommy ain't nothing,
Knock Tommy down

but others don't:

Tommy was a dancer
While Tommy ain't nothing
Shout it
Knock it down

Are these commas supposed to be here? If they are, do they do anything or are they just ignored?

Todo: esolangs.org entry

If the language specification is somehow stable, this could be published on esolangs.org from where interested developers might come from (at least those developers who are interested in languages like that)

Allow actions before conditional

That makes it possible to have something like this

My Life is nothing without you

Equivalent of
If not you then
My life is nothing

Math

Currently, increment, decrement and assignment are the only possible math operations. It might be somehow inconvenient that way to calculate roots. Especially if all the required functions have to be written in rockstar. This would be the lyrics for a day-long song...

Comments

There probably should be a way to comment code, either to clarify blocks or allow better metric within the lyrics without compromising previously written code

The first use is meant for actual use of the language on real-world code, which isn't probably going to happen and so isn't as important

For the second use, maybe make the compiler ignore lines without any language keywords (I'm not sure if this is doable, don't know much about compilers).

Negation

How about the following syntax for negation?
turn {variable} upside down
flip {variable} over

If Then

According to the text If has a Then but the sample code doesn't.

So which is correct?

"taking" is reserved - example mismatch?

You've got

My dreams were ice. A life unfulfilled; wakin' everybody up, taking booze and pills - initialises my dreams with the value `3.1415926535'

Isn't taking a reserved keyword here? Or does that not count during assignments?

Imports

For Rockstar to become a semi-usable language there have to be imports, I would suggest using the taking X from Y in Z for import syntax, where X is a list of symbols to import separated by the and keyword, or 'X' and from are omitted and the symbols can be accessed via their file name and Y and Z are a relative path or an absolute path based on some pre-defined variable. We could then use them in multiple ways:

  • taking modulus and fiboacci from math in utils and then modulus and fibonacci can be used as normal functions
  • taking math in utils with this modulus from math and fibonacci from math can be used as functions.

Example is incorrect

I may be mistaken, but I believe your idiomatic FizzBuzz example is incorrect.

In the second stanza when you use the Midnight function to make the logical comparisons you write Midnight taking Desire, when it should be Midnight taking My world,. This is because Desire is set to the numerical value of 100 and functions like the Limit variable in the minimalist example. My world is the variable that is being increased and should accordingly be used in the logical comparisons.

RSA

I'd love to see this developed to the point where a song version of RSA encryption would be feasible.

And continuation for strings

And could be used to continue a string started in the line before using
{variable} says {string}
and {string+}
With and being converted to a space.

Single letter variable names

The specification doesn't say whether "A" would be a proper variable name. It does start with an uppercase letter but that's all. It might be useful for short names like the i counter variable but I'm not sure if that fits with the aim of rockstar...

Modularisation: concert / setlist

What about a module / import syntax:

Setlist: Live at Waken 1998

Song: The Philosopher
.... ${RockStarCode}
Song: The Ace of Spades
.... ${RockStarCode}
from "Live at Waken 1998" import "The Ace of Spades"

Lack of Comments

Currently there is no documentation for an official way to comment out code despite you adding comments such as (blank line ending While block) in the minimalist FizzBuzz example. I don't know if you intended those to be actual comments or just info for the reader in that specific example but I think comments are something that the language probably needs. If you don't want to use parenthesis for official comments may I suggest starting comments with the phrase By the way or something else that's all words to continue the non-reliance on special characters.

New GTA

Hey guys do you have a roadmap for new GTA?
I love Rockstar <3

Testing framework

We could use wish for assertions

I wish Your Love was true

It will throw/panic if Your love is not true

Possibly conflicting examples in definition of single quote

In the string literals section, a single quote is defined as being an a letter of the alphabet

The single quote character in Rockstar is treated as a letter of the alphabet. This seems unusual until you remember that I ain't talkin' 'bout love is a perfectly valid rock'n'roll sentence.

However, later on in the Poetic Number Literals examples, there is this example

My dreams were ice. A life unfulfilled; wakin' everybody up, taking booze and pills - initialises my dreams with the value 3.1415926535

Which would suggest that the single quote in wakin' is not counted as an alphabetical letter as the definition states

Other than the first period, any non-alphabetical characters are ignored.

If this is intended, then it may be worth clarifying this

Github project organisation

A lot of issues are math stuff, syntax proposals or example bugs, it would be great to organise them using the projects page...

Doc confusion

Proper variables are proper nouns - any word that isn't a reserved keyword and starts with an uppercase letter. Proper variable names can contain spaces as long as each space is followed by an uppercase letter.

Put 'Hello World' into the message will assign the value 'Hello World' to the variable the message.

as well as

My heart is true - initialises the variable my heart with the Boolean value true

and many others.

How is this valid?

Case Sensitivity

Are language elements is rockstar case sensitive. Some of the example suggest that keywords are case insensitive. Are proper nouns case insensitive except for there first letter? This should probably be clarified in the README.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.