Comments (3)
An easy way to implement this would be to ignore parsing any lines starting with # but that would create a new kind of comment which is not in the spec. So an almost an easy way would be to ignore the first line of any program if it starting with #.
from rockstar.
I'm happy to add end-of-line comments using # as the comment character, just as it works in bash, Python, Perl, etc.
#!/usr/bin/rockstar
# this entire line is a comment
shout "hello world" # this is also a comment
Sure, they're not very rock'n'roll, but if you're being absolutely idiomatic you shouldn't be using comments anyway. :)
I had a very quick look at plugging this into the PEG grammar, and it's not quite as easy as I thought... if anybody wants to take a look, go for it; happy to accept a PR for this. If not, I'll take a look when I have a little more time.
from rockstar.
I have added the shebang support to Rocky, as well as the #
comment line support, for all the use cases @dylanbeattie sketched above.
If we have an entire line #
comment, it won't behave like an empty line (end of block), rather the line is simply skipped. This is useful if you are in the middle of coding, but you want to temporarily comment out a line, e.g in a function or in a loop.
For example, here are 2 whole line comment lines in the middle of the loop - if they were treated as empty lines, it would break the While loop block.
Love is " bottles of beer on the wall"
Problems are " bottles of beer"
Carol says Take one down, pass it around
The beers were numbering fa'too'many
While the beers ain't nothing
Shout it with Love
#Shout it + " bottles of beer on the wall"
Shout it with Problems
#Shout it + " bottles of beer"
Say Carol,
Knock the beers down
Say it with Love
from rockstar.
Related Issues (20)
- "has" as alias for "is"
- codewithrockstar.com is down HOT 1
- Add rockstar to https://www.99-bottles-of-beer.net/ HOT 1
- nth-fibonacci example contains an error.
- Expand comments to support Chordii/ChordPro formats
- If only there was a "random number generator" feature.... HOT 1
- Define syntax of import paths
- `nothin'` as an alias for `nothing`
- Lock-free Zygohistomorphic Prepropomorphisms for 99-Bottles-Of-Beer-On-The-Wallβ’ solutions HOT 2
- Pi example fails in Satriani HOT 1
- Proposal: Use ellipsis to define operator precedence/group expressions HOT 1
- Satriani rounds on casting
- List Arithmetic grammar error
- Assignment vs equality (and more generally, expressions vs statements) HOT 1
- Ambiguous syntax in nested function calls. HOT 2
- Allow spaces between function arguments HOT 2
- Satriani w/ Node prints "(program returned no output)" after program completion
- Quines HOT 3
- String modulus should be like string.strip() HOT 2
- One closing parenthesis closes all parenthesis HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rockstar.