Added script to compile Meson itself.

This commit is contained in:
Jussi Pakkanen 2013-02-23 13:59:53 +02:00
parent a21737cdd7
commit d30c2eba03
2 changed files with 22 additions and 12 deletions

13
compile_meson.py Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/python3 -tt
# This file generates all files needed to run
# Meson. It does the equivalent of "make" in
# standard build systems.
import os
import mparser
fullfile = os.path.abspath(__file__)
fulldir = os.path.dirname(fullfile)
mparser.generate_parser_files(fulldir)

21
mparser.py Executable file → Normal file
View File

@ -215,20 +215,17 @@ def test_lexer():
break
print(tok)
def test_parser():
code = """func_call('something', 'or else')
objectname.methodname(abc)
emptycall()"""
print(build_ast(code))
def generate_parser_files(outputdir):
code = """project('empty', 'c')
"""
build_ast(code, outputdir=outputdir)
def build_ast(code):
def build_ast(code, outputdir=None):
code = code.rstrip() + '\n'
lex.lex()
parser = yacc.yacc()
if outputdir:
parser = yacc.yacc(outputdir=outputdir)
else:
parser = yacc.yacc()
result = parser.parse(code)
return result
if __name__ == '__main__':
#test_lexer()
test_parser()