ROSE Compiler Framework/Sandbox

From Wikibooks, open books for an open world
Jump to: navigation, search

Some common tricks to write things on wikibooks/wikipedia (both are using the mediawiki software).

How to create a new page[edit]

Usually you have to start a new page from an existing wikipage.

Go to the wiki page you want to have a link to the new page you want to create

  • click the edit tab the existing page
  • at the place you want to have a link to the new page, use
     [[ROSE_Compiler_Framework/name of the page]]
    
    .
  • If there is already a page with the desired name. It will become a link to the page.
  • If not, the link is red so you can click the red link to enter editing model to add content to the page.

Please link the new page to the print version of this wikibook so it can be visible in the print out.

How to do XYZ in wiki?[edit]

The best way is to goto en.wikipedia.com and find a page with the output you want. Then pretend to edit the page (by clicking edit) to see the source used to generate the output.

For example, you want to know how C++ syntax highlighting is obtained in wikibook. Go to en.wikipedia.com and find the page for C++. There must be sample code snippet.

Then you pretend to edit it to see the source: http://en.wikipedia.org/w/index.php?title=C%2B%2B&action=edit&section=6

You will see the source code generating the syntax highlighting:

<source lang="cpp">

# include <iostream>

int main()
{
   std::cout << "Hello, world!\n";
}
</source>

How to add comments which are only visible to editor, not readers of a page?[edit]

Use the HTML comments: for example, the following comment will not show up in the paper rendered. But it is visible to editor to reminder why things are done in certain way.

<!-- Please keep the pixel size to 400 so they are clean in the pdf version, Thanks!  -->
[[File:Rose-compiler-code-review-1.png|thumb|400px|Code review using github.llnl.gov]]

Syntax highlighting[edit]

Copied from http://en.wikipedia.org/w/index.php?title=C%2B%2B&action=edit&section=6

<source lang="cpp">

# include <iostream>

int main()
{
   std::cout << "Hello, world!\n";
}
</source>

Can generate the following highlighted code:

# include <iostream>
 
int main()
{
   std::cout << "Hello, world!\n";
}

Math formula[edit]

You can pretend to edit this section to see how math formula are written.

More resources are at

\sum_{j=1}^N (Si,j) =1


 \begin{matrix}
 \log_2(n!) & = & \log_2(n) + \log_2(n-1) + \log_2(n-2) + ... + \log_2(1) \\
            &  &  \qquad \ \ \ \ \log_2(n) + \log_2(n) + \log_2(n) + ... + \log_2(n) \\
            &  &  \qquad \ \ \ \ \qquad \ \ \ \ \qquad \ \ \ \ \qquad \ \ \ \ \qquad \ \ \ \ \ \ \ n log_2(n)
\end{matrix}

 \begin{align}
\log_2(n!) &= \log_2(n) + \log_2(n-1) + \log_2(n-2) + ... + \log_2(1) \\
&< \log_2(n) + \log_2(n) + \log_2(n) + ... + \log_2(n) \\
&= n log_2(n)
\end{align}


\begin{array}{lcr}
  z        & = & a \\
  f(x,y,z) & = & x + y + z     
\end{array}


  \operatorname{erfc}(x) =
  \frac{2}{\sqrt{\pi}} \int_x^{\infty} e^{-t^2}\,dt =
  \frac{e^{-x^2}}{x\sqrt{\pi}}\sum_{n=0}^\infty (-1)^n \frac{(2n)!}{n!(2x)^{2n}}