-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e20c356
commit 1ed951f
Showing
92 changed files
with
2,898 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
{ | ||
"files": { | ||
"interpreter/env/builtins.py": [ | ||
{ | ||
"id": "9f98d1ad-f7d9-47e0-b397-4693b1af0ec4", | ||
"line": 531, | ||
"version": 3942, | ||
"index": 15827 | ||
} | ||
] | ||
} | ||
"files": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ | |
/dist/ | ||
*.bat | ||
*.spec | ||
preferences.toml | ||
.env | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
run = "python3 main.py" | ||
run = "py3clean . & python3 main.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
- Support for variables in the `catch` statement | ||
- Complete requests HTTP library | ||
- Complete regex support | ||
- Better interfacing with python code from ParaCode | ||
|
||
## [2.0.0] - 2021-10-9 | ||
### Added | ||
- Standard library written largely in ParaCode itself | ||
- Repl | ||
- PCPM (ParaCode Package Manager) | ||
- Documentation | ||
- More, higher quality, examples | ||
- Update script | ||
- `try`/`catch` statements and exceptions | ||
- New types and aliases | ||
- Basic interfacing with python code from ParaCode | ||
|
||
### Changed | ||
- Completely rewrote the language as an OOP language | ||
- Separated everything into multiple files | ||
- Improved `import` statement drastically | ||
|
||
### Removed | ||
- `shell.py` file | ||
- Unnecessary files | ||
|
||
### Security | ||
- PCPM package uploading doesn't require a login | ||
|
||
[Unreleased]: https://github.com/DaRubyMiner360/ParaCode/compare/v2.0.0...HEAD | ||
[2.0.0]: https://github.com/DaRubyMiner360/ParaCode/releases/tag/v2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import subprocess | ||
import sys | ||
import os | ||
|
||
rcmd = "( find ./ -name '*.%s' -print0 | xargs -0 cat ) | wc -l" | ||
types = ['c', 'cpp', 'h', 'hpp', 'py', 'para', 'paracode', 'go', 'sh'] | ||
|
||
if len(sys.argv) > 1: | ||
if sys.argv[1].lower() == "lines": | ||
rcmd = "( find ./ -name '*.%s' -print0 | xargs -0 cat ) | wc -l" | ||
elif sys.argv[1].lower() == "words": | ||
rcmd = "( find ./ -name '*.%s' -print0 | xargs -0 cat ) | wc -w" | ||
elif sys.argv[1].lower() == "chars": | ||
rcmd = "( find ./ -name '*.%s' -print0 | xargs -0 cat ) | wc -m" | ||
elif sys.argv[1].lower() == "bytes": | ||
rcmd = "( find ./ -name '*.%s' -print0 | xargs -0 cat ) | wc -c" | ||
elif sys.argv[1].lower() == "maxlinelength" or sys.argv[1].lower() == "max-line-length" or sys.argv[1].lower() == "mll": | ||
rcmd = "( find ./ -name '*.%s' -print0 | xargs -0 cat ) | wc -L" | ||
|
||
if len(sys.argv) > 2: | ||
if sys.argv[2].lower() == "c": | ||
types = ['c', 'h'] | ||
elif sys.argv[2].lower() == "c++" or sys.argv[2].lower() == "cpp": | ||
types = ['cpp', 'h', 'hpp'] | ||
elif sys.argv[2].lower() == "allc": | ||
types = ['c', 'cpp', 'h', 'hpp'] | ||
elif sys.argv[2].lower() == "python" or sys.argv[2].lower() == "py": | ||
types = ['py'] | ||
elif sys.argv[2].lower() == "paracode" or sys.argv[2].lower() == "para": | ||
types = ['para', 'paracode'] | ||
elif sys.argv[2].lower() == "main": | ||
types = ['c', 'cpp', 'h', 'hpp', 'py', 'para', 'paracode'] | ||
elif sys.argv[2].lower() == "go": | ||
types = ['go'] | ||
elif sys.argv[2].lower() == "sh": | ||
types = ['sh'] | ||
|
||
sum = 0 | ||
for el in types: | ||
if len(sys.argv) > 1 and sys.argv[1].lower() != "files": | ||
cmd = rcmd % (el) | ||
p = subprocess.Popen([cmd],stdout=subprocess.PIPE,shell=True) | ||
out = int(p.stdout.read().strip()) | ||
print("*.%s: %s" % (el, out)) | ||
sum += out | ||
else: | ||
out = 0 | ||
for root, dirs, files in os.walk(os.path.dirname(os.path.realpath(__file__))): | ||
for file in files: | ||
if file.endswith("." + el): | ||
out += 1 | ||
print("*.%s: %s" % (el, out)) | ||
sum += out | ||
print("sum: %d" % (sum)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from ParaCode import ParaCode | ||
|
||
def example_embed(paraCode): | ||
paraCode.call_function('print', ["Hello from embed.py!"]) | ||
paraCode.call_function('print', ["Hello from embed.py!"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
try { | ||
// Comment below line, change the exception to MultipleDefinitionError, TypeError, ArgumentError, MacroExpansionError, or Exception | ||
ArgumentError.new("A").raise(); | ||
print("TRY"); | ||
} | ||
catch MultipleDefinitionError { | ||
print("CATCH MultipleDefinitionError"); | ||
} | ||
catch [TypeError, ArgumentError] { | ||
print("CATCH ArgumentError/TypeError"); | ||
} | ||
catch MacroExpansionError { | ||
print("CATCH MacroExpansionError"); | ||
} | ||
catch { | ||
print("CATCH Any Exception"); | ||
} | ||
else { | ||
print("ELSE"); | ||
} | ||
finally { | ||
print("FINALLY"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
let width = 40.0; | ||
let height = 20.0; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
let Person = Type.extend({ | ||
instance = { | ||
name: str | ||
instance = { | ||
name: str | ||
|
||
// overload the | operator | ||
func __bitor__(self, other) { | ||
return Person.new(self.name + ' ' + other.name); | ||
} | ||
// overload the | operator | ||
func __bitor__(self, other) { | ||
return Person.new(self.name + ' ' + other.name); | ||
} | ||
|
||
// example of lambdas | ||
to_str: Func = self -> "Person [name: " + self.name + "]" | ||
} | ||
// example of lambdas | ||
to_str: Func = self -> "Person [name: " + self.name + "]" | ||
} | ||
|
||
// constructor | ||
func __construct__(self, name) { | ||
self.name = name; | ||
} | ||
// constructor | ||
func __construct__(self, name) { | ||
self.name = name; | ||
} | ||
}); | ||
|
||
let person_a = Person.new('Bruce'); | ||
let person_b = Person.new('Wayne'); | ||
let combined = person_a | person_b; | ||
io.write_color(Console.RED, combined); // prints `Person [name: 'Bruce Wayne']` in red | ||
io.write_color(Console.RED, combined); // prints `Person [name: 'Bruce Wayne']` in red |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
Int.patch({ | ||
// overload object being called as a function. | ||
// arguments are passed in as an array, so | ||
// you need to splat (*) the arguments, expanding | ||
// from the first (the first argument would be the `Int` type | ||
// itself) | ||
func __call__(self, args) { | ||
return self.__mul__(*(args.from(1))); | ||
} | ||
// overload object being called as a function. | ||
// arguments are passed in as an array, so | ||
// you need to splat (*) the arguments, expanding | ||
// from the first (the first argument would be the `Int` type | ||
// itself) | ||
func __call__(self, args) { | ||
return self.__mul__(*(args.from(1))); | ||
} | ||
}); | ||
|
||
let result = 10(20); | ||
print(result); // prints 200 | ||
print(result); // prints 200 |
Oops, something went wrong.