-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of implementation files and Readme.
- Loading branch information
0 parents
commit 3058cb8
Showing
11 changed files
with
2,870 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
__pycache__ | ||
*NOT for repos* | ||
*DATED* | ||
*OLD* |
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,25 @@ | ||
# Pip | ||
|
||
Pip is an interpreted, imperative code-golf language. | ||
|
||
### Usage | ||
|
||
Pip is implemented in Python3. The main interpreter is the pip.py file. It should run on most systems with Py3 installed simply by invoking `pip.py` in the shell (you'll need to make the file executable first on *nix systems). Typical invocation patterns: | ||
|
||
`pip.py [flags] path/to/codefile.pip [args]` | ||
`pip.py -e 'code' [flags] [args]` | ||
`pip.py` (interactive mode) | ||
|
||
Execute `pip.py --help` for more detailed information. | ||
|
||
### Why Pip? | ||
|
||
Pip's main reason for existence is to be a golfing language that 1) is imperative, and 2) uses infix operators. I do enjoy the challenge of stack-based programming from time to time, but I find the imperative paradigm much easier to think in, and therefore better. In my very unscientific testing so far, Pip has attained golfing scores roughly similar to those of GolfScript. | ||
|
||
### What does the name refer to? | ||
|
||
[This fellow](http://en.wikipedia.org/wiki/Pip_(Great_Expectations)), of course. | ||
|
||
Actually, the name "Pip" originated as a [recursive acronym](http://en.wikipedia.org/wiki/Recursive_acronym), though exactly what it stands for is open to debate. For some possibilities, see The Tao of Pip. The name was also chosen for its connotations of smallness. | ||
|
||
Pip is **not** to be confused with [pip](http://en.wikipedia.org/wiki/Pip_(package_manager)). |
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,11 @@ | ||
Pip isn't Python. | ||
Pip isn't Perl. | ||
Pip isn't PHP. | ||
|
||
What is Pip? | ||
|
||
Pip is procedural. | ||
Pip is portable. | ||
Pip is precise. | ||
Pip is pithy. | ||
Pip is Pip! |
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,29 @@ | ||
|
||
import sys | ||
|
||
class FatalError(Exception): | ||
"""Class for throwing fatal errors.""" | ||
pass | ||
|
||
class ErrorReporter: | ||
"""Class for reporting error messages.""" | ||
def __init__(self, warnings=False): | ||
# The warnings parameter determines whether to print nonfatal | ||
# errors to stderr or suppress them | ||
self._warnings = warnings | ||
|
||
def warn(self, *message): | ||
"""Print a nonfatal error if warnings are turned on.""" | ||
# Covert built-in Pip types in the message to strings of their names | ||
message = (str(item)[15:-2] if "ptypes" in str(item) else item | ||
for item in message) | ||
if self._warnings: | ||
print(*message, file=sys.stderr) | ||
|
||
def die(self, *message): | ||
"""Print a fatal error and exit.""" | ||
# Covert built-in Pip types in the message to strings of their names | ||
message = (str(item)[15:-2] if "ptypes" in str(item) else item | ||
for item in message) | ||
print(*message, file=sys.stderr) | ||
raise FatalError() |
Oops, something went wrong.