Content deleted Content added
→Comments: better title |
m compound modifier |
||
(31 intermediate revisions by 22 users not shown) | |||
Line 1:
{{Short description|Functional programming language}}
[[Image:HumeStatue-Edinburgh2006.gif|thumb|Hume Statue in Edinburgh]]▼
{{Use dmy dates|date=June 2023}}
'''Hume''' is a functionally based programming language developed at the [[University of St Andrews]] and [[Heriot-Watt University]] in [[Scotland]] since the year 2000. The language name is both an acronym meaning 'Higher-order Unified Meta-Environment' and an honorific to the 18th Century philosopher [[David Hume]]. It targets [[real-time computing|real-time]] [[embedded systems]], aiming to produce a design that is both highly abstract, yet which will still allow precise extraction of time and space execution costs. This allows programmers to guarantee the bounded time and space demands of executing programs.▼
{{Use British English|date=June 2023}}
{{More citations needed|date=April 2022}}
{{Infobox programming language
| name = Hume
| logo = <!-- Filename only -->
| logo caption =
| screenshot = <!-- Filename only -->
| screenshot caption =
| sampleCode =
| paradigm = [[Functional programming|Functional]]
| family = [[Haskell]]
| designer = Greg Michaelson<br/>Andrew Ireland<br/>Andy Wallace
| developers = [[University of St Andrews]]<br/>[[Heriot-Watt University]]
| released = {{Start date and age|2000}}
| latest release version = 0.8
| latest release date = {{Start date and age|2008|04|25|df=yes}}
| typing = [[Type inference|Inferred]], [[Static typing|static]], [[Strong and weak typing|strong]]
| scope =
| programming language =
| platform = [[IA-32]], [[PowerPC]]
| operating system = [[macOS]], [[Red Hat]] [[Linux]]
| license =
| file ext =
| file format = <!-- or: | file formats = -->
| website = <!-- {{URL|www.example.com}} -->
| implementations =
| dialects =
| influenced by = [[Haskell]]
| influenced =
}}
▲'''Hume''' is a functionally based programming language developed at the [[University of St Andrews]] and [[Heriot-Watt University]] in [[Scotland]] since the year 2000. The language name is both an acronym meaning 'Higher-order Unified Meta-Environment' and an honorific to the 18th
Hume is unusual in combining [[functional programming]] ideas with ideas from [[finite state automata]]. Automata are used to structure communicating programs into a series of "boxes", where each box maps inputs to outputs in a [[purely functional]] way using high-level pattern-matching. It is also unusual in being structured as a series of levels, each of which exposes different▼
▲Hume
== The Hume Design Model ==▼
The Hume language design attempts to maintain the essential properties and features required by the embedded systems ___domain (especially for transparent time and space costing) whilst incorporating as high a level of program abstraction as possible. It aims to target applications ranging from simple
Hume is a three-layer language: an outer (static) declaration/[[metaprogramming]] layer, an intermediate coordination layer describing a static layout of dynamic processes and the associated devices, and an inner layer describing each process as a (dynamic) mapping from patterns to expressions. The inner layer is stateless and purely functional.
Rather than attempting to apply cost modeling and correctness proving technology to an existing language framework either directly or by altering a more general language (as with e.g., [[RTSJ]]), the approach taken by the Hume designers is to design Hume in such a way that formal models and proofs can definitely be constructed. Hume is structured as a series of overlapping language levels, where each level adds expressibility to the expression semantics, but either loses some desirable property or increases the technical difficulty of providing formal correctness/cost models.<ref>{{Cite book |last=Eekelen |first=Marko Van |date=2007 |url=https://books.google.com/books?id=p0yV1sHLubcC |title=Trends in Functional Programming |publisher=Intellect Books |isbn=978-1-84150-176-5 |pages=198 |language=en}}</ref>
== Characteristics ==
The interpreter and compiler versions differ a bit.
* the interpreter (concept prover) admits timeout and custom exceptions.
Line 22 ⟶ 51:
The coordination system wires ''boxes'' in a [[dataflow programming]] style.
The expression language is [[
The
There is a scheduler built-in that continuously checks pattern-matching through all boxes in turn, putting on hold the boxes that cannot copy outputs to busy input destinations.
== Examples ==
=== Vending machine ===
▲<source lang="haskell">
data Coins = Nickel | Dime | Fake;
data Drinks = Coffee | Tea;
Line 40 ⟶ 67:
exception EFakeCoin :: (Int, string) ;
show v = v as string ;
box coffee
in ( coin :: Coins, button :: Buttons, value :: Int ) -- input channels
out ( drink_outp ::
, refund_outp ::
within 500KB (400B) -- max heap
handles EFakeCoin, TimeOut, HeapOverflow, StackOverflow
match
-- * wildcards for unfilled outputs, and unconsumed inputs
(
-> let v’ =
in ( *, v’, *, show v’)
-- time bounding (''within
| ( *, BCoffee, v) {-
-> (vend Coffee 10 v) within 30s
| ( *, BTea, v) -> (vend Tea 5 v) within 30s
| ( *, BCancel, v) -> let refund u = "Refund " ++ show u ++ "\n"
Line 81 ⟶ 112:
serve drink = case drink of
Coffee -> "
Tea -> "Tea\n"
;
Line 103 ⟶ 134:
-- dataflow
wire
-- inputs (channel origins)
(control.coin, control.button, coffee.value’ initially 0) --
Line 114 ⟶ 145:
(coffee.coin, coffee.button)
;
</syntaxhighlight>
==References==
{{Reflist}}
==Further reading==
*{{cite web |first1=Gergely |last1=Patai |first2=Peter |last2=Hanak |year=2007 |title=Embedded Functional Programming in Hume |url=http://sgate.emt.bme.hu/documents/patai/publications/PataiHanakSE2007.pdf |archive-url=https://web.archive.org/web/20161223080800/http://sgate.emt.bme.hu/documents/patai/publications/PataiHanakSE2007.pdf |archive-date=2016-12-23}}
== External links ==
* [https://web.archive.org/web/20120722084226/http://www-fp.cs.st-andrews.ac.uk/hume/index.shtml The Hume Programming Language web site]
* [http://www.macs.hw.ac.uk/~greg/hume/ The Hume Project at Heriot-Watt University]
* [
▲* [http://www.embounded.org/ The EmBounded project] Project to certify resource-bounded code in Hume.
▲* [http://glew.org/damp2006/Hume-Multicore.ppt Hume and Multicore]
{{Haskell programming}}
[[Category:Haskell programming language family]]
Line 127 ⟶ 165:
[[Category:Systems programming languages]]
[[Category:Embedded systems]]
[[Category:Articles with example code]]
|