Peridot

Latest version: v1.1.2

Safety actively analyzes 620778 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.1

Added:
- File reading and writing
- Peridot command line command
`peridot [OPTIONS]* [FILE]? [ARGS]*`

Modified:
- REPL

Usage:

File reading and writing

var file = include('file')

var f = file.open('test.txt')
print(f.read())
f.close()

var f = file.open('test.txt', mode='write')
f.write('Hello\n')
f.close()


pre-06
Added:
- Switch statements
- Dictionaries
- Include statements
- Namespace type
- Attributes
- Lambdas
- Type built-in function

Modified:
- Less strict code block syntax
- Typed function arguments and return values
- Eqequals system for most types

Usage

Switch statements

var fuel = 50
switch (var x as fuel) {
when (x < 0) {
print('Umm...')
}
when (x == 0) {
print('Out of fuel')
}
when (x <= 10) {
print('Almost out of fuel')
}
when (x <= 30) {
print('Might want to fill up')
}
when (x <= 60) {
print('Okay for now')
}
when (x <= 99) {
print('Almost full')
}
when (x == 100) {
print('Full')
}
else {
print('Too much')
}
}



Dictionaries

var apples = {
'a': 'apple',
'b': 'babble',
'c': 'cobble',
'd': 'dabble',
'f': 'fable',
'g': 'gurgle',
'h': 'hurdle'
}
print(
apples['d']
)



Include statements (Returns namespace type) & Attributes

var module = include('testmodule.peri')
print(str(
module.add(1, 2)
))



Lambdas

var add = lambda(a: int, b: int) -> int {a + b}
print(str(
add(1, 2)
))



Type built-in function

var string = type('hello')
print(str(
string
))
print(
string(10.0)
)



Code block syntax is less strict

func (a: int, b: int) -> int {i_can_put_stuff_here('hello')
and_here('hello')}



Function arguments and return values are typed

func(a: int, b: int) -> float {
^^^ ^^^ ^^^^^
return(float(a + b))
}


pre-05
New Documentation Link:
- [Peri.dot Language Docs](https://toto-bird.github.io/Peri.dot-lang/)

Added:
- Tuples
- Added iterator indices.
- If-elif-else statements
- For and while loops
- Range built-in function
- Continue and break statements
- New lines after brackets

Changed:
- Variables storing null types can now be changed to any type without reinitialization

Usage

Tuples:
var a = ((1, 2, 3), 4, ((5, 6), 7))


If-elif-else statements & Iterator indices:
if (a[0][1] == 2) {
print('Second item of first item of a is 2')
} elif (a[1] == 4) {
print('Second item of a is 4)
} else {
print('Neither of the above')
}


For loop & Range built-in function:
for (var i in range(1, 11, 1)) {
print(str(i))
}


While loop & Continue and break statements:
var i = 0
while (True) {
if (i == -50) {
continue()
} elif (i == -100) {
break()
}
print(str(i))
i = i - 1
}


New lines after brackets:
print(
str(
10
)
)


pre-04
New Documentation Link:
- [Peri.dot Language Docs](https://toto-bird.github.io/Peri.dot-lang/)

Added:
- Built-in functions
- print
- assert
- panic
- str
- int
- float
- id
- Multiline comments

Improved:
- Error messages

New Error Messages
When running:

var a = 0
var b = a

1.0

1 < 10
1 <= 1
10 > 1
1 >= 1

True and True
True or False
not False


pre-01
Added:
- Variable creation
- Variable assignment
- Variable access
- None Type

Usage:
*Warning: Blank lines are not yet supported.*

var a
var a, b = 10
a = 20
a, b = 20
(a + 20) * b


pre-00
Added:
- Integers
- Floating Point Numbers
- Strings
- +, -, *, /, ^ operations

Usage:
*Warning: Blank lines are not yet supported.*

"This is a string"
'This is also a string'
10 + 20
1 * (10 + 30)

0.0

c - b

New error message:

Traceback (Most recent call last):
╠═File test.peri, In UNKNOWN
║ Line 3, Column 9
║ var c = 0.0
║ ^^^
║ ╠═File test.peri, In UNKNOWN
║ ║ Line 1, Column 9
║ ║ var a = 0
║ ║ ^
╠═File test.peri, In UNKNOWN
║ Line 2, Column 9
║ var b = a
║ ^
File test.peri, In <file>
Line 4, Column 1
c - b
^^^^^
OperationException: Int can not be subtracted from Float


pre-03
Added:
- Function creation
- Function calling
- Exception handling
- Function and exception types

Usage:

var div = func(a, b) {
a / b
}

var try = handler {
div(10, 0)
}

try


pre-02
Added:
- Comparisons
- Logical operators
- Booleans
- Internal error handling

Usage:

1 == 1

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.