This repository only maintains the Punchscript language specs
Punchscript is an interpreted scripting language based on punch dialoges of the Indian superstar Rajninikanth. It is an imperative language with infix operators inspired by ArnoldC and Python. It was developed as a fun exercise and to learn compiler design.
Here are a set of constructs in Punchscript. If you are already familiar with programming then you should be able quickly get up to speed with this.
|Keyword||Equivalent in other languages||Remarks|
||Must be at the beginning of a line|
||If the condition evaluates to non-zero then enter loop body|
||True means condition evaluates to non-zero. Else part is optional.|
||Only place where literal strings (in double quotes) are allowed|
||Must be first line (lang ver no.) Optional|
<var> = [A-Z a-z][A-Z a-z 0-9 _]* <expr> = <expr> <op> <expr> <op> = + - * / % (modulo) > < == <>
Keywords: Keywords are in capital letters and may comprise of multiple words.
Variables: All variables are of type Integers. Variable names are case sensitive alphanumeric (including underscores) and starts with alphabet (upper or lowercase).
Expressions: All expressions get evaluated to integers including logical operations. True is represented as 1 and False is 0. For example, 4 > 5 will be evaluated to 0 implying False.
Whitespace: There are no end of line markers like semicolons. So each statement must be on a seperate line. But leading spaces or indentation of a line does not matter.
Certain variables have special meaning when evaluated
- BILLA - Generates a different random number (between 0 and MAXINT) when evaluated
- GURU - Maximum value of integer or MAXINT (currently 55,555)
- SISHYAN - Minimum value of integer or MININT (currently -MAXINT)
You might get any of these cryptic replies from the language interpreter
|Error Type||What Punchscript Says|
|Syntax Error||ENNAMMA KANNU, SOWKIYAMA?|
|Parse Error||THILLU MULLU|
|Runtime Error||KANNA, PANNI DHAN KOOTAMA VARUM...|
|Divide by zero||DIVIDE BY ZERO? JUJUBE.|