Language Name - SUPER-L
Program Extension - .abc
Compiler - BIG-LC
| Language Feature | Code Example |
|---|---|
| Integer scalar variables | x: int; one: int; |
| One-dimensional arrays of integers | a : int array[10]; b : int array[10]; a &= b; a[0] &= 1; |
| Variable Declaration | x : int; a : int array[5]; var12_ : int; |
| Assignment statement | x : int; x &= 4; x &= x + 1; |
| Addition | x &= x+1; d &= a + b + 30; |
| Subtraction | x &= x - y; d &= a - b - 3; |
| Multiplication | x &= cat * dog; d &= x * y * cat; |
| Division | x &= x / y; d &= a / b / c; |
| Modulus | remainder &= x % y; |
| Less than | if x < y then write x; endif; |
| Greater than | if x > y then x &= x + 1; endif; |
| Equal to? | if x == y then x &= x + 1; endif; |
| Less than or equal to | x <= y |
| Greater than or equal to | x >= y |
| Not equal to | if x != y then x &= 0; endif; |
| While loop | while x < y loopbegin x &= x - 1; loopend; |
| If-then-else statement | if p < 10 then write p; else write q; endif; |
| Read statement | read p; if p < 10 then p &= p + 5; endif; write p; |
| Write statement | a &= 5; a &= a - 3; write a; |
| Function (taking multiple scalar arguments) | function main; beginparameters a : int; endparameters beginlocalvars endlocalvars bodystart if a < 5 then return 10; endif; endbody |
| Comments | ##comment |
| Return Statement | if dog != cat then return dog; endif; |
| Symbol in Language | Token Name |
|---|---|
| ( | L_PAREN |
| ) | R_PAREN |
| [ | R_SQ_BRACK |
| ] | L_SQ_BRACK |
| + | PLUS |
| - | MINUS |
| * | MULT |
| / | DIV |
| % | MOD |
| &= | ASSIGNMENT |
| : | COLON |
| ; | SEMICOLON |
| , | COMMA |
| < | LESS_THAN |
| > | GREAT_THAN |
| <= | LESS_THAN_EQ |
| >= | GREAT_THAN_EQ |
| == | EQ_TO |
| != | NOT_EQ |
| function | FUNCTION |
| beginparameters | BEGIN_PARAMS |
| endparameters | END_PARAMS |
| beginlocalvars | BEGIN_LOCALS_VARS |
| endlocalvars | END_LOCALS_VARS |
| bodystart | BODY_START |
| bodyend | BODY_END |
| int | INTEGER |
| array | ARRAY |
| if | IF |
| then | THEN |
| endif | ENDIF |
| else | ELSE |
| while | WHILE |
| for | FOR |
| loopbegin | LOOP_BEGIN |
| loopend | LOOP_END |
| read | READ |
| write | WRITE |
| and | AND |
| or | OR |
| not | NOT |
| return | RETURN |
| break | BREAK |
reserved words:
function
beginparameters
endparameters
beginlocalvars
endlocalvars
bodystart
bodyend
int
array
if
then
else if
endif
else
while
loopbegin
loopend
read
write
and
or
not
return
break
Additional Specifications:
Identifier names use only begin with letters. They cannot begin with any special characters (@,#,$.%.^.&.) or numbers, and cannot contain any spaces. Identifier names also cannot contain any special characters (@,#,$.%.^.&.). Identifier names cannot end with an underscore '_' or '&'.
Language is case sensitive, all reserved words should be all lowercase.
To represent a newline, use \n.
A main method with no arguments is necessary for a program to function.
Functions can accept any number of arguments passed by value.
Body of all functions, if-then-else statements, and while loops will be indented. Parameters and local variables will also be indented.
Comments begin with ##, end when a newline is detected