Skip to content

Commit 8cf3e70

Browse files
authored
Merge pull request #11 from blazingkin/development
Release 2.3
2 parents bf3acbe + d1c7ea1 commit 8cf3e70

File tree

141 files changed

+11541
-844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+11541
-844
lines changed

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
*.gen
33
.metadata/*
44
.recommenders/*
5+
.settings/*
56
*.project
67
*.class
78
*.classpath
8-
CHANGELOG
9-
ExampleCode2.blz
9+
*.outran
10+
CHANGELOG

.settings/org.eclipse.core.resources.prefs

-3
This file was deleted.

Descriptions of Each Instruction.txt Docs/Descriptions of Each Instruction.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
This is mostly outdated, the language website will have a much cleaner version of this soon
2+
13
Key -
24
@ - Deprecated
35

Instruction Syntax.txt Docs/Instruction Syntax.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
This is mostly outdated, the language website will have a much cleaner version of this soon
2+
13
**** FOR THIS DOCUMENT ONLY ****
24
{variable replaced strings are put in curly brackets}
35
[a variable address are put in square brackets]

Examples/AddTwoNumbers.blz

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:main
2+
echo "Enter a number:"
3+
nin first
4+
echo "Enter a number:"
5+
nin second
6+
echo "The sum of these numbers is:"
7+
sum = sum(first, second)
8+
echo sum
9+
end
10+
11+
:sum(a, b)
12+
result = a + b
13+
return result
14+
end

Examples/Factorial.blz

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
:main
2+
echo "What number would you like the factorial of?"
3+
nin input
4+
fact = fact(input)
5+
echo fact
6+
end
7+
8+
:fact(num)
9+
if num == 0
10+
return 1
11+
end
12+
return num * fact(num - 1)
13+
end

Examples/Fibbonacci.blz

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
:main
22
echo "How many fibbonacci numbers do you want?"
33
nin iter
4-
a[0] = 1
5-
a[1] = 1
6-
for i = 2, i < iter, i = i + 1
7-
ind1 = i - 1
8-
ind2 = i - 2
9-
a[i] = a[ind1] + a[ind2]
4+
a = [1,1]
5+
for i = 2; i < iter; i++
6+
a[i] = a[i - 1] + a[i - 2]
107
end
118

129
echo "Printing fibbonacci numbers 1-" iter
1310

14-
for i = 0, i < iter, i = i + 1
11+
for i = 0; i < iter; i++
1512
echo a[i]
1613
end
1714
end

Examples/LoopDemo.blz

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
echo "Enter a number"
33
nin a
44
starttime = {system.time.currenttimemillis}
5-
for i = 0, i < a, i = i + 1
5+
for i = 0; i < a; i = i + 1
66
echo i
77
end
88
time = {system.time.currenttimemillis} - starttime

Examples/PrintLotsOfThings.blz

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
:main
22
echo "How many interations?"
33
nin iter
4-
for i=0, i<iter, i=i+1
4+
for i=0; i<iter; i=i+1
55
echo i
66
end
77
end

Examples/primes.blz

+10-6
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,31 @@
44
echo "How many primes do you want?"
55
nin count
66

7+
start_time = {system.time.currenttimemillis}
78
while len < count
8-
flag = 0
9-
for i = 0, i < len, i = i + 1
9+
flag = false
10+
for i = 0; i < len; i = i + 1
1011
if numon % primes[i] == 0 # If a previous prime divides it, it isn't a prime
11-
flag = 1
12+
flag = true
1213
break
1314
end
1415
end
1516
numon = numon + 1
16-
if flag == 1 # Non-prime
17+
if flag # Non-prime
1718
continue
1819
end
1920
primes[len] = numon - 1 # We incremented numon earlier, so we need to subtract one
2021
len = len + 1
2122
end
22-
23+
end_time = {system.time.currenttimemillis}
2324

2425
# Loop through and print primes
25-
for i = 0, i < count, i = i + 1
26+
for i = 0; i < count; i = i + 1
2627
off = i + 1
2728
echo off "th prime: " primes[i]
2829
end
30+
31+
time = (end_time - start_time) / 1000
32+
echo "Took " time " seconds"
2933

3034
end

Extras/license.txt

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
GNU LESSER GENERAL PUBLIC LICENSE
2+
Version 3, 29 June 2007
3+
4+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5+
6+
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
7+
8+
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
9+
10+
0. Additional Definitions.
11+
As used herein, �this License� refers to version 3 of the GNU Lesser General Public License, and the �GNU GPL� refers to version 3 of the GNU General Public License.
12+
13+
�The Library� refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
14+
15+
An �Application� is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
16+
17+
A �Combined Work� is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the �Linked Version�.
18+
19+
The �Minimal Corresponding Source� for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
20+
21+
The �Corresponding Application Code� for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
22+
23+
1. Exception to Section 3 of the GNU GPL.
24+
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
25+
26+
2. Conveying Modified Versions.
27+
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
28+
29+
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
30+
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
31+
3. Object Code Incorporating Material from Library Header Files.
32+
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
33+
34+
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
35+
b) Accompany the object code with a copy of the GNU GPL and this license document.
36+
4. Combined Works.
37+
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
38+
39+
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
40+
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
41+
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
42+
d) Do one of the following:
43+
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
44+
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
45+
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
46+
5. Combined Libraries.
47+
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
48+
49+
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
50+
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
51+
6. Revised Versions of the GNU Lesser General Public License.
52+
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
53+
54+
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License �or any later version� applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
55+
56+
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

README.md

+12-18
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,10 @@ Currently implemented in Java, but will eventually transition to being a directl
66

77
The language will change drastically right now as I build up feature-completeness and polish it.
88

9-
Hello World Sample
9+
Language Hompage
1010
===
1111

12-
:main
13-
14-
ECHO "Hello World!"
15-
16-
END
17-
18-
or
19-
20-
:main
21-
22-
(ECHO "Hello World")
23-
24-
END
25-
26-
*See the examples folder for more*
12+
Check out the language homepage at [blazingk.in/blz-ospl](http://blazingk.in/blz-ospl).
2713

2814

2915
Dependencies:
@@ -57,12 +43,20 @@ How to setup and use:
5743
5844
Where INSTALLDIRECTORY is the directory where you saved the project
5945

60-
4.) From the terminal, run
46+
4.) Reload your bash profile
47+
48+
> $ source ~/.bashrc
49+
50+
5.) From the terminal, run
6151

6252
> $ blz-ospl ExampleCode.blz
6353
6454
Contact and License
6555
===
6656
For more information concerning this project, please email me at blazingkin [at] gmail [dot] com or visit [my website](http://www.blazingk.in/)
6757

68-
Copyright © 2017 Alex Gravenor under the GNU GPL V2 License
58+
This work includes a [Java BigMath library by Richard Mathar](https://arxiv.org/abs/0908.3030v3). It is in the org folder.
59+
60+
See the Extras folder for the full license
61+
62+
Copyright © 2017 Alex Gravenor under the GNU GPL V3 License

Testing/autotests/2+2.outran

-1
This file was deleted.

Testing/autotests/helloworld.outran

-1
This file was deleted.

Testing/autotests/primes.outran

-31
This file was deleted.
File renamed without changes.

Testing/GraphicsTest.blz Tests/GraphicsTest.blz

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ GRAPHICSPROPERTY "visible"
44
:test
55
TEXT 300 300 {screen.window.fps}
66
WAIT 10
7-
RJP test
7+
RJP test
8+
end

Tests/ReturnVals.blz

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
:main
2+
echo "How deep do you want to go?"
3+
nin depth
4+
for i=0, i < depth, ++i
5+
f = fibb(i)
6+
echo i "=>" f
7+
end
8+
end
9+
10+
:twoplustwo
11+
return 2 + 2
12+
end
13+
14+
:threesquared
15+
return 3 ** 2
16+
end
17+
18+
:fibb(x)
19+
if x < 2
20+
return 1
21+
end
22+
sub1 = x - 1
23+
sub2 = x - 2
24+
return fibb(sub1) + fibb(sub2)
25+
end

Testing/TestCode.blz Tests/TestCode.blz

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
set *l {system.os.name}
1515
echo {file.name} " <-file name, os-> " *l # SystemEnv variables work
1616
echo a " and " c
17-
17+
1818
(echo "1+2 = " (add 1 2))
1919
(echo "4+(4+8) = " (add 4 (add 4 8))) # Lambda Function Calls Work
2020
(define dbl (x) (add x x))
@@ -60,7 +60,7 @@
6060
wait (nested_mul 10 6 10) # Wait works along with lambda statements as arguments
6161
echo "Done testing WAIT"
6262

63-
echo (dbl 5) " THIS IS A TEST"
63+
echo (dbl 5) " = 10"
6464
echo "Please enter three numbers"
6565
nin a
6666
nin b
File renamed without changes.
File renamed without changes.

Tests/autotests/ArrayTest.blz

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
for i=0; i < 20; i = i + 1
2+
arr[i] = i
3+
end
4+
ALEN arr length # Get the length of arr and store it in length
5+
for i=0; i < length; i = i + 1
6+
echo arr[i]
7+
end
File renamed without changes.

Tests/autotests/BizzBuzz.blz

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
:main
2+
for i=0; i<20; ++i
3+
building_string = ""
4+
if i % 3 == 0
5+
building_string = "bizz"
6+
end
7+
if i % 5 == 0
8+
building_string = building_string + "buzz"
9+
end
10+
if building_string == ""
11+
building_string = i
12+
end
13+
echo building_string
14+
end
15+
end

Tests/autotests/BizzBuzz.out

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
bizzbuzz
2+
1
3+
2
4+
bizz
5+
4
6+
buzz
7+
bizz
8+
7
9+
8
10+
bizz
11+
buzz
12+
11
13+
bizz
14+
13
15+
14
16+
bizzbuzz
17+
16
18+
17
19+
bizz
20+
19

0 commit comments

Comments
 (0)