File:Algol grammar expr.pdf
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this JPG preview of this PDF file: 800 × 455 pixels. Other resolutions: 320 × 182 pixels | 640 × 364 pixels | 1,297 × 737 pixels.
Original file (1,297 × 737 pixels, file size: 28 KB, MIME type: application/pdf)
File information
Structured data
Captions
Summary
[edit]DescriptionAlgol grammar expr.pdf |
English: Shows a simplified excerpt of the formal grammar for the Algol60 programming language (left), and a derivation of a piece of Algol60 code (right, " (a+b)^2/2 ") from the nonterminal symbol . In the derivation, each line is obtained from the previous one by application of a grammar rule. For the original grammar, see Sect.3.3.1 "Arithmetic expressions" in the Algol60 Report. |
Date | |
Source | Own work |
Author | Jochen Burghardt |
Other versions | File:Algol grammar expr.pdf * File:Algol grammar expr svg.svg * File:C grammar stmt.pdf * File:C grammar stmt svg.svg |
LaTeX source code
|
---|
\documentclass[12pt]{article}
\setlength{\unitlength}{1mm}
\usepackage[pdftex]{color}
\usepackage{amssymb}
\usepackage[paperwidth=220mm,paperheight=125mm]{geometry}
\setlength{\topmargin}{-36mm}
\setlength{\textwidth}{220mm}
\setlength{\textheight}{125mm}
\setlength{\oddsidemargin}{-23mm}
\setlength{\parindent}{0cm}
\pagestyle{empty}
\definecolor{cNontermNew} {rgb}{0.00,0.00,0.75}
\definecolor{cNontermRep} {rgb}{0.75,0.75,0.99}
\definecolor{cTermNew} {rgb}{0.75,0.00,0.00}
\definecolor{cTermRep} {rgb}{0.99,0.75,0.75}
\definecolor{cGrmBg} {rgb}{0.95,0.95,0.95}
\newcommand{\NT}[1]{\textcolor{cNontermNew}{$\langle$#1$\rangle$}}
\newcommand{\nt}[1]{\textcolor{cNontermRep}{$\langle$#1$\rangle$}}
\newcommand{\TM}[1]{\textcolor{cTermNew}{\texttt{#1}}}
\newcommand{\tm}[1]{\textcolor{cTermRep}{\texttt{#1}}}
\begin{document}
\setlength{\tabcolsep}{0.8mm}
\newcommand{\1}{} \newcommand{\2}[1]{\cline{#1}}
\newcommand{\9}{\^}
\begin{picture}(0,0)%
\textcolor{cGrmBg}{\put(0,0){\makebox(0,0)[bl]{\rule{73.5mm}{93.7mm}}}}%
\end{picture}%
\begin{tabular}[b]{|rcl|}
\hline
\NT{Expr} & $\rightarrow$ & \NT{Term} \\
\NT{Expr} & $\rightarrow$ & \NT{AddOp} \NT{Term} \\
\NT{Expr} & $\rightarrow$ & \NT{Expr} \NT{AddOp} \NT{Term} \\
\NT{Term} & $\rightarrow$ & \NT{Factor} \\
\NT{Term} & $\rightarrow$ & \NT{Term} \NT{MulOp} \NT{Factor} \\
\NT{Factor} & $\rightarrow$ & \NT{Primary} \\
\NT{Factor} & $\rightarrow$ & \NT{Factor} \TM{\9} \NT{Primary} \\
\NT{Primary} & $\rightarrow$ & \NT{Number} \\
\NT{Primary} & $\rightarrow$ & \NT{Variable} \\
\NT{Primary} & $\rightarrow$ & \TM{(} \NT{Expr} \TM{)} \\
\NT{AddOp} & $\rightarrow$ & \TM{+} \\
\NT{AddOp} & $\rightarrow$ & \TM{-} \\
\NT{MulOp} & $\rightarrow$ & \TM{*} \\
\NT{MulOp} & $\rightarrow$ & \TM{/} \\
\NT{Variable} & $\rightarrow$ & \TM{a} \\
\NT{Variable} & $\rightarrow$ & \TM{b} \\
\NT{Number} & $\rightarrow$ & \TM{2} \\
& $\vdots$ & \\
\hline
\end{tabular}
$\;\;\;\;\;\;\;\;\;$
\begin{tabular}[b]{\1c*{8}{c\1}}
%\hline
\multicolumn{9}{\1c\1}{\NT{Expr}} \\
\2{1-9}
\multicolumn{9}{\1c\1}{\NT{Term}} \\
\2{1-9}
\multicolumn{7}{\1c\1}{\NT{Term}} & \NT{MulOp} & \NT{Factor} \\
\2{1-7}
\multicolumn{7}{\1c\1}{\NT{Factor}} & \nt{MulOp} & \nt{Factor} \\
\2{1-7}
\multicolumn{5}{\1c\1}{\NT{Factor}} & \TM{\9} & \NT{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{1-5}
\multicolumn{5}{\1c\1}{\NT{Primary}} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{1-5}
\TM{(} & \multicolumn{3}{\1c\1}{\NT{Expr}} & \TM{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{2-4}
\tm{(} & \NT{Expr} & \NT{AddOp} & \NT{Term} & \tm{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{2-2}
\tm{(} & \NT{Term} & \nt{AddOp} & \nt{Term} & \tm{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{2-2}
\tm{(} & \NT{Factor} & \nt{AddOp} & \nt{Term} & \tm{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{2-2}
\tm{(} & \NT{Primary} & \nt{AddOp} & \nt{Term} & \tm{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{2-2}
\tm{(} & \NT{Variable}& \nt{AddOp} & \nt{Term} & \tm{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{2-2}
\tm{(} & \TM{a} & \NT{AddOp} & \nt{Term} & \tm{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{3-3}
\tm{(} & \tm{a} & \TM{+} & \NT{Term} & \tm{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{4-4}
\tm{(} & \tm{a} & \tm{+} & \NT{Factor} & \tm{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{4-4}
\tm{(} & \tm{a} & \tm{+} & \NT{Primary} & \tm{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{4-4}
\tm{(} & \tm{a} & \tm{+} & \NT{Variable}& \tm{)} & \tm{\9} & \nt{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{4-4}
\tm{(} & \tm{a} & \tm{+} & \TM{b} & \tm{)} & \tm{\9} & \NT{Primary} & \nt{MulOp} & \nt{Factor} \\
\2{7-7}
\tm{(} & \tm{a} & \tm{+} & \tm{b} & \tm{)} & \tm{\9} & \NT{Number} & \nt{MulOp} & \nt{Factor} \\
\2{7-7}
\tm{(} & \tm{a} & \tm{+} & \tm{b} & \tm{)} & \tm{\9} & \TM{2} & \NT{MulOp} & \nt{Factor} \\
\2{8-8}
\tm{(} & \tm{a} & \tm{+} & \tm{b} & \tm{)} & \tm{\9} & \tm{2} & \TM{/} & \NT{Factor} \\
\2{9-9}
\tm{(} & \tm{a} & \tm{+} & \tm{b} & \tm{)} & \tm{\9} & \tm{2} & \tm{/} & \NT{Primary} \\
\2{9-9}
\tm{(} & \tm{a} & \tm{+} & \tm{b} & \tm{)} & \tm{\9} & \tm{2} & \tm{/} & \NT{Number} \\
\2{9-9}
\TM{(} & \TM{a} & \TM{+} & \TM{b} & \TM{)} & \TM{\9} & \TM{2} & \TM{/} & \TM{2} \\
\end{tabular}
\end{document}
|
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International 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.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 20:21, 23 August 2023 | 1,297 × 737 (28 KB) | Jochen Burghardt (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Software used | TeX |
---|---|
Conversion program | pdfTeX-1.40.22 |
Encrypted | no |
Page size | 623.622 x 354.331 pts |
Version of PDF format | 1.5 |