adding command parser
This commit is contained in:
		
							
								
								
									
										28
									
								
								spf.py
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										28
									
								
								spf.py
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -1,10 +1,30 @@ | ||||
| # Projet de compilation Umons 2025 | ||||
| #!/usr/bin/env python | ||||
|  | ||||
| # Projet de compilation Umons 2025 | ||||
| # Par Debucquoy Anthony (231687) | ||||
|  | ||||
| import argparse | ||||
| import lark | ||||
| import sys | ||||
|  | ||||
| # TODO: utiliser argparse | ||||
| # TODO: utiliser Interpreter de lark | ||||
|  | ||||
| def main(): | ||||
|     print("Hello Wordl") | ||||
|     parser = argparse.ArgumentParser() | ||||
|     parser.add_argument("spf_file", help="Fichier source à interpréter") | ||||
|     parser.add_argument("-d", "--dump", | ||||
|                         help="affichage de la mémoire du programme", | ||||
|                         action="store_true") | ||||
|     parser.add_argument("-t", "--trace", | ||||
|                         help="affichage de la mémoire au cours du programme", | ||||
|                         action="store_true") | ||||
|     args = parser.parse_args() | ||||
|  | ||||
|     if args.dump: | ||||
|         print("Dump activated", file=sys.stderr) | ||||
|  | ||||
|     if args.trace: | ||||
|         print("Trace activated", file=sys.stderr) | ||||
|  | ||||
|  | ||||
| if __name__ == "__main__": | ||||
|     main() | ||||
|  | ||||
		Reference in New Issue
	
	Block a user