Bracmat
Bracmat is an interpreted programming language for symbolic computation. Originally (in the eighties) it was designed as a Computer Algebra system, but it has shown its merits in natural language processing as well. Bracmat has been used in the field of General Relativity for the algebraic computation of Ricci tensors from given space-time metrics, for the implementation of a dialogue-manager in virtual world project that allowed a user to communicate with software agents in plain English and with gestures, for the analysis of texts in a "Controlled Language"-project and for automatic error correction of hundreds of HTML pages. Bracmat has also shown its utility in some real-world applications: for example to identify persons, companies etc. in pre-tagged texts that must be anonymised. The to date most advanced application of Bracmat is as workflow planner and executor. Instead of letting the user choose between software tools, which the user may not know very well, the planner asks the user to specify what kind of output she wants. With this information the planner computes all (not necessarily sequential) combinations of tools and their parameter settings that combine into workflows that are guaranteed to produce the specified output from the given input. The computed list is condensed into a short format that highlights the differences between the workflows for the user and leaves out all that is of less importance.
Bracmat is almost unique in the combination of on the one hand allowing associative pattern matching, in strings as well as in tree structures, and on the other hand allowing expression evaluation during a match operation.
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.
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.
Tasks
- 100 doors
- 24 game
- A+B
- ABC Problem
- AKS test for primes
- Abundant, deficient and perfect number classifications
- Accumulator factory
- Ackermann function
- Add a variable to a class instance at runtime
- Anagrams
- Anagrams/Deranged anagrams
- Anonymous recursion
- Apply a callback to an array
- Arbitrary-precision integers (included)
- Arithmetic/Complex
- Arithmetic/Integer
- Array concatenation
- Arrays
- Associative array/Creation
- Associative array/Iteration
- Averages/Arithmetic mean
- Averages/Median
- Averages/Simple moving average
- Balanced brackets
- Bernoulli numbers
- Best shuffle
- Binary digits
- Boolean values
- CSV to HTML translation
- Call a function
- Call an object method
- Case-sensitivity of identifiers
- Catalan numbers
- Catamorphism
- Character codes
- Chinese remainder theorem
- Classes
- Closures/Value capture
- Combinations
- Combinations and permutations
- Combinations with repetitions
- Comma quibbling
- Command-line arguments
- Comments
- Compound data type
- Conditional structures
- Convert decimal number to rational
- Copy a string
- Count in octal
- Count occurrences of a substring
- Create a file
- Create an HTML table
- Day of the week
- Determine if a string is numeric
- Digital root
- Digital root/Multiplicative digital root
- Dinesman's multiple-dwelling problem
- Dot product
- Doubly-linked list/Element definition
- Dynamic variable names
- Empty program
- Empty string
- Enforced immutability
- Enumerations
- Ethiopian multiplication
- Evaluate binomial coefficients
- Even or odd
- Exceptions
- Execute a Markov algorithm
- Execute a system command
- Factorial
- Factors of a Mersenne number
- Fibonacci n-step number sequences
- Fibonacci sequence
- Filter
- Find limit of recursion
- First class environments
- First-class functions
- FizzBuzz
- Flatten a list
- Flow-control structures
- Floyd's triangle
- Fractran
- Function definition
- Generate lower case ASCII alphabet
- Generic swap
- Greatest common divisor
- Greatest element of a list
- Greatest subsequential sum
- Guess the number
- Hailstone sequence
- Hamming numbers
- Hash from two arrays
- Hash join
- Hello world!
- Hello world/Newline omission
- Hello world/Text
- Here document
- Hickerson series of almost integers
- Higher-order functions
- Hofstadter Q sequence
- Hofstadter-Conway $10,000 sequence
- Horner's rule for polynomial evaluation
- Huffman coding
- IBAN
- Include a file
- Increment a numerical string
- Input loop
- Integer comparison
- Integer overflow
- Integer sequence
- Interactive programming
- Inverted syntax
- JSON
- Jensen's Device
- Kaprekar numbers
- Knapsack problem/0-1
- Knapsack problem/Continuous
- Knapsack problem/Unbounded
- Knight's tour
- Largest int from concatenated ints
- Last letter-first letter
- Leap year
- Least common multiple
- Left factorials
- Letter frequency
- Levenshtein distance
- Linear congruential generator
- List comprehensions
- Literals/Integer
- Literals/String
- Logical operations
- Longest common subsequence
- Look-and-say sequence
- Loops/Continue
- Loops/Downward for
- Loops/For
- Loops/Foreach
- Loops/Infinite
- Loops/N plus one half
- Loops/While
- Lucas-Lehmer test
- Luhn test of credit card numbers
- Map range
- Maximum triangle path sum
- Memory allocation
- Middle three digits
- Miller–Rabin primality test
- Modular exponentiation
- Modular inverse
- Move-to-front algorithm
- Multiplication tables
- Multisplit
- Mutual recursion
- N-queens problem
- Named parameters
- Nested templated data
- Non-continuous subsequences
- Non-decimal radices/Convert
- Nth root
- Null object
- Odd word problem
- One-dimensional cellular automata
- Operator precedence
- Optional parameters
- Order disjoint list items
- Order two numerical lists
- Ordered words
- Palindrome detection
- Pangram checker
- Parse command-line arguments
- Parsing/RPN calculator algorithm
- Partial function application
- Pascal's triangle
- Pattern matching
- Perfect numbers
- Permutations
- Permutations/Derangements
- Phrase reversals
- Pi
- Power set
- Price fraction
- Primality by trial division
- Program termination
- Pythagorean triples
- Queue/Definition
- Queue/Usage
- Range expansion
- Range extraction
- Read a file line by line
- Read entire file
- Real constants and functions
- Regular expressions
- Remove duplicate elements
- Rename a file
- Rep-string
- Repeat a string
- Return multiple values
- Reverse a string
- Reverse words in a string
- Roman numerals/Decode
- Roman numerals/Encode
- Rosetta Code/Count examples
- Run-length encoding
- Runtime evaluation/In an environment
- Sailors, coconuts and a monkey problem
- Same Fringe
- Scope modifiers
- Search a list
- Self-referential sequence
- Semiprime
- Semordnilap
- Send an unknown method call
- Set consolidation
- Shell one-liner
- Short-circuit evaluation
- Sieve of Eratosthenes
- Simple database
- Singly-linked list/Element definition
- Solve a Hidato puzzle
- Solve a Holy Knight's tour
- Sort an array of composite structures
- Sort an integer array
- Sort disjoint sublist
- Sorting algorithms/Quicksort
- Special characters
- Special variables
- Stable marriage problem
- Stack
- State name puzzle
- String append
- String case
- String comparison
- String concatenation
- String interpolation (included)
- String length
- String matching
- String prepend
- Strip a set of characters from a string
- Strip comments from a string
- Strip control codes and extended characters from a string
- Strip whitespace from a string/Top and tail
- Substring
- Substring/Top and tail
- Subtractive generator
- Sudoku
- Sum and product of an array
- Sum of a series
- Sum of squares
- Symmetric difference
- Temperature conversion
- Terminal control/Clear the screen
- Terminal control/Display an extended character
- Terminal control/Ringing the terminal bell
- Text processing/Max licenses in use
- The Twelve Days of Christmas
- Time a function
- Tokenize a string
- Top rank per group
- Topological sort
- Tree traversal
- Truncatable primes
- Truncate a file
- Twelve statements
- URL decoding
- URL encoding
- Unicode strings
- Unicode variable names
- Vampire number
- Variable-length quantity
- Variables
- Word wrap
- Write entire file
- XML/DOM serialization
- XML/Input
- XML/Output
- XML/XPath
- Y combinator
- Zebra puzzle
- Zero to the zero power