Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #75 from SK1Y101/develop
Browse files Browse the repository at this point in the history
exponentiation incorrect
  • Loading branch information
mergify[bot] authored Mar 26, 2021
2 parents d781d22 + eeb8722 commit 66ab403
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
30 changes: 21 additions & 9 deletions ExampleCode/BasicGrammar.skiy
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
//An example of the absolute minimum required for a Skiylia pre-release

//reserved words:
true, false, null, var, if, else, elif, while, for, do, Where , When, def, class, super, self, print, str, string, int, integer, float
true, false, null, var, and, or, xor, if, else, elif, while, for, do, Where, When, def, class, super, self, {primitives}

//required symbols:
'(', ')', ':', ',', '.', '-', '+', '*', '/', '//', '>', '<', '=', '!', '"', '&', '|',
'(', ')', ':', ',', '.', '-', '+', '*', '/', '>', '<', '=', '!', '"', '&', '|',

//GRAMMAR IDEAS BELOW
//single line comments

///this is a multi-line comment.
it must be completed with another set of three slashes///

//Bool
true
false

//numbers
123 //int
12.4 //float
0 //evaluates as false, all else true
0 //zero evaluates as false, all others as true

//strings
"56" //string, not int
Expand All @@ -31,6 +34,7 @@ null //None-type
a + b //addition
a - b //subtraction
a * b //multiplication
a ** b //exponentiation
a / c //division

//Comparisons and equalities
Expand All @@ -42,12 +46,15 @@ a != b //not equal to
//Logical operators
-a //negates the value of a -6 -> 6, "-6" causes an error (at the present)
!a //not a
a & b //a and b
a | b //a or b
a ^ b //a xor b
a & b //a and b
a | b //a or b
a ^ b //a xor b
a and b //a and b
a or b //a or b
a xor b //a xor b

//Variables and assignment
var a //initialise as null
var a //initialise as 0
a = 5 //reassign a as 5. a must already exist

//control flow
Expand Down Expand Up @@ -149,8 +156,13 @@ class Test:
print(thing-to-print) //shows display to screen, can be any data-type or variable
str(a) / string(a) //explicitly converts a to a string
int(a) / integer(a) //explicitly converts a to an integer
flt(a) / float(a) //explicitly converts a to a float
float(a) //explicitly converts a to a float

//primitives (Functions from the base language, rather than ones I wrote myself)
clock //returns the current utc time
runtime //returns the time since the script started executing code <- NOT SURE HOW TO DO THIS YET
abs(a) //return the absolute value of a
ceil(a) //returns a, rounded up
floor(a) //returns a, rounded down
pow(a, b) //returns a raised to the power b
mod(a, b) //returns a modulo b
round(a, b) //returns a, rounded to 'b' decimal places
3 changes: 0 additions & 3 deletions PySkiylia/Interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ def BinaryExpr(self, expr):
return float(left) / float(right)
elif optype == "StarStar":
self.checkNumber(expr.operator, left, right)
#divide if given
if float(right) == 0:
raise RuntimeError([expr.operator,"division by zero"])
return float(left) ** float(right)
elif optype == "Star":
#check if one (and only one) is a number, so we can repeat substrings
Expand Down

0 comments on commit 66ab403

Please sign in to comment.