Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Archive-of-Formal-Proofs/thys/Hello_World/   (Sammlung formaler Beweise Version 2026-5©)  Datei vom 31.4.2026 mit Größe 1 kB image not shown  

Quelle  HelloWorld.thy

  Sprache: Isabelle
 

theory HelloWorld
  imports IO
begin

sectionHello, World!

text
 The idea of a termmain :: unit io function is that, upon start of your program, you will be
 handed a value of type 🍋🪙. You can pass this world through your code and modify it.
 Be careful with the 🍋🪙, it's the only one we have.
 



textThe main function, defined in Isabelle. It should have the right type in Haskell.
definition main :: "unit io" where
  "main do {
               _ println (STR ''Hello World! What is your name?'');
               name getLine;
               println (STR ''Hello, '' + name + STR ''!'')
             }"


sectionGenerating Code

textChecking that the generated code compiles.

export_code main checking Haskell? SML

(*<*)
setup 
 
 val parser =
 Scan.repeat (Args.const {proper = true, strict = true}) --
 Scan.lift (🍋in |-- Parse.name -- (🍋module_name |-- Parse.name))

 fun action ctxt (consts, (target, module)) =
 Code_Target.produce_code ctxt false consts target module NONE []
 |> fst
 |> map (Bytes.content o snd) |> String.concatWith "\n"
 
 Document_Output.antiquotation_verbatim @{binding code} parser action
 

(*>*)

subsectionHaskell

textThe generated code in Haskell (including the prelude) is shown below.

text_raw@{code main in Haskell module_name HelloWorld}

subsectionSML

textThe generated code in SML (including the prelude) is shown below.

text_raw@{code main in SML module_name HelloWorld}

end

Messung V0.5 in Prozent
C=83 H=96 G=89

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.