-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSConstruct
30 lines (22 loc) · 930 Bytes
/
SConstruct
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
import os
import re
env = Environment();
env.Append(ENV={'CLASSPATH':'/usr/share/java/stringtemplate.jar:/usr/share/java/antlr-3.1.3.jar'})
def antlr_py_emitter(target, source, env):
target=[]
fname, ext = os.path.splitext(str(source[0]))
target.append(fname+'Lexer.py')
target.append(fname+'Parser.py')
target.append(fname+'.tokens')
return (target, source)
antlr_py = Builder(action='java org.antlr.Tool $SOURCE', src_suffix='.g', emitter=antlr_py_emitter)
env.Append(BUILDERS={'AntlrPy' : antlr_py})
env.Append(BUILDERS={'AntlrTreePy' :
Builder(action='java org.antlr.Tool $SOURCE',
src_suffix='.g',
suffix='.py')})
vcd_grammar = env.AntlrPy('ValueChangeDump')
interpreter = env.AntlrTreePy('InterpretVCDHeader')
Depends(interpreter, vcd_grammar)
sim = env.AntlrTreePy('VCDSimulation')
Depends(sim, vcd_grammar)