https://github.com/arocks/punchscript-specs
Punchscript Language specifications
https://github.com/arocks/punchscript-specs
Last synced: 4 months ago
JSON representation
Punchscript Language specifications
- Host: GitHub
- URL: https://github.com/arocks/punchscript-specs
- Owner: arocks
- License: gpl-3.0
- Created: 2018-11-27T12:21:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-27T12:22:50.000Z (over 7 years ago)
- Last Synced: 2025-02-08T12:26:02.483Z (over 1 year ago)
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING.txt
Awesome Lists containing this project
README
This repository only maintains the Punchscript language specs
Language Reference
------------------
Punchscript is an interpreted scripting language based on punch dialoges of the Indian superstar [Rajninikanth](https://en.m.wikipedia.org/wiki/Rajinikanth). It is an imperative language with infix operators inspired by [ArnoldC](https://github.com/lhartikk/ArnoldC) and [Python](https://www.python.org/). 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|
|--- |--- |--- |
|` SOLRAN SEIRAN`|`LET = `|Assignment statement|
|`MEHHH! `|`COMMENT `|Must be at the beginning of a line|
|`NOORU THADAVA SONNA MAADIRI `
``
`MAGIZHCHI`|`WHILE `
``
`END WHILE`|If the condition evaluates to non-zero then enter loop body|
|`MALAI DA ANNAMALAI `
``
`EN VAZHI THANI VAZHI`
``
`KATHAM, KATHAM`|`IF `
``
`ELSE`
``
`END IF`|True means condition evaluates to non-zero. Else part is optional.|
|`IDHU EPADI IRUKU `|`PRINT `|Only place where literal strings (in double quotes) are allowed|
|`I AM CHITTI `|`SPEC `|Must be first line (lang ver no.) Optional|
#### Syntax
```
= [A-Z a-z][A-Z a-z 0-9 _]*
=
= + - * / % (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.
#### Builtins
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)
#### Errors
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.|