File tree Expand file tree Collapse file tree 1 file changed +37
-24
lines changed
Expand file tree Collapse file tree 1 file changed +37
-24
lines changed Original file line number Diff line number Diff line change 22Basic compiler written in java
33
44How to run this :-
5+
56Using Eclipse -
7+
68Import project into eclipse and edit code in Compiler/code.pc and compile Main.java to execute
79
810This includes basic operations like +(addition), -(subtraction), * (multiplication), /(division)
911
1012Data types and variables
13+
1114Example :-
12- For integer
13- a = 4
1415
15- For float
16- a=4.2
16+ For integer,
17+
18+ a = 4
19+
20+ For float,
21+
22+ a=4.2
1723
18- For String
19- a="Hello World"
24+ For string,
25+
26+ a="Hello World"
2027
2128Implicit Functions
29+
22301.print() -- print function
23- print("Hello World")
24- Result :- Hello World
31+
32+ print("Hello World")
33+ Result :- Hello World
2534
26352.println() -- println function --> prints the data then move to the newline
27- println(3+5.3)
28- Result :- 8.3
36+
37+ println(3+5.3)
38+ Result :- 8.3
2939
3040String Manipulation : -
41+
31421.String concatenation
32- str="Hello " + 4.5
33- println(str)
34- Result :- Hello 4.5
43+
44+ str="Hello " + 4.5
45+ println(str)
46+ Result :- Hello 4.5
3547 OR
36- str="Hello "
37- str=str+"World "+4
38- println(str)
39- Result :- Hello World 4
48+ str="Hello "
49+ str=str+"World "+4
50+ println(str)
51+ Result :- Hello World 4
4052
41532.String Repeat
42- str="Hello"* 3
43- println(str)
44- Result :- HelloHelloHello
54+
55+ str="Hello"* 3
56+ println(str)
57+ Result :- HelloHelloHello
4558 OR
46- str="hello"
47- str=str* 4
48- println(str)
49- Resutl :- hellohellohellohello
59+ str="hello"
60+ str=str* 4
61+ println(str)
62+ Resutl :- hellohellohellohello
You can’t perform that action at this time.
0 commit comments