-
Notifications
You must be signed in to change notification settings - Fork 0
Cmm Documentation
Ghazal Kalhor edited this page Mar 11, 2022
·
7 revisions
C-- is a general-purpose, procedural programming language like C
.
There is a main function in this language that executes at first.
Codes of this language are in a file with the .cmm
suffix.
A program in C-- language contains these parts :
- Struct Declarations
- Function Declarations
- main Declaration
A simple C-- program is like this :
struct Student begin
int grade
bool pass
end
bool check_pass(struct Student std)
return std.pass
main() begin
struct Student std;
display(check_pass(std));
end
- This language is case sensitive.
-
tab
andspace
doesn't change the output of the program.
C-- has two primitive types :
int
bool
Moreover, C-- has list
and fptr
types.
There are 4 types of operators in C--.
All of these operators used on numbers.
If we assume A=20
and B=10
we have something like this :
Example | Description | Associative | Operator |
---|---|---|---|
A + B = 30 |
Add | Left | + |
A - B = 10 |
Sub | Left | - |
A * B = 200 |
Mult | Left | - |
A/B = 2 B/A = 0
|
Div | Left | / |
-A=-20 |
Minus | Right | - |
These operators compare two value and their output is true
or false
Example | Description | Associative | Operator |
---|---|---|---|
(A == B) = false |
Equal | Left | == |
(A < B) = false |
Less Than | Left | < |
(A > 20) = true |
Greater Than | Left | > |
Logical operators just can applied on bool
values.
Example | Description | Associative | Operator |
---|---|---|---|
(A & B) = false |
Logical And | Left | & |
(A | B) = true |
Logical Or | Left | | |
~A = false |
Logical Not | Right | ~ |