Category:Bracmat: Difference between revisions
Update inspired by term definitions found in Progopedia
(Added info to the right box) |
(Update inspired by term definitions found in Progopedia) |
||
(One intermediate revision by the same user not shown) | |||
Line 3:
|gc=yes
|programming paradigm=declarative
|programming paradigm=functional
|programming paradigm=reflective
|parampass=value
Line 8 ⟶ 9:
|compat=duck
|express=implicit
|strength=
|tags=bracmat
}}
Bracmat is an interpreted programming language
Bracmat is inspired by [[SNOBOL4]] (pattern matching, success/failure), by [[Lisp]] (lists and atoms), by [[Prolog]] (declarative programming, especially backtracking) and a little bit by [[object-oriented]] languages.
Bracmat's strength is [[pattern matching]], in strings as well as in tree structures.▼
Both Bracmat and Lisp have expressions consisting of atoms and binary nodes.
Bracmat is inspired by [[SNOBOL4]] (pattern matching, success/failure), by [[Lisp]] (Bracmat programs are made of the same stuff as Bracmat data), by [[Prolog]] (backtracking) and a little bit by [[object-oriented]] languages. The first implementation was for an ARM based computer. The ARM processor's 4-bit condition code selector on every instruction were the inspiration for Bracmat's flags ~ [ ! !! ` @ % > < # / ? that can be set on any node in an expression. For example, the ! and ? flags turn a symbol into a variable. When flags are combined, care has been taken that the semantics of a combination of flags is close to a combination of the semantics of each flag. ▼
Whereas a Lisp's binary nodes are all of the same type, Bracmat has about 15 different binary nodes, each with a different behaviour, such as addition, multiplication, symbolic differentiation, branching, pattern matching, assignment, function evaluation, and more.
The Bracmat-interpreter is written in Standard [[C]] and can be compiled for many platforms, such as Epoc, [[Windows]], [[Mac OS]], [[Linux]] and [[Unix]]. The compiled code measures about 130 KB (statically linked), depending on the platform. The runtime is not very memory hungry, as compared to e.g. [[Java]].▼
Bracmat has a very powerful language construct for pattern matching, combining
▲
* associative [[pattern matching]], and
* expression evaluation during a match operation.
The only other programming language supporting this combination of pattern matching features is [[Egison]], as far as I currently know (2021).
The pattern matching language construct can be used where you otherwise would use SQL, regexp, XSLT, LINQ, and the much less powerful pattern matching seen in functional languages. Bracmat has been used to validate or transform gigabytes of XML and HTML data.
Bracmat is a homoiconic language: program code is data and data is program code. It is also reflective, which means that a Bracmat program can change its own behaviour, for example by evolving a match pattern based on observations of actual data.
▲
▲The Bracmat-interpreter is written in Standard [[C]] and can be compiled for many platforms, such as Epoc, [[Windows]], [[Mac OS]] (including OS X), [[Linux]] and [[Unix]]. The compiled code measures about 130 KB (statically linked), depending on the platform. The runtime is not very memory hungry, as compared to e.g. [[Java]]. Bracmat can be compiled for 32 and 64 bit systems.
|