start = action
action = (formal / casual) space
data:(count / add / print / unknown) space
{ return lang.run(data) }
space = ' '*
question = '?'*
number = d:digit+ space { return parseInt( d.join('') ) }
digit = [0123456789]
string = '"' s:[^"]* '"' space { return s.join("") }
casual = ('hey' / 'yo' / 'hi') {lang.isFormal = false;}
formal = ('would you mind if I ask you to' / 'could you please' / 'may I ask you to') {lang.isFormal = true;}
unknown = [a-zA-Z0-9'"?! ]+
add = ('add' / 'sum') space
a:number space
'and' space
b:number space
question space
{ return {func:'add', a:a, b:b} }
count = 'count' space
a:number space
'to' space
b:number space
question space
{ return {func:'count', a:a, b:b} }
print = 'print' space
a:string space
question space
{return {func:'print', a:a}}
Lazy Computer
*Please be respectful for a computer.
Basic syntax:
ASK DO WHAT ?
ASK:
If you casually ask, a computer returns casual value.
It's quicker way but be careful the use of casual returns because it's not so precise.
If you need to get an accurate value, use more formal way of asking.
Casual ask
hi
hey
yo
Formal ask
would you mind if I ask you to
could you please
may I ask you to
DO WHAT:
Currently only three DOs are active.
count a to b
*Try to keep within 10 numbers if you want to casually ask.
add a and b
*Do not ask too complicated numbers if you want to casually ask.
print "a"
?:
'?' at the end of your asking to distinguish with your monology. Prefered but optional.
Important notes:
A lazy computer sometime didn't listen what you casually ask. In case, just say again or use formal ask.
You may want to ask to do more thing. Actually you can still ask but don't expect too much from a lazy computer.
Ask examples
hey count 5 to 10?
hi count 7 to 50?
would you mind if I ask you to count 7 to 50?
yo add 7123 and 4328?
could you please add 7123 and 4328?
hey print "hello world"?
may I ask you to print "hello world"?
Try it!