/
shedskin.sh
executable file
·71 lines (57 loc) · 1.72 KB
/
shedskin.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
#
# Usage:
# ./shedskin.sh <function name>
set -o nounset
set -o pipefail
set -o errexit
# Problems
# - loading pickle for metadata. It has to dynamically look up classes.
# - it won't compile the pickle module due to its use of marshal!
# - TODO: we don't need metadata at all?
# Fixed
# - import posix removed in runtime.py
# - _CheckType uses AttributeError: Shed Skin doesn't like it
# Unfortunately the ShedSkin compiler crashes after 17 seconds with this error!
#
# ts = typestrnew(gx, types, cplusplus, node, check_extmod, depth, check_ret, var, tuple_check, mv=mv)
# File "/usr/lib/python2.7/dist-packages/shedskin/typestr.py", line 193, in typestrnew
# elif not node or infer.inode(gx, node).mv.module.builtin:
# AttributeError: 'NoneType' object has no attribute 'module'
#
# real 0m17.210s
# user 0m17.083s
# sys 0m0.084s
# 0.9.4 was released in 2015. Supposedly fixed in git!
#
# https://github.com/shedskin/shedskin/issues/203
install-latest() {
# NOTE: I manually transcribed what I did. Could use virtualenv?
pushd ~/git/languages/shedskin
python setup.py build
sudo python setup.py install
}
make-tree() {
local out=_tmp/shedskin
mkdir -p $out
#cp -v asdl/{arith_parse.py,tdop.py} _devbuild/gen/demo_asdl.py $out
# dependencies of generated code
# unpickle probably won't work
cp -v asdl/{const.py,runtime.py} $out
}
run-python() {
pushd demo/shedskin
./arith_parse.py '1+2'
}
# With latest, this generates C++ code, but it doesn't compile.
#
# TODO: Try something based on tdop.py that is a single module? There are too
# many modules here.
compile() {
pushd demo/shedskin
time shedskin arith_parse
}
count-output() {
wc -l demo/shedskin/*.{cpp,hpp} Makefile
}
"$@"