Added lexer tests
This commit is contained in:
15
examples/Fib.lx
Normal file
15
examples/Fib.lx
Normal file
@@ -0,0 +1,15 @@
|
||||
int fib(int num)
|
||||
{
|
||||
# Base cases #
|
||||
if (n == 0) { return 0 }
|
||||
if (n == 1) { return 1 }
|
||||
|
||||
# RECURSION BABYYYY #
|
||||
return fib(n - 1) + fib(n - 2)
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int res = fib(8)
|
||||
return res == 21
|
||||
}
|
||||
19
examples/LawsOfMath.lx
Normal file
19
examples/LawsOfMath.lx
Normal file
@@ -0,0 +1,19 @@
|
||||
int add(int a, int b)
|
||||
{
|
||||
return a + b
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int c = add(3, 4)
|
||||
if (c == 7)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
# The laws of maths have been broken #
|
||||
else
|
||||
{
|
||||
return 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user