Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: tools/lexer_generator/generator.py

Issue 63183007: Experimental parser: dfa minimization (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/lexer_generator/dfa.py ('k') | tools/lexer_generator/rule_parser.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 the V8 project authors. All rights reserved. 1 # Copyright 2013 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 parser = argparse.ArgumentParser() 89 parser = argparse.ArgumentParser()
90 parser.add_argument('--html') 90 parser.add_argument('--html')
91 parser.add_argument('--re', default='src/lexer/lexer_py.re') 91 parser.add_argument('--re', default='src/lexer/lexer_py.re')
92 parser.add_argument('--input') 92 parser.add_argument('--input')
93 parser.add_argument('--code') 93 parser.add_argument('--code')
94 args = parser.parse_args() 94 args = parser.parse_args()
95 95
96 re_file = args.re 96 re_file = args.re
97 print "parsing %s" % re_file 97 print "parsing %s" % re_file
98 with open(re_file, 'r') as f: 98 with open(re_file, 'r') as f:
99 rule_processor = RuleProcessor.parse(f.read()) 99 rule_processor = RuleProcessor.parse(f.read(), False)
100 100
101 html_file = args.html 101 html_file = args.html
102 if html_file: 102 if html_file:
103 html = generate_html(rule_processor) 103 html = generate_html(rule_processor)
104 with open(args.html, 'w') as f: 104 with open(args.html, 'w') as f:
105 f.write(html) 105 f.write(html)
106 print "wrote html to %s" % html_file 106 print "wrote html to %s" % html_file
107 107
108 code_file = args.code 108 code_file = args.code
109 if code_file: 109 if code_file:
110 code = generate_code(rule_processor) 110 code = generate_code(rule_processor)
111 with open(code_file, 'w') as f: 111 with open(code_file, 'w') as f:
112 f.write(code) 112 f.write(code)
113 print "wrote code to %s" % code_file 113 print "wrote code to %s" % code_file
114 114
115 input_file = args.input 115 input_file = args.input
116 if input_file: 116 if input_file:
117 with open(input_file, 'r') as f: 117 with open(input_file, 'r') as f:
118 lex(rule_processor, f.read()) 118 lex(rule_processor, f.read())
OLDNEW
« no previous file with comments | « tools/lexer_generator/dfa.py ('k') | tools/lexer_generator/rule_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698