mirror of
https://github.com/Open-Argon/Argon.git
synced 2026-10-28 09:43:38 +00:00
READ ME PLZ!!!!1!1!!1
This commit is contained in:
1 parent
4c88d31f90
commit
ca2aaf17dd
6 files changed
+53
-12
No files matched your search
@@ -1,2 +1,2 @@
|
||||
language = "python3"
|
||||
language = "python3.8"
|
||||
run = "python argon.py example.ar"
|
||||
@@ -67,12 +67,24 @@ while (yes) [
|
||||
Items (Lists or Arrays):
|
||||
```javascript
|
||||
[1, 2, 3]
|
||||
['john', 'joe', 'bob']
|
||||
const names = ['john', 'joe', 'bob']
|
||||
|
||||
log(names[2])
|
||||
```
|
||||
|
||||
Books (Dictionaries or Objects):
|
||||
```javascript
|
||||
{'name': 'bob', 'age': 34, 'hobbies': ['Programming in Argon!', 'Playing video games!']}
|
||||
const user = {'name': 'bob', 'age': 34, 'hobbies': ['Programming in Argon!', 'Playing video games!']}
|
||||
|
||||
log(user['name'])
|
||||
```
|
||||
|
||||
Subs (Functions):
|
||||
```javascript
|
||||
sub hello(username) [
|
||||
return 'hello, ' + username + ', how are you?'
|
||||
]
|
||||
log(hello('bob'))
|
||||
```
|
||||
|
||||
## How do I run Argon?
|
||||
|
||||
@@ -46,7 +46,7 @@ def colourify(colour, text):
|
||||
return "\033[95m" + text + "\033[0m"
|
||||
|
||||
# make a function that takes in a param of any type and returns it as a number
|
||||
def number(value: Any) -> (int | float):
|
||||
def number(value: Any):
|
||||
try:
|
||||
inted = int(value)
|
||||
floated = float(value)
|
||||
@@ -170,9 +170,12 @@ vars = {
|
||||
'JSONstringify':{'type': 'init', 'py': json.dumps},
|
||||
'pi': {'type': 'init', 'value': math.pi},
|
||||
'e': {'type': 'init', 'value': math.e},
|
||||
'sin': {'type': 'init', 'py': math.sin},
|
||||
'cos': {'type': 'init', 'py': math.cos},
|
||||
'tan': {'type': 'init', 'py': math.tan},
|
||||
'sin': {'type': 'init', 'py': lambda x: math.sin(math.radians(x))},
|
||||
'cos': {'type': 'init', 'py': lambda x: math.cos(math.radians(x))},
|
||||
'tan': {'type': 'init', 'py': lambda x: math.tan(math.radians(x))},
|
||||
'rsin':{'type': 'init', 'py': math.sin},
|
||||
'rcos': {'type': 'init', 'py': math.cos},
|
||||
'rtan': {'type': 'init', 'py': math.tan},
|
||||
'asin': {'type': 'init', 'py': math.asin},
|
||||
'acos': {'type': 'init', 'py': math.acos},
|
||||
'atan': {'type': 'init', 'py': math.atan},
|
||||
@@ -183,7 +186,6 @@ vars = {
|
||||
'asinh': {'type': 'init', 'py': math.asinh},
|
||||
'acosh': {'type': 'init', 'py': math.acosh},
|
||||
'atanh': {'type': 'init', 'py': math.atanh},
|
||||
'radians': {'type': 'init', 'py': math.radians},
|
||||
'exp': {'type': 'init', 'py': math.exp},
|
||||
'logarithm': {'type': 'init', 'py': math.log},
|
||||
'logarithm10': {'type': 'init', 'py': math.log10},
|
||||
@@ -349,7 +351,7 @@ def runSub(subname, args):
|
||||
f"{vars[subname]['f']['prams'][i]} is an initialized variable / function")
|
||||
kwargs[vars[subname]['f']['prams'][i]] = {
|
||||
'type': 'var', 'value': args[i]}
|
||||
run(vars[subname]['f']['code'], kwargs)
|
||||
return run(vars[subname]['f']['code'], kwargs, True)[1]
|
||||
|
||||
# value Argon executer takes in a string and runs it through the parser
|
||||
def val_Aexec(string, eval=False, vars=vars) -> Tuple[bool, Any]: # returns a tuple of a bool and a value
|
||||
@@ -672,7 +674,7 @@ runnerREGEX = re.compile(
|
||||
r"( *)(while( +)\(.*\)|if( +)\(.*\)|(sub)( +)([a-zA-Z]+)\((.*)\)( +))( *)\[( *)")
|
||||
|
||||
|
||||
def run(code: list, vars=vars):
|
||||
def run(code: list, vars=vars, isSub = False):
|
||||
Runnertype = ""
|
||||
Runnercheck = None
|
||||
inRunner = 0
|
||||
@@ -691,7 +693,9 @@ def run(code: list, vars=vars):
|
||||
subdata = "".join(line.strip().split(' ')[1:]).split('(')
|
||||
subname = subdata[0]
|
||||
prams = '('.join(subdata[1:]).split(')')[0].split(',')
|
||||
print(subname, prams)
|
||||
for i in range(len(prams)):
|
||||
if prams[i] == '':
|
||||
prams.pop(i)
|
||||
else:
|
||||
Runnercheck = ''.join(line.strip().split(' ')[1:])[
|
||||
:-1].strip()[1:-1]
|
||||
@@ -735,7 +739,10 @@ def run(code: list, vars=vars):
|
||||
else:
|
||||
Runnercode.append(line)
|
||||
elif line != "":
|
||||
if isSub and line.strip().startswith('return'):
|
||||
return Aexec(line.strip()[6:], vars=vars, eval=True)
|
||||
Aexec(line, vars=vars)
|
||||
return False, None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ var diameter = 0
|
||||
|
||||
var i = 0
|
||||
while (i <- sides/2) [
|
||||
diameter = diameter + sin(radians(angles*i))
|
||||
diameter = diameter + sin(angles*i)
|
||||
i++
|
||||
]
|
||||
log('pi is',sides/diameter)
|
||||
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
package = []
|
||||
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "fafb334cb038533f851c23d0b63254223abf72ce4f02987e7064b0c95566699a"
|
||||
|
||||
[metadata.files]
|
||||
@@ -0,0 +1,14 @@
|
||||
[tool.poetry]
|
||||
name = "argon"
|
||||
version = "2.2.1"
|
||||
description = ""
|
||||
authors = ["WillBell1 <<>>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.8"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
Reference in new issue
Block a user