#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass article
\begin_preamble
%вчегда ставить отступ, даже в начале
\usepackage{indentfirst}
%\renewcommand{\baselinestretch}{1.25}
%\usepackage[12pt]{extsizes}
\usepackage{float}
%переименовать объект алгоритм
\floatname{algorithm}{Листинг}
%\newcommand{\algorithmname}{Listing}
%позволить добавление списка литературы в содержание
%\usepackage{tocbibind}
\usepackage[nottoc]{tocbibind} %получаем ToC без включения его самого же
\end_preamble
\use_default_options true
\begin_modules
figs-within-sections
tabs-within-sections
eqs-within-sections
\end_modules
\maintain_unincluded_children false
\language russian
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 12
\spacing onehalf
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder true
\pdf_colorlinks true
\pdf_backref false
\pdf_pdfusetitle true
\papersize a4paper
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 2cm
\topmargin 3cm
\rightmargin 2cm
\bottommargin 3cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language french
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Subsection*
1.
 Пример трансляции функции до доработки компилятора
\begin_inset CommandInset label
LatexCommand label
name "sub:attach-Func-master"

\end_inset


\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
addcontentsline{toc}{subsection}{1.
 Пример трансляции функции до доработки компилятора}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset listings
lstparams "numbers=left,stepnumber=1,basicstyle={\ttfamily},tabsize=2"
inline false
status open

\begin_layout Plain Layout

Func {
\end_layout

\begin_layout Plain Layout

	((e.FilePath)) (e.Text) e.A =
\end_layout

\begin_layout Plain Layout

		<WriteLine e.FilePath>
\end_layout

\begin_layout Plain Layout

		<WriteLine e.Text>
\end_layout

\begin_layout Plain Layout

		<WriteToHandle <FOpen 'w' e.FilePath> e.Text>
\end_layout

\begin_layout Plain Layout

		 ; 
\end_layout

\begin_layout Plain Layout

}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset listings
lstparams "numbers=left,stepnumber=1,basicstyle={\ttfamily},breaklines=true,tabsize=2"
inline false
status open

\begin_layout Plain Layout

static refalrts::FnResult Func(refalrts::Iter arg_begin, refalrts::Iter
 arg_end) {
\end_layout

\begin_layout Plain Layout

  refalrts::this_is_generated_function();
\end_layout

\begin_layout Plain Layout

  do {
\end_layout

\begin_layout Plain Layout

    refalrts::Iter bb_0 = arg_begin;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter be_0 = arg_end;
\end_layout

\begin_layout Plain Layout

    refalrts::move_left( bb_0, be_0 );
\end_layout

\begin_layout Plain Layout

    refalrts::move_left( bb_0, be_0 );
\end_layout

\begin_layout Plain Layout

    refalrts::move_right( bb_0, be_0 );
\end_layout

\begin_layout Plain Layout

    static refalrts::Iter eFilePath_1_b_1;
\end_layout

\begin_layout Plain Layout

    static refalrts::Iter eFilePath_1_e_1;
\end_layout

\begin_layout Plain Layout

    static refalrts::Iter eText_1_b_1;
\end_layout

\begin_layout Plain Layout

    static refalrts::Iter eText_1_e_1;
\end_layout

\begin_layout Plain Layout

    static refalrts::Iter eFilePath_1_b_2;
\end_layout

\begin_layout Plain Layout

    static refalrts::Iter eFilePath_1_e_2;
\end_layout

\begin_layout Plain Layout

    static refalrts::Iter eText_1_b_2;
\end_layout

\begin_layout Plain Layout

    static refalrts::Iter eText_1_e_2;
\end_layout

\begin_layout Plain Layout

    // ( ( e.FilePath#1 ) ) ( e.Text#1 ) e.A#1
\end_layout

\begin_layout Plain Layout

    refalrts::Iter bb_1 = 0;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter be_1 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::brackets_left( bb_1, be_1, bb_0, be_0 ) )
\end_layout

\begin_layout Plain Layout

      break;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter bb_2 = 0;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter be_2 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::brackets_left( bb_2, be_2, bb_1, be_1 ) )
\end_layout

\begin_layout Plain Layout

      break;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter bb_3 = 0;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter be_3 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::brackets_left( bb_3, be_3, bb_0, be_0 ) )
\end_layout

\begin_layout Plain Layout

      break;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::empty_seq( bb_1, be_1 ) )
\end_layout

\begin_layout Plain Layout

      break;
\end_layout

\begin_layout Plain Layout

    eFilePath_1_b_1 = bb_2;
\end_layout

\begin_layout Plain Layout

    eFilePath_1_e_1 = be_2;
\end_layout

\begin_layout Plain Layout

    eText_1_b_1 = bb_3;
\end_layout

\begin_layout Plain Layout

    eText_1_e_1 = be_3;
\end_layout

\begin_layout Plain Layout

    // Unused closed variable e.A#1
\end_layout

\begin_layout Plain Layout

#ifdef INTERPRET
\end_layout

\begin_layout Plain Layout

    const static refalrts::ResultAction raa[] = {
\end_layout

\begin_layout Plain Layout

      {refalrts::icBracket, 0, 0, refalrts::ibOpenCall},
\end_layout

\begin_layout Plain Layout

      {refalrts::icFunc, (void*) & WriteLine, (void*) "WriteLine"},
\end_layout

\begin_layout Plain Layout

      {refalrts::icSpliceEVar, & eFilePath_1_b_1, & eFilePath_1_e_1},
\end_layout

\begin_layout Plain Layout

      {refalrts::icBracket, 0, 0, refalrts::ibCloseCall},
\end_layout

\begin_layout Plain Layout

      {refalrts::icBracket, 0, 0, refalrts::ibOpenCall},
\end_layout

\begin_layout Plain Layout

      {refalrts::icFunc, (void*) & WriteLine, (void*) "WriteLine"},
\end_layout

\begin_layout Plain Layout

      {refalrts::icSpliceEVar, & eText_1_b_1, & eText_1_e_1},
\end_layout

\begin_layout Plain Layout

      {refalrts::icBracket, 0, 0, refalrts::ibCloseCall},
\end_layout

\begin_layout Plain Layout

      {refalrts::icBracket, 0, 0, refalrts::ibOpenCall},
\end_layout

\begin_layout Plain Layout

      {refalrts::icFunc, (void*) & WriteToHandle, (void*) "WriteToHandle"},
\end_layout

\begin_layout Plain Layout

      {refalrts::icBracket, 0, 0, refalrts::ibOpenCall},
\end_layout

\begin_layout Plain Layout

      {refalrts::icFunc, (void*) & FOpen, (void*) "FOpen"},
\end_layout

\begin_layout Plain Layout

      {refalrts::icChar, 0, 0, 'w'},
\end_layout

\begin_layout Plain Layout

      {refalrts::icCopyEVar, & eFilePath_1_b_1, & eFilePath_1_e_1},
\end_layout

\begin_layout Plain Layout

      {refalrts::icBracket, 0, 0, refalrts::ibCloseCall},
\end_layout

\begin_layout Plain Layout

      {refalrts::icCopyEVar, & eText_1_b_1, & eText_1_e_1},
\end_layout

\begin_layout Plain Layout

      {refalrts::icBracket, 0, 0, refalrts::ibCloseCall},
\end_layout

\begin_layout Plain Layout

      {refalrts::icEnd} 
\end_layout

\begin_layout Plain Layout

   };
\end_layout

\begin_layout Plain Layout

    refalrts::Iter allocs[2*sizeof(raa)/sizeof(raa[0])];
\end_layout

\begin_layout Plain Layout

    refalrts::FnResult res = refalrts::interpret_array( raa, allocs, arg_begin,
 arg_end );
\end_layout

\begin_layout Plain Layout

    return res;
\end_layout

\begin_layout Plain Layout

#else
\end_layout

\begin_layout Plain Layout

    refalrts::reset_allocator();
\end_layout

\begin_layout Plain Layout

    refalrts::Iter res = arg_begin;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::copy_evar( eFilePath_1_b_2, eFilePath_1_e_2, eFilePath_1_b_1
, eFilePath_1_e_1 ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::copy_evar( eText_1_b_2, eText_1_e_2, eText_1_b_1, eText_1_e_
1 ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n0 = 0;     if( ! refalrts::alloc_open_call( n0 ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n1 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_name( n1, & WriteLine, "WriteLine" ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n2 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_close_call( n2 ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n3 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_open_call( n3 ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n4 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_name( n4, & WriteLine, "WriteLine" ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n5 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_close_call( n5 ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n6 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_open_call( n6 ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n7 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_name( n7, & WriteToHandle, "WriteToHandle" ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory; 
\end_layout

\begin_layout Plain Layout

   refalrts::Iter n8 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_open_call( n8 ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n9 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_name( n9, & FOpen, "FOpen" ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n10 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_char( n10, 'w' ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n11 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_close_call( n11 ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::Iter n12 = 0;
\end_layout

\begin_layout Plain Layout

    if( ! refalrts::alloc_close_call( n12 ) )
\end_layout

\begin_layout Plain Layout

      return refalrts::cNoMemory;
\end_layout

\begin_layout Plain Layout

    refalrts::push_stack( n12 );
\end_layout

\begin_layout Plain Layout

    refalrts::push_stack( n6 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n12 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_evar( res, eText_1_b_2, eText_1_e_2 );
\end_layout

\begin_layout Plain Layout

    refalrts::push_stack( n11 );
\end_layout

\begin_layout Plain Layout

    refalrts::push_stack( n8 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n11 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_evar( res, eFilePath_1_b_2, eFilePath_1_e_2 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n10 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n9 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n8 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n7 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n6 );
\end_layout

\begin_layout Plain Layout

    refalrts::push_stack( n5 );
\end_layout

\begin_layout Plain Layout

    refalrts::push_stack( n3 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n5 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_evar( res, eText_1_b_1, eText_1_e_1 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n4 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n3 );
\end_layout

\begin_layout Plain Layout

    refalrts::push_stack( n2 );
\end_layout

\begin_layout Plain Layout

    refalrts::push_stack( n0 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n2 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_evar( res, eFilePath_1_b_1, eFilePath_1_e_1 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n1 );
\end_layout

\begin_layout Plain Layout

    res = refalrts::splice_elem( res, n0 );
\end_layout

\begin_layout Plain Layout

    refalrts::use( res );
\end_layout

\begin_layout Plain Layout

    refalrts::splice_to_freelist( arg_begin, arg_end );
\end_layout

\begin_layout Plain Layout

    return refalrts::cSuccess;
\end_layout

\begin_layout Plain Layout

#endif 
\end_layout

\begin_layout Plain Layout

  } while ( 0 );
\end_layout

\begin_layout Plain Layout

  return refalrts::FnResult( 
\end_layout

\begin_layout Plain Layout

   refalrts::cRecognitionImpossible | (__LINE__ << 8)
\end_layout

\begin_layout Plain Layout

  ); 
\end_layout

\begin_layout Plain Layout

}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Newpage newpage
\end_inset


\end_layout

\begin_layout Subsection*
2.
 Пример трансляции тестовой функции до доработки 
\begin_inset CommandInset label
LatexCommand label
name "sub:attach-Func-master-1"

\end_inset


\end_layout

\begin_layout Standard
Так выглядит листинг 
\begin_inset CommandInset ref
LatexCommand ref
reference "alg:context-opt"

\end_inset

 до внесения улучшений в компилятор.
\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
addcontentsline{toc}{subsection}{2.
 Пример трансляции тестовой функции до доработки}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset listings
lstparams "language=C,basicstyle={\ttfamily},tabsize=2"
inline false
status open

\begin_layout Plain Layout

refalrts::Iter bb_0 = arg_begin;
\end_layout

\begin_layout Plain Layout

refalrts::Iter be_0 = arg_end;
\end_layout

\begin_layout Plain Layout

...
\end_layout

\begin_layout Plain Layout

static refalrts::Iter ePattern_1_b_1;
\end_layout

\begin_layout Plain Layout

static refalrts::Iter ePattern_1_e_1;
\end_layout

\begin_layout Plain Layout

static refalrts::Iter sNumRanges_2_1;
\end_layout

\begin_layout Plain Layout

static refalrts::Iter eVars_2_b_1;
\end_layout

\begin_layout Plain Layout

static refalrts::Iter eVars_2_e_1;
\end_layout

\begin_layout Plain Layout

static refalrts::Iter eCommands_2_b_1;
\end_layout

\begin_layout Plain Layout

static refalrts::Iter eCommands_2_e_1;
\end_layout

\begin_layout Plain Layout

refalrts::Iter bb_1 = 0;
\end_layout

\begin_layout Plain Layout

refalrts::Iter be_1 = 0;
\end_layout

\begin_layout Plain Layout

if( ! refalrts::brackets_left( bb_1, be_1, bb_0, be_0 ) )
\end_layout

\begin_layout Plain Layout

  break;
\end_layout

\begin_layout Plain Layout

ePattern_1_b_1 = bb_1;
\end_layout

\begin_layout Plain Layout

ePattern_1_e_1 = be_1;
\end_layout

\begin_layout Plain Layout

refalrts::Iter bb_2 = 0;
\end_layout

\begin_layout Plain Layout

refalrts::Iter be_2 = 0;
\end_layout

\begin_layout Plain Layout

eVars_2_b_1 = bb_2;
\end_layout

\begin_layout Plain Layout

eVars_2_e_1 = be_2;
\end_layout

\begin_layout Plain Layout

eCommands_2_b_1 = bb_0;
\end_layout

\begin_layout Plain Layout

eCommands_2_e_1 = be_0;
\end_layout

\begin_layout Plain Layout

...
\end_layout

\begin_layout Plain Layout

const static refalrts::ResultAction raa[] = {
\end_layout

\begin_layout Plain Layout

  {refalrts::icBracket, 0, 0, refalrts::ibOpenBracket},
\end_layout

\begin_layout Plain Layout

  {refalrts::icSpliceEVar, & eVars_2_b_1, & eVars_2_e_1},
\end_layout

\begin_layout Plain Layout

  {refalrts::icBracket, 0, 0, refalrts::ibCloseBracket},
\end_layout

\begin_layout Plain Layout

  {refalrts::icBracket, 0, 0, refalrts::ibOpenBracket},
\end_layout

\begin_layout Plain Layout

  {refalrts::icBracket, 0, 0, refalrts::ibOpenBracket},
\end_layout

\begin_layout Plain Layout

  {refalrts::icFunc, (void*) & CmdComment, (void*) "CmdComment"},
\end_layout

\begin_layout Plain Layout

  ...
\end_layout

\begin_layout Plain Layout

  {refalrts::icBracket, 0, 0, refalrts::ibCloseBracket},
\end_layout

\begin_layout Plain Layout

  {refalrts::icEnd}
\end_layout

\begin_layout Plain Layout

};
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Newpage newpage
\end_inset


\end_layout

\begin_layout Subsection*
3.
 Исходный текст скрипта для тестирования
\begin_inset CommandInset label
LatexCommand label
name "sub:test-script"

\end_inset


\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
addcontentsline{toc}{subsection}{3.
 Исходный текст скрипта для тестирования}
\end_layout

\end_inset


\end_layout

\begin_layout Standard

\series bold
bootstrap/benchmark.bat
\end_layout

\begin_layout Standard
\begin_inset listings
lstparams "language=bash,basicstyle={\ttfamily},breaklines=true,tabsize=2"
inline false
status open

\begin_layout Plain Layout

setlocal
\end_layout

\begin_layout Plain Layout

  call ..
\backslash
c-plus-plus.conf.bat
\end_layout

\begin_layout Plain Layout

  del int-%1 comp-%1
\end_layout

\begin_layout Plain Layout

  set FILES=srefc Algorithm Context Error FindFile Generator Lexer ParseCmdLine
 Parser^
\end_layout

\begin_layout Plain Layout

    SymTable refalrts Library LibraryEx
\end_layout

\begin_layout Plain Layout

  for /L %%i in (1, 1, 9) do (
\end_layout

\begin_layout Plain Layout

    echo Interpret %%i
\end_layout

\begin_layout Plain Layout

    ..
\backslash
compiler
\backslash
srefc -c "%CPPLINE% -I../srlib -DINTERPRET" %FILES% 2>> int-%1
\end_layout

\begin_layout Plain Layout

  )
\end_layout

\begin_layout Plain Layout

  for /L %%i in (1, 1, 9) do (
\end_layout

\begin_layout Plain Layout

    echo Compile %%i
\end_layout

\begin_layout Plain Layout

    ..
\backslash
compiler
\backslash
srefc -c "%CPPLINE% -I../srlib" %FILES% 2>> comp-%1
\end_layout

\begin_layout Plain Layout

  )
\end_layout

\begin_layout Plain Layout

  del *.exe
\end_layout

\begin_layout Plain Layout

  if exist *.obj del *.obj
\end_layout

\begin_layout Plain Layout

  if exist *.o del *.o
\end_layout

\begin_layout Plain Layout

  if exist *.tds del *.tds endlocal
\end_layout

\end_inset


\end_layout

\begin_layout Standard

\series bold
compiler/benchmark.bat
\end_layout

\begin_layout Standard
\begin_inset listings
lstparams "language=bash,basicstyle={\ttfamily},breaklines=true,tabsize=2"
inline false
status open

\begin_layout Plain Layout

del %1
\end_layout

\begin_layout Plain Layout

for /L %%i in (1, 1, 9) do echo %%i & ..
\backslash
compiler
\backslash
srefc @benchmark_data.lst 2>> %1
\end_layout

\begin_layout Plain Layout

del *.cpp
\end_layout

\begin_layout Plain Layout

echo.>> %1
\end_layout

\begin_layout Plain Layout

echo.>> %1
\end_layout

\begin_layout Plain Layout

for %%f in (srefc.exe) do
\end_layout

\begin_layout Plain Layout

  echo File size %%~zf bytes >> %1
\end_layout

\end_inset


\end_layout

\begin_layout Standard

\series bold
compiler/benchmark_data.lst
\end_layout

\begin_layout Standard
\begin_inset listings
lstparams "language=bash,basicstyle={\ttfamily},breaklines=true,tabsize=2"
inline false
status open

\begin_layout Plain Layout

Algorithm Context Error
\end_layout

\begin_layout Plain Layout

FindFile Generator Lexer
\end_layout

\begin_layout Plain Layout

ParseCmdLine Parser srefc
\end_layout

\begin_layout Plain Layout

SymTable Algorithm Context
\end_layout

\begin_layout Plain Layout

Error FindFile Generator
\end_layout

\begin_layout Plain Layout

Lexer ParseCmdLine Parser
\end_layout

\begin_layout Plain Layout

srefc SymTable Algorithm
\end_layout

\begin_layout Plain Layout

Context Error FindFile
\end_layout

\begin_layout Plain Layout

Generator Lexer ParseCmdLine
\end_layout

\begin_layout Plain Layout

Parser srefc SymTable
\end_layout

\begin_layout Plain Layout

Algorithm Context Error
\end_layout

\begin_layout Plain Layout

FindFile Generator Lexer
\end_layout

\begin_layout Plain Layout

ParseCmdLine Parser srefc
\end_layout

\begin_layout Plain Layout

SymTable Algorithm Context
\end_layout

\begin_layout Plain Layout

Error FindFile Generator
\end_layout

\begin_layout Plain Layout

Lexer ParseCmdLine Parser
\end_layout

\begin_layout Plain Layout

srefc SymTable
\end_layout

\end_inset


\end_layout

\begin_layout Standard

\series bold
compiler/mean.awk
\end_layout

\begin_layout Standard
\begin_inset listings
lstparams "language=bash,basicstyle={\ttfamily},breaklines=true,tabsize=2"
inline false
status open

\begin_layout Plain Layout

{
\end_layout

\begin_layout Plain Layout

  key = FILENAME " ||";
\end_layout

\begin_layout Plain Layout

  for (i = 1; i < NF; ++i) {
\end_layout

\begin_layout Plain Layout

    n = i+1;
\end_layout

\begin_layout Plain Layout

    if ($n ~ /seconds/) { 
\end_layout

\begin_layout Plain Layout

     metric[key] += $i;
\end_layout

\begin_layout Plain Layout

     count[key] += 1;
\end_layout

\begin_layout Plain Layout

     squares[key] += $i * $i;
\end_layout

\begin_layout Plain Layout

    }
\end_layout

\begin_layout Plain Layout

    key = key " " $i;
\end_layout

\begin_layout Plain Layout

  }
\end_layout

\begin_layout Plain Layout

}
\end_layout

\begin_layout Plain Layout

/^File size/ {   filesize[FILENAME] = $3; }
\end_layout

\begin_layout Plain Layout

function size_format(bytes) {
\end_layout

\begin_layout Plain Layout

  return bytes / 1024.0 " Kb" 
\end_layout

\begin_layout Plain Layout

}
\end_layout

\begin_layout Plain Layout

END {
\end_layout

\begin_layout Plain Layout

  print " PARAM || interpreted || compiled || %";
\end_layout

\begin_layout Plain Layout

  for (key in metric) {
\end_layout

\begin_layout Plain Layout

    mean = metric[key] / count[key];
\end_layout

\begin_layout Plain Layout

    mean_sq = squares[key] / count[key];
\end_layout

\begin_layout Plain Layout

    sq_mean = mean * mean;
\end_layout

\begin_layout Plain Layout

    suf = ""
\end_layout

\begin_layout Plain Layout

    if (key ~ /int/) {
\end_layout

\begin_layout Plain Layout

      comp_key = key
\end_layout

\begin_layout Plain Layout

      gsub("int", "comp", comp_key);
\end_layout

\begin_layout Plain Layout

      if (count[comp_key] ) {
\end_layout

\begin_layout Plain Layout

        mean_comp = metric[comp_key] / count[comp_key];
\end_layout

\begin_layout Plain Layout

        mean_sq_comp = squares[comp_key] / count[comp_key];
\end_layout

\begin_layout Plain Layout

        sq_mean_comp = mean_comp * mean_comp;
\end_layout

\begin_layout Plain Layout

        if (mean_comp) {
\end_layout

\begin_layout Plain Layout

          suf = " || " (100.0 * mean / mean_comp - 100.0) " %" 
\end_layout

\begin_layout Plain Layout

       }
\end_layout

\begin_layout Plain Layout

        line_int = mean " +- " sqrt(mean_sq - sq_mean);
\end_layout

\begin_layout Plain Layout

        line_comp = mean_comp " +- " sqrt(mean_sq_comp - sq_mean_comp);
\end_layout

\begin_layout Plain Layout

        printf("%s = %s | %s %s
\backslash
n", key, line_int, line_comp, suf);
\end_layout

\begin_layout Plain Layout

      }
\end_layout

\begin_layout Plain Layout

    }
\end_layout

\begin_layout Plain Layout

  }
\end_layout

\begin_layout Plain Layout

  for (mode_int in filesize) {
\end_layout

\begin_layout Plain Layout

    if (mode_int ~ /int/) {
\end_layout

\begin_layout Plain Layout

      mode_comp = mode_int;
\end_layout

\begin_layout Plain Layout

      gsub("int", "comp", mode_comp);
\end_layout

\begin_layout Plain Layout

      if (filesize[mode_comp]) {
\end_layout

\begin_layout Plain Layout

        int_sz = filesize[mode_int]
\end_layout

\begin_layout Plain Layout

        comp_sz = filesize[mode_comp]
\end_layout

\begin_layout Plain Layout

        percent = 100.0 * int_sz / comp_sz;
\end_layout

\begin_layout Plain Layout

        ratio = 100.0 / percent
\end_layout

\begin_layout Plain Layout

        int_sz_fmt = size_format(int_sz);
\end_layout

\begin_layout Plain Layout

        comp_sz_fmt = size_format(comp_sz);
\end_layout

\begin_layout Plain Layout

        print "zFILE SIZE " mode_int " || " int_sz_fmt " | " comp_sz_fmt
 " || " percent - 100 " %, " ratio 
\end_layout

\begin_layout Plain Layout

     }
\end_layout

\begin_layout Plain Layout

   } 
\end_layout

\begin_layout Plain Layout

 }
\end_layout

\begin_layout Plain Layout

}
\end_layout

\end_inset


\end_layout

\begin_layout Standard

\series bold
compiler/mean.bat
\end_layout

\begin_layout Standard
\begin_inset listings
lstparams "language=bash,basicstyle={\ttfamily},breaklines=true,tabsize=2"
inline false
status open

\begin_layout Plain Layout

@echo off "c:
\backslash
Program Files (x86)
\backslash
Git
\backslash
bin
\backslash
gawk.exe" -f ../compiler/mean.awk *.txt | sort
\end_layout

\end_inset


\end_layout

\end_body
\end_document
