Overall input & output : see here
- Using import,
- Ex:
import stdio; import math;
-
- Using
//
, - Ex:
int a = 25; // this is single line comment int b = 123; // also valid here
- Using
-
- Using
/* */
, - Support nested also,
- Ex:
int y = x sub 999; /*multi line comment possible to have /* nested also */ */ discard c,d,e, /* valid comment */ f;
- Using
- Format:
FUNC_TYPE FUNC_NAME (DATA_TYPE1, DATA_TYPE_2...);
- Example:
int add(int,int, float); int scan(); void add(int, float, double);
- Defined as:
- Ex:
static void entryPoint(){ // starts from here }
-
int
,float
,double
-
- Using:
DATA_TYPE VAR1, VAR2;
- Ex:
int a; int b; int c,d,e;
- Using:
-
- Using:
DATA_TYPE VAR1 = const_value, VAR2 = calc_value, VAR3 = func_call;
- Ex:
int m = 102, n = m add 10; // m = 102, n = 112 double e = @max(2,3),f; // e = 3, f = 0
- Using:
-
- Using
VAR = const_value or calc_value or func_call;
- Ex:
int z; z = 100; // constant z = 10 add 20; // calculated value b = @max(a,101); // function call
- Using
-
- Using
discard VAR,VAR...VAR;
- Ex:
int a = 10; discard a; // can't access `a` anymore
- Using
-
- Initialized to
0
by default, - Error if
duplicate variable
is declared, - Error if assign value to
undeclared variable
, - All variables are become global once declared,
- Variable remains gloabl until
discarded
explicitly,
- Initialized to
-
- Addition
(<add>)
, - Subtraction
(<sub>)
, - Multiplication
(<mul>)
, - Division
(<div>)
, - Difference
(<dif>)
, - Remainder
(<rem>)
- Ex:
int a = 10, b = 5; int c = a <add> b, d = 10 <sub> a; // c = 15, d = 0
- Addition
-
- less than
(<lt>)
, - greater than
(<gt>)
, - equal
(<eq>)
, - not equals
(<neq>)
- less equal
(<le>)
, - greater equal
(<ge>)
- less than
-
- Equivalent to
if - else
, - Structure:
justInCase(VAR_CON @ VAR_CON){ // body }
- Ex:
a = 10; int c = 15; justInCase(5 <lt> 10 and a <lt> b and 10 <gt> 10 ){ println("Condition is false"); } otherwise{ println("Executed else block"); }
- Output:
Executed else block < - - - - - - - - - -
- Equivalent to
-
- Using
till( VAR_CON <COND_OP> VAR_CON ){ VAR_CON = VAR_CON <ARITH_OP> VAR_CON; }
- Example:
int j = 55; till(j <gt> 0){ j = j <sub> 15; }
- Output:
Iterating - 0, value: 55 Iterating - 1, value: 40 Iterating - 2, value: 25 Iterating - 3, value: 10
- Using
-
- Using
println()
, - Structure:
println(VAR_CON, VAR_CON, ... VAR_CON);
- Comma(
,
) and space(' '
) both are valid as separator, - Ex:
float f1 = 243, f2=11; println(f1,f2); double height = 25; println("My height is: ",height "km");
- Output is like
243.000 11.000 < - - - - - - - - - - My height is: 25.000 km < - - - - - - - - - -
- Using
bison -d final.y
flex final.l
gcc final.tab.c prototype_list.c lex.yy.c constant.c var_list.c -o app
app