Added script to compile Meson itself.

pull/15/head
Jussi Pakkanen 12 years ago
parent a21737cdd7
commit d30c2eba03
  1. 13
      compile_meson.py
  2. 19
      mparser.py

@ -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)

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

Loading…
Cancel
Save