-
Notifications
You must be signed in to change notification settings - Fork 35
Transpile boolean.py into javascript - Python3-only #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alisianoi
wants to merge
36
commits into
bastikr:master
Choose a base branch
from
alisianoi:transpile
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
a50641f
Create an entry_point for transpile script
d0f5a63
Add basic logging and config parsing
3c53b3a
Make logging levels flexible/configurable
af90c89
Make the subprocess.run call transcrypt
220884f
Move transpile into etc directory as separate script
36505c6
Add commented out ast preprocessing attempt
0d422b5
Replace all super calls to 3.x style super()
50ff405
Add a template boolean.html that imports produced javascript
03ab850
Rewrite __nonzero__ and __bool__ with explicit def *(self):
e985f8e
FIXME: add boolean.js (result of transpilation)
0abbb51
Remove _wrap_type from BooleanAlgebra
6d5f946
Remove basestring: it causes a RuntimeError in algebra.parse
c6e334e
Add __javascript__ (generated by transcrypt) to .gitignore
ea3301f
Update transpile.py: add -b and -e 6
4815da5
FIXME: update boolean.js
dbe71d4
Avoid relying on the fact that dictionaries throw a KeyError
f92ecff
FIXME: Update transpiled boolean.js: string functions and .get for di…
e6c1557
Drop python 2.7 from .travis.yml
85f0cb0
Add '.toString' method to _TRUE, _FALSE, and Symbol
57fa7ef
Drop issubclass, use a simpler runtime check
52aa0a0
Rename etc -> transpile, like in license_expression
3a32592
Remove old transpilation location (boolean/__javascript__)
7f4dcfd
Update transpile.py to put transpilation into boolean.js/__javascript__
6fd765e
Add an index.html that allows debugging in the browser
0573c39
Add a package.json for the transpiled version
6eece14
Add first basic test for transpiled boolean.py
61fa426
Add tests for BaseElement
8a2679f
Add tests for Symbol
ca1019c
Add tests for BooleanAlgebra class
ce542fe
Add tests for AND/OR with negated literals (skipped)
b07b931
Add tests for .cancel() and .literalize() (half skipped)
55df069
Add .simplify() tests, rename a variable
f71c584
Add tests for .demorgan()
2796e43
Add .annihilator tests
2f44d6e
Add .identity tests (skipped)
ee8a0c8
Add node_modules, yarn.lock and .python-version to .gitignore
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,8 @@ | ||
*.pyc | ||
__javascript__ | ||
node_modules | ||
.python-version | ||
yarn.lock | ||
/boolean.py.egg-info/ | ||
/build/ | ||
/.tox/ | ||
|
This file contains hidden or 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ sudo: false | |
language: python | ||
|
||
python: | ||
- "2.7" | ||
# - "2.7" | ||
- "3.4" | ||
- "3.5" | ||
- "3.6" | ||
|
This file contains hidden or 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 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>License Expression Sandbox</title> | ||
</head> | ||
<body> | ||
<p> | ||
If you would like to run boolean.py in the browser, | ||
you should tell Transcrypt to transpile it for the browser: | ||
</p> | ||
<code>python transpile/transpile.py --browser</code> | ||
<p> | ||
This will define function <code>boolean</code> on the | ||
<code>window</code> object. | ||
</p> | ||
<p> | ||
Without the <code>--browser</code> flag, the <code>boolean</code> | ||
function will be defined on the <code>module.exports</code> object, | ||
which works for node.js | ||
</p> | ||
<p>To debug boolean.py in the browser, open developer tools.</p> | ||
<script src="./__javascript__/boolean.js"></script> | ||
</body> | ||
</html> |
This file contains hidden or 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 hidden or 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,15 @@ | ||
{ | ||
"name": "boolean.js", | ||
"version": "3.4", | ||
"description": "Define boolean algebras, create and parse boolean expressions and create custom boolean DSL.", | ||
"main": "boolean.js/__javascript__/boolean.js", | ||
"repository": "[email protected]:all3fox/boolean.py", | ||
"author": "Alexander Lisianoi <[email protected]>", | ||
"license": "BSD-3-Clause", | ||
"scripts": { | ||
"test": "mocha tests.js" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^3.5.0" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, you both ignored this and committed code that is in the dir.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I did that on purpose: currently, having
__javascript__/boolean.js
let's you avoid the hassle of getting a vendored version of Transcrypt and making it work. Later I will remove__javascript__/boolean.js
and the.gitignore
will stay.