Skip to content

Commit

Permalink
Add driver example
Browse files Browse the repository at this point in the history
  • Loading branch information
MikePopoloski committed Dec 2, 2023
1 parent 5d53960 commit 44b1172
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions examples/driver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import sys

from pyslang import *


def main():
# Create a slang driver with default command line arguments
driver = Driver()
driver.addStandardArgs()

# Parse command line arguments
args = " ".join(sys.argv)
if not driver.parseCommandLine(args, CommandLineOptions()):
return

# Process options and parse all provided sources
if not driver.processOptions() or not driver.parseAllSources():
return

# Perform elaboration and report all diagnostics
compilation = driver.createCompilation()
driver.reportCompilation(compilation, False)


if __name__ == "__main__":
main()

0 comments on commit 44b1172

Please sign in to comment.