c0check 0.1 → 0.2
raw patch · 2 files changed
+8/−8 lines, 2 filesdep ~c0parser
Dependency ranges changed: c0parser
Files
- c0check.cabal +4/−4
- src/c0check.hs +4/−4
c0check.cabal view
@@ -1,10 +1,10 @@ Name: c0check-Version: 0.1+Version: 0.2 Synopsis: Simple C0 Syntax Check Description: The package contains a progam to check if your C-Program is valid C0. - The C0-language is introduced in the basic programming course \"Algorithmisches Denken und imperative Programmierung\" (WS 2011/12 and later) at the University of Bonn.+ The C0-language is introduced in the basic programming course \"Algorithmisches Denken und imperative Programmierung\" (WS 2012/13 and later) at the University of Bonn. The program contained in the package will take a C source code file and test the content if it is conform to the C0-language specifications. - The answer is simply yes or no.+ If not it points to the non-conformant code part. License: GPL Author: Daniel Seidel Maintainer: ds@iai.uni-bonn.de@@ -16,4 +16,4 @@ Executable c0check Main-is: src/c0check.hs Build-Depends: base >= 3 && < 6,- c0parser+ c0parser >= 0.2
src/c0check.hs view
@@ -1,16 +1,16 @@ module Main where import System.Environment (getArgs)-import Language.C0.Parser.C0Parser (yesNo)+import Language.C0.Parser.C0Parser (parseProg) checkFile fn = do input <- readFile fn putStr "Folgendes Programm wurde gelesen:\n\n" putStr input putStr "\n\n"- case yesNo input of- True -> putStr "Ihr Programm ist syntaktisch korrektes C0."- False -> putStr "Das getestete Programm ist *kein* C0-Programm."+ case parseProg input of+ Left err -> error (show err)+ Right _ -> putStr "Ihr Programm ist syntaktisch korrektes C0." putStr "\n\n"