This repository was archived by the owner on Jan 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (46 loc) · 1.63 KB
/
Copy pathMakefile
File metadata and controls
67 lines (46 loc) · 1.63 KB
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
default: build
# bake parser.js.src out of Bison file parse.y,
# then preprocess the result with C preprocessor (cpp)
bison:
bison -l -r all -o parse.js.src parse.y
# different builds for different purposes
build: bison
cpp -w -E -P parse.js.src > parse.js
build_debug: bison
cpp -w -E -P -DDEBUG -DYYDEBUG parse.js.src > parse.js
test: build
jasmine-node spec/
check:
jasmine-node spec/
# check if the parser state machine been touched
diff: build
git diff -- parse.js.output
# just run the parser, it knows how to test itself
# add --use_strict to enshure the whole script is under protection :)
debug: build_debug
d8 --use_strict run/console.js parse.js run/debug.js
debug-lexer: build_debug
d8 --use_strict run/console.js parse.js run/debug-lexer.js \
| grep 'Next token'
# profile with d8
prof: build
d8 --prof --use_strict run/console.js run/bench.js
# benchmark agains giant ruby file
bench: build
v8 run/console.js run/bench.js
DIFF=git diff --no-index --color --
CLEAN_BISON_LOG=sed -E 's/ +\(line [0-9]+\)| \(\)//g'
compare: build_debug
ruby20 -W2 -yc debug.rb 2>&1 | $(CLEAN_BISON_LOG) >tmp/a.tmp
d8 --use_strict run/console.js parse.js run/compare.js \
| $(CLEAN_BISON_LOG) >tmp/b.tmp
$(DIFF) tmp/a.tmp tmp/b.tmp | cat
compare-giant: build_debug
ruby20 -W2 -yc tests/giant.rb 2>&1 | $(CLEAN_BISON_LOG) >tmp/a.tmp
d8 --use_strict run/console.js parse.js run/compare-giant.js \
| $(CLEAN_BISON_LOG) >tmp/b.tmp
$(DIFF) tmp/a.tmp tmp/b.tmp | cat
# # convert the original parse.y to readable form
# # DISFUNCTIONAL
# ruby_source:
# gindent -nut -bl -bli0 -cli2 -npcs ruby20parse.lexer.y -o ruby20parse.lexer.pretty.y