background preloader

CFDG: Context Free Design Grammar

Facebook Twitter

Context Free Art. Background directive - Context Free Art. From Context Free Art The shapes rendered by Context Free/CFDG are drawn on a canvas that starts out with a background color.

Background directive - Context Free Art

The default color is opaque white, but this can be changed using a background directive. A background directive is a line in the CFDG file that starts with the word 'background' that is followed by set of color adjustments in curly braces. The adjustments are relative to the default background color of opaque white (hue = 0, saturation = 0, brightness = 1, alpha = 1). If there are more than one background directive then only the first is used. Here are some useful background directives: Cfdg: Art, Design & Photography. CFDG: Context-Free Design Grammar. CFDG: Syntax. Context Free Art – Tutorial 1 » Magic & Love Interactive. After we can create different primitive shapes, we start to combine them together.

Context Free Art – Tutorial 1 » Magic & Love Interactive

We cannot simply put all the primitive shapes within one single shape rule, like: startshape MyShape rule MyShape { CIRCLE {} TRIANGLE {} SQUARE {} } Multiple shapes Every shape command comes with parameters. We work with the translation parameters x and y to move the shape around in the canvas. startshape MyShape rule MyShape { CIRCLE {x -2} TRIANGLE {} SQUARE {x 2} } startshape MyShape rule MyShape { CIRCLE {y 2} TRIANGLE {} SQUARE {y -2} } startshape MyShape rule MyShape { CIRCLE {x 2 y 2 size 0.8} TRIANGLE {size 2} SQUARE {x -2 y -2 size 0.5} } Size variation.


Kontextfreie Sprache. In der Theoretischen Informatik ist eine kontextfreie Sprache (englisch context-free language, CFL) eine formale Sprache, die durch eine kontextfreie Grammatik beschrieben werden kann.

Kontextfreie Sprache

Eine kontextfreie Grammatik erlaubt einen definierten Leseprozess (Interpretation) von Ausdrücken einer formalen Sprache. Dabei kann zum einen entschieden werden, ob ein Ausdruck den Regeln der Grammatik entspricht, und zum anderen im Verlauf der Analyse ein Syntaxbaum erstellt werden. Ein Programm, das dies leistet, heißt Parser. Parser werden insbesondere zur Verarbeitung von Programmiersprachen verwendet. Auch in der Computerlinguistik versucht man, natürliche Sprachen durch Regeln kontextfreier Grammatiken zu beschreiben. Context free. Context-free language. In formal language theory, a context-free language (CFL) is a language generated by some context-free grammar (CFG).

Context-free language

Different CF grammars can generate the same CF language, or conversely, a given CF language can be generated by different CF grammars. It is important to distinguish properties of the language (intrinsic properties) from properties of a particular grammar (extrinsic properties). The set of all context-free languages is identical to the set of languages accepted by pushdown automata, which makes these languages amenable to parsing. Indeed, given a CFG, there is a direct way to produce a pushdown automaton for the grammar (and corresponding language), though going the other way (producing a grammar given an automaton) is not as direct. Context-free languages have many applications in programming languages; for example, the language of all properly matched parentheses is generated by the grammar .

Examples[edit] An archetypical context-free language is 's. where with . Context-free grammar. V → w where V is a single nonterminal symbol, and w is a string of terminals and/or nonterminals (w can be empty).

Context-free grammar

A formal grammar is considered "context free" when its production rules can be applied regardless of the context of a nonterminal. No matter which symbols surround it, the single nonterminal on the left hand side can always be replaced by the right hand side. Context-free grammars arise in linguistics where they are used to describe the structure of sentences and words in natural language, and they were in fact invented by the Linguist Noam Chomsky for this purpose, but have not really lived up to their original expectation. By contrast, in computer science, as the use of recursively defined concepts increased, they were used more and more. In linguistics, some authors use the term phrase structure grammar to refer to context-free grammars, whereby phrase structure grammars are distinct from dependency grammars. Background[edit] can be logically parenthesized as follows: where.