File:Example derivation tree of a term from a regular tree grammar.pdf

Summary

Description
English: Shows the derivation tree for an example term and a regular tree grammar given in en:Regular tree grammar#Examples.
Date
Source Own work
Author Jochen Burghardt
Other versions

2-dimensional: File:Example derivation of a term from a regular tree grammar.pdf File:Example derivation of a term from a regular tree grammar svg.svg,

3-dimensional: File:Example derivation tree of a term from a regular tree grammar.pdf File:Example derivation tree of a term from a regular tree grammar svg.svg
LaTeX source code
\documentclass[12pt]{article}
\usepackage[pdftex]{color}
\usepackage[paperwidth=225mm,paperheight=115mm]{geometry}
\setlength{\topmargin}{-36mm}
\setlength{\textwidth}{30cm}
\setlength{\textheight}{26cm}
\setlength{\evensidemargin}{-2.7cm}
\setlength{\oddsidemargin}{-2.5cm}
\setlength{\parindent}{0cm}
\setlength{\parskip}{1ex}
\setlength{\unitlength}{1mm}
\sloppy

\begin{document}

% foreground
\definecolor{fN}        {rgb}{0.99,0.00,0.00}   % nonterminal
\definecolor{fT}        {rgb}{0.00,0.00,0.99}   % terminal
\definecolor{fB}        {rgb}{0.00,0.00,0.99}   % branch line
\definecolor{fb}        {rgb}{0.60,0.60,0.99}   % shadow branch line
\definecolor{ft}        {rgb}{0.60,0.60,0.99}   % shadow terminal
\definecolor{fD}        {rgb}{0.40,0.40,0.40}   % derivation line
\definecolor{fd}        {rgb}{0.85,0.85,0.85}   % shadow derivation line
\definecolor{fE}        {rgb}{0.99,0.40,0.40}   % redex derivation line
\definecolor{fe}        {rgb}{0.99,0.85,0.85}   % shadow redex deriv line

% background
\definecolor{bT}        {rgb}{0.50,0.50,0.50}   % term border
\definecolor{bt}        {rgb}{0.90,0.90,0.90}   % term interior
\definecolor{bu}        {rgb}{0.95,0.95,0.95}   % shadow term interior
\definecolor{bR}        {rgb}{0.99,0.50,0.50}   % redex border
\definecolor{br}        {rgb}{0.95,0.90,0.90}   % redex interior

~
\begin{picture}(220,110)

\thicklines%
% backgrounds
% 4
\textcolor{bu}{\multiput(30.000,50)(0.1,-0.1){100}{\line(-1,-1){20.000}}}%
\textcolor{bu}{\multiput(40.000,40)(0.1,-0.1){100}{\line(-1,-1){10.000}}}%
\textcolor{bu}{\multiput(40.000,20)(-0.1,0.1){100}{\line(1,0){20.000}}}%
\textcolor{bu}{\multiput(0.000,20)(0.1,0.0){400}{\line(1,1){10.000}}}%
\textcolor{bu}{\multiput(50,30)(0.1,-0.1){100}{\line(-1,-1){20}}}%
\textcolor{bu}{\multiput(60,20)(0.1,-0.1){100}{\line(-1,-1){10}}}%
\textcolor{bu}{\multiput(60,0)(-0.1,0.1){100}{\line(1,0){20}}}%
\textcolor{bu}{\multiput(20,0)(0.1,0){400}{\line(1,1){10}}}%
% 3
\textcolor{bu}{\multiput(90,70)(0.100,-0.100){100}{\line(-1,-1){20.000}}}%
\textcolor{bu}{\multiput(100,60)(0.100,-0.100){100}{\line(-1,-1){10.000}}}%
\textcolor{bu}{\multiput(100,40)(-0.100,0.100){100}{\line(1,0){20.000}}}%
\textcolor{bu}{\multiput(60,40)(0.100,0.000){400}{\line(1,1){10.000}}}%
\textcolor{bt}{\multiput(110,50)(0.100,-0.100){100}{\line(-1,-1){20.000}}}%
\textcolor{bt}{\multiput(120,40)(0.100,-0.100){100}{\line(-1,-1){10.000}}}%
\textcolor{bt}{\multiput(120,20)(-0.100,0.100){100}{\line(1,0){20.000}}}%
\textcolor{bt}{\multiput(80,20)(0.100,0.000){400}{\line(1,1){10.000}}}%
% 2
\textcolor{bt}{\multiput(120,60)(0.1,0){400}{\line(1,1){10}}}%
\textcolor{bt}{\multiput(150,90)(-0.1,-0.1){100}{\line(1,-1){20}}}%
\textcolor{bt}{\multiput(140,80)(-0.1,-0.1){100}{\line(1,-1){10}}}%
\textcolor{br}{\multiput(160,60)(0.1,0){100}{\line(1,1){5}}}%
\textcolor{br}{\multiput(170,70)(-0.1,-0.1){50}{\line(1,-1){5}}}%
\textcolor{br}{\multiput(180,60)(-0.1,0){100}{\line(-1,1){5}}}%
% 1
\textcolor{br}{\multiput(200,100)(0.1,0){100}{\line(1,1){5}}}%
\textcolor{br}{\multiput(210,110)(-0.1,-0.1){50}{\line(1,-1){5}}}%
\textcolor{br}{\multiput(220,100)(-0.1,0){100}{\line(-1,1){5}}}%

\thinlines%
% hidden derivation lines
\textcolor{fe}{\put(170.000,70.000){\line(-3,-1){60.000}}}%
\textcolor{fd}{\put(110.000,50.000){\line(-3,-1){60.000}}}%

\thicklines%
% terms
% 4
\textcolor{ft}{\put(30.000,41.000){\makebox(0.000,0.000)[b]{cons}}}%
\textcolor{fb}{\put(30.000,40.000){\vector(-1,-1){15.000}}}%
\textcolor{fb}{\put(30.000,40.000){\vector(1,-1){15.000}}}%
\textcolor{ft}{\put(10.000,21.000){\makebox(0.000,0.000)[b]{false}}}%
\textcolor{ft}{\put(50.000,21.000){\makebox(0.000,0.000)[b]{cons}}}%
\textcolor{fb}{\put(50.000,20.000){\vector(-1,-1){15.000}}}%
\textcolor{fb}{\put(50.000,20.000){\vector(1,-1){15.000}}}%
\textcolor{fT}{\put(30.000,1.000){\makebox(0.000,0.000)[b]{true}}}%
\textcolor{fT}{\put(70.000,1.000){\makebox(0.000,0.000)[b]{nil}}}%
% 3
\textcolor{ft}{\put(90.000,61.000){\makebox(0.000,0.000)[b]{cons}}}%
\textcolor{fb}{\put(90.000,60.000){\vector(-1,-1){15.000}}}%
\textcolor{fb}{\put(90.000,60.000){\vector(1,-1){15.000}}}%
\textcolor{fT}{\put(70.000,41.000){\makebox(0.000,0.000)[b]{false}}}%
\textcolor{fT}{\put(110.000,41.000){\makebox(0.000,0.000)[b]{cons}}}%
\textcolor{fB}{\put(110.000,40.000){\vector(-1,-1){15.000}}}%
\textcolor{fB}{\put(110.000,40.000){\vector(1,-1){15.000}}}%
\textcolor{fN}{\put(90.000,21.000){\makebox(0.000,0.000)[b]{Bool}}}%
\textcolor{fN}{\put(130.000,21.000){\makebox(0.000,0.000)[b]{BList}}}%
% 2
\textcolor{fT}{\put(150.000,81.000){\makebox(0.000,0.000)[b]{cons}}}%
\textcolor{fB}{\put(150.000,80.000){\vector(-1,-1){15.000}}}%
\textcolor{fB}{\put(150.000,80.000){\vector(1,-1){15.000}}}%
\textcolor{fN}{\put(130.000,61.000){\makebox(0.000,0.000)[b]{Bool}}}%
\textcolor{fN}{\put(170.000,61.000){\makebox(0.000,0.000)[b]{BList}}}%
% 1
\textcolor{fN}{\put(210.000,101.000){\makebox(0.000,0.000)[b]{BList}}}%

\thinlines
% visible derivation lines
\textcolor{fE}{\put(210.000,110.000){\line(-3,-1){60.000}}}%
\textcolor{fD}{\put(150.000,90.000){\line(-3,-1){120.000}}}%
\textcolor{fE}{\put(200.000,100.000){\line(-2,-1){80.000}}}%
\textcolor{fE}{\put(220.000,100.000){\line(-1,-1){80.000}}}%
\textcolor{fE}{\put(160.000,60.000){\line(-2,-1){80.000}}}%
\textcolor{fD}{\put(120.000,60.000){\line(-3,-1){120.000}}}%
\textcolor{fD}{\put(80.000,20.000){\line(-3,-1){60.000}}}%
\textcolor{fD}{\put(140.000,20.000){\line(-3,-1){60.000}}}%
\textcolor{fE}{\put(160.000,60.000){\line(-3,-1){60.000}}}%
\textcolor{fD}{\put(100.000,40.000){\line(-3,-1){60.000}}}%

\thinlines%
% borders
% 4
\textcolor{bT}{\put(30.000,50.000){\line(1,-1){50.000}}}%
\textcolor{bT}{\put(30.000,50.000){\line(-1,-1){30.000}}}%
\textcolor{bT}{\put(0.000,20.000){\line(1,0){40.000}}}%
\textcolor{bT}{\put(20.000,0.000){\line(1,0){60.000}}}%
\textcolor{bT}{\put(40.000,20.000){\line(-1,-1){20.000}}}%
% 3
\textcolor{bT}{\put(90,70){\line(1,-1){50}}}%
\textcolor{bT}{\put(90,70){\line(-1,-1){30}}}%
\textcolor{bT}{\put(60,40){\line(1,0){40}}}%
\textcolor{bT}{\put(80,20){\line(1,0){60}}}%
\textcolor{bT}{\put(100,40){\line(-1,-1){20}}}%
% 2
\textcolor{bT}{\put(150,90){\line(1,-1){20}}}%
\textcolor{bR}{\put(170,70){\line(1,-1){10}}}%
\textcolor{bT}{\put(150,90){\line(-1,-1){30}}}%
\textcolor{bT}{\put(120,60){\line(1,0){40}}}%
\textcolor{bR}{\put(160,60){\line(1,0){20}}}%
% 1
\textcolor{bR}{\put(210.000,110.000){\line(1,-1){10.000}}}%
\textcolor{bR}{\put(210.000,110.000){\line(-1,-1){10.000}}}%
\textcolor{bR}{\put(200.000,100.000){\line(1,0){20.000}}}%

% derivation tree wrt. word grammar
\put(0,110){\makebox(0,0)[tl]{\footnotesize%
        \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|}%
        \hline%
        \multicolumn{11}{|c|}{\textcolor{fN}{Blist}}    \\[2mm]%
        \textcolor{fT}{cons}%
                & \textcolor{fD}{(}%
                & \textcolor{fN}{Bool}%
                & \textcolor{fD}{,}%
                & \multicolumn{6}{|c|}{\textcolor{fN}{Blist}}%
                & \textcolor{fD}{)}     \\[2mm]%
        \textcolor{ft}{cons}%
                & \textcolor{fd}{(}%
                & \textcolor{fT}{false}%
                & \textcolor{fd}{,}%
                & \textcolor{fT}{cons}%
                & \textcolor{fD}{(}%
                & \textcolor{fN}{Bool}%
                & \textcolor{fD}{,}%
                & \textcolor{fN}{Blist}%
                & \textcolor{fD}{)}%
                & \textcolor{fd}{)}     \\[2mm]%
        \textcolor{ft}{cons}%
                & \textcolor{fd}{(}%
                & \textcolor{ft}{false}%
                & \textcolor{fd}{,}%
                & \textcolor{ft}{cons}%
                & \textcolor{fd}{(}%
                & \textcolor{fT}{true}%
                & \textcolor{fd}{,}%
                & \textcolor{fT}{nil}%
                & \textcolor{fd}{)}%
                & \textcolor{fd}{)}     \\%
        \hline%
        \end{tabular}%
        }}%

\end{picture}

\end{document}

Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-3.0#Example%20derivation%20tree%20of%20a%20term%20from%20a%20regular%20tree%20grammar.pdf
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
Category:License migration redundant#Example%20derivation%20tree%20of%20a%20term%20from%20a%20regular%20tree%20grammar.pdfCategory:GFDL#Example%20derivation%20tree%20of%20a%20term%20from%20a%20regular%20tree%20grammar.pdf
You may select the license of your choice.
Category:Self-published work Category:Formal languages Category:Tree structures Category:Files by User:Jochen Burghardt Category:Images with LaTeX source code
Category:CC-BY-SA-3.0 Category:Files by User:Jochen Burghardt Category:Formal languages Category:GFDL Category:Images with LaTeX source code Category:License migration redundant Category:Pages using deprecated source tags Category:Self-published work Category:Tree structures