From 6db9bb1f3fc2924b420829748cc3df542308fde7 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Sat, 15 Mar 2025 19:37:31 +0100 Subject: [PATCH] adding command parser --- spf.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) mode change 100644 => 100755 spf.py diff --git a/spf.py b/spf.py old mode 100644 new mode 100755 index b591dcd..ecb0e34 --- a/spf.py +++ b/spf.py @@ -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()