Skip to content

Commit b19d29b

Browse files
committed
scanning
0 parents  commit b19d29b

File tree

14 files changed

+412
-0
lines changed

14 files changed

+412
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Crafting Interpreter

lox/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lox/.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lox/.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lox/example/basic.lox

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
print "Hello, world!";
2+
3+
true;
4+
false;
5+
1234;
6+
12.34;
7+
8+
"I am a string";
9+
"";
10+
"123";
11+
12+
nil;
13+
14+
add + me;
15+
subtract - me;
16+
multiply * me;
17+
divide / me;
18+
19+
-negateMe;
20+
21+
less < than;
22+
lessThan <= orEqual;
23+
greater > than;
24+
greaterThan >= orEqual;
25+
26+
1 == 2;
27+
"cat" != "dog";
28+
29+
314 == "pi";
30+
123 == "123";
31+
32+
!true;
33+
!false;
34+
35+
true and false;
36+
true and true;
37+
false or false;
38+
true or false;
39+
40+
var average = (min + max) / 2;
41+
42+
{
43+
print "one statement.";
44+
print "two statements.";
45+
}
46+
47+
var a = "hello";
48+
var b;
49+
print a;
50+
51+
if (condition) {
52+
print "yes";
53+
} else {
54+
print "no";
55+
}
56+
57+
var a = 1;
58+
while (a < 10) {
59+
print a;
60+
a = a + 1;
61+
}
62+
63+
for (var a = 1; a < 10; a = a + 1) {
64+
print a;
65+
}
66+
67+
makeBreakfast(bacon, egg, toast);
68+
makeBreakfast();
69+
70+
fun printSum(a, b) {
71+
print a + b;
72+
}
73+
74+
fun returnSum(a, b) {
75+
return a + b;
76+
}
77+
78+
class Breakfast {
79+
80+
cook() { print "Eggs a-fryin'!"; }
81+
82+
serve(who) { print "Enjoy your breakfast, " + who + "."; }
83+
84+
}

lox/lox.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>
3.36 KB
Binary file not shown.
5.83 KB
Binary file not shown.
1.24 KB
Binary file not shown.
2.94 KB
Binary file not shown.

0 commit comments

Comments
 (0)