Add sample for ast extraction.

pull/1/head
Stella Laurenzo 2020-06-06 21:29:20 -07:00
parent 0cc0a7165e
commit 7b95d860e9
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
from npcomp.compiler.frontend import *
def binary_expression():
a = 1
b = 100
c = a * b + 4
return c
fe = ImportFrontend()
try:
f = fe.import_global_function(binary_expression)
finally:
print(fe.ir_module.to_asm(debug_info=True))