Compare commits
31 Commits
origin/mas
...
shyam_ragh
| Author | SHA1 | Date | |
|---|---|---|---|
| 62d0e37984 | |||
| d0540da465 | |||
| e870cd5cf9 | |||
| d18ccb49da | |||
| ff581d8a8c | |||
| d203261c64 | |||
| 6e3a9b87b9 | |||
| 55b06a1288 | |||
| d2841cd48f | |||
| bbd72c2111 | |||
|
|
e029efcbd7 | ||
|
|
65197535bc | ||
|
|
ee99956b52 | ||
|
|
f2541c0266 | ||
|
|
f13a302b54 | ||
|
|
00bf6e8243 | ||
| decf25ed29 | |||
| 20913ff264 | |||
| b9acc5c659 | |||
|
|
51f57539eb | ||
|
|
2f774a0200 | ||
|
|
e9c137f1e6 | ||
| 489628e0a6 | |||
| 1a4ea7b946 | |||
|
|
794150083f | ||
|
|
ffb398cecc | ||
| c5acca8cdc | |||
| 19be3ddd02 | |||
|
|
54459bc6df | ||
|
|
710a128529 | ||
| 827f234009 |
3
.gitignore
vendored
@@ -35,3 +35,6 @@ node_modules
|
||||
#nodejs things
|
||||
node_modules
|
||||
npm-debug.log
|
||||
|
||||
#vim swap files
|
||||
*.swp
|
||||
|
||||
2
app.js
@@ -11,7 +11,7 @@ app.configure(function() {
|
||||
app.set('view engine', 'jade');
|
||||
app.use(express.logger('dev'));
|
||||
app.use(express.json());
|
||||
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
//debug error handler
|
||||
|
||||
BIN
instructions/adding-labels-cropped.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
instructions/adding-labels.png
Normal file
|
After Width: | Height: | Size: 839 KiB |
BIN
instructions/assign-to-developer-cropped.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
instructions/assign-to-developer.png
Normal file
|
After Width: | Height: | Size: 848 KiB |
BIN
instructions/clickin-new-issue-cropped.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
instructions/clickin-new-issue.png
Normal file
|
After Width: | Height: | Size: 793 KiB |
BIN
instructions/finding-issues-page-cropped.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
instructions/finding-issues-page.png
Normal file
|
After Width: | Height: | Size: 836 KiB |
BIN
instructions/image-1.png
Normal file
|
After Width: | Height: | Size: 145 KiB |
BIN
instructions/image-2.png
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
instructions/image-3.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
instructions/image-4.png
Normal file
|
After Width: | Height: | Size: 130 KiB |
BIN
instructions/image-5.png
Normal file
|
After Width: | Height: | Size: 109 KiB |
BIN
instructions/image-6.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
instructions/instr.pdf
Normal file
160
instructions/instr.tex
Normal file
@@ -0,0 +1,160 @@
|
||||
\documentclass[11pt]{article}
|
||||
|
||||
\usepackage{graphicx}
|
||||
|
||||
\oddsidemargin0cm
|
||||
\topmargin-3cm
|
||||
\textwidth16.0cm
|
||||
\textheight24.5cm
|
||||
|
||||
\newcommand{\step}[2] {\vspace{.25in} \hrule\vspace{0.5em}
|
||||
\noindent{\bf Step #1: #2} \vspace{0.5em}
|
||||
\hrule \vspace{.10in}}
|
||||
|
||||
\begin{document}
|
||||
\thispagestyle{empty}
|
||||
|
||||
\noindent Aaron Gutierrez \& Mitchell Plamann\hfill{15-221}\\
|
||||
amgutier@andrew.cmu.edu \& mplamann@andrew.cmu.edu \hfill{Spring 2015}\\
|
||||
Section A \hfill{Team 9}
|
||||
|
||||
\vspace{\fill}
|
||||
\begin{center}
|
||||
Writing Assignment 3
|
||||
Instructions
|
||||
|
||||
\today
|
||||
\end{center}
|
||||
\vspace{\fill}
|
||||
|
||||
\newpage
|
||||
|
||||
\pagenumbering{arabic}
|
||||
\begin{center}
|
||||
{\Huge Creating and Closing GitHub Issues}
|
||||
\end{center}
|
||||
\section{Overview}
|
||||
GitHub provides a great tool for multi-user collaboration on software projects.
|
||||
On top of the version control features, GitHub offers sophisticated issue
|
||||
tracking integrated right in with all of your repositories. Tracking issues
|
||||
makes it easy to keep track of bugs, new feature ideas, and feedback from
|
||||
testers, all of which help keep your project organized. In the next five
|
||||
steps, you will learn how to create a new issues, assign an issue to a
|
||||
contributor, and mark an issue as resolved.
|
||||
|
||||
This tutorial is for GitHub users who know how to create and use repositories,
|
||||
but are unfamiliar with GitHub's issue tracking features. You need to have an
|
||||
existing GitHub repository, a web browser, and a git client on your computer.
|
||||
Once you're done, you'll be able add, manage, and close issues for every project
|
||||
you have on GitHub.
|
||||
|
||||
\section{Steps}
|
||||
|
||||
\step{1}{Open your repository's Issues page}
|
||||
{\bf In this step, you will access the Issues page for your repository.}
|
||||
|
||||
\begin{enumerate}
|
||||
\item Open your GitHub repository in your web browser.
|
||||
\item Click ``Issues'' (Fig \ref{fig:issues_button})
|
||||
\item You should now see the ``Issues'' page, which you will use in Step 2.
|
||||
\end{enumerate}
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=\linewidth]{finding-issues-page-cropped.png}
|
||||
\caption{Opening the Issues page}
|
||||
\label{fig:issues_button}
|
||||
\end{figure}
|
||||
|
||||
\pagebreak
|
||||
|
||||
\step{2}{Create an issue}
|
||||
{\bf In this step, you will create a new issue associated with your repository and
|
||||
fill in necessary information}
|
||||
|
||||
\begin{enumerate}
|
||||
\item Click the ``New Issue'' button (Fig \ref{fig:new_issue})
|
||||
\item Enter in a title for the issue (1, Fig \ref{fig:issue_info})
|
||||
\item Enter in a description for the issue (2, Fig \ref{fig:issue_info})
|
||||
\item Click ``Submit new issue'' (3, Fig \ref{fig:issue_info})
|
||||
\item Continue to step 3, where you will add a label to your newly-created issue.
|
||||
\end{enumerate}
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=\textwidth]{clickin-new-issue-cropped.png}
|
||||
\caption{Creating a new issue}
|
||||
\label{fig:new_issue}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=\textwidth]{new-issue-info-cropped.png}
|
||||
\caption{Entering issue information}
|
||||
\label{fig:issue_info}
|
||||
\end{figure}
|
||||
|
||||
\pagebreak
|
||||
|
||||
\step{3}{Assign labels to an issue}
|
||||
{\bf In this step, you will label your issue, indicating what type of issue it is.}
|
||||
|
||||
\begin{enumerate}
|
||||
\item Click the ``Labels'' button (1, Fig \ref{fig:labels})
|
||||
\item Click each label that applies to your issue (2, Fig \ref{fig:labels})
|
||||
\item Click the X button (3, Fig \ref{fig:labels})
|
||||
\item In step 4, you will assign this issue to a developer.
|
||||
\end{enumerate}
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=\textwidth]{adding-labels-cropped.png}
|
||||
\caption{Adding labels to an issue}
|
||||
\label{fig:labels}
|
||||
\end{figure}
|
||||
|
||||
\pagebreak
|
||||
|
||||
\step{4}{Assign an issue to a developer}
|
||||
{\bf In this step, you will assign this issue to a developer who will fix the issue.}
|
||||
|
||||
\begin{enumerate}
|
||||
\item Click the ``Assignee'' button (1, Fig \ref{fig:assign})
|
||||
\item Click the name of the developer who will fix the issue (2, Fig \ref{fig:assign})
|
||||
\item At this point, the issue has been assigned to the deveoper.
|
||||
Once the developer has fixed the issue, proceed to step 5 to mark the issue as resolved.
|
||||
\end{enumerate}
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=\textwidth]{assign-to-developer-cropped.png}
|
||||
\caption{Assigning an issue to a developer}
|
||||
\label{fig:assign}
|
||||
\end{figure}
|
||||
|
||||
\pagebreak
|
||||
|
||||
\step{5}{Marking an issue as resolved}
|
||||
{\bf In this step, you will mark the issue as resolved,
|
||||
indicating that the developer assigned to the issue has fixed it.}
|
||||
|
||||
\begin{enumerate}
|
||||
\item On the issue web page, you can see the issue number.
|
||||
For our example, it is \#3 (Fig \ref{fig:issue_number}).
|
||||
\item Using your git client on your computer, make a commit as you normally
|
||||
would including the changes that fix the issue. In the commit message,
|
||||
include the text ``Resolves \#{\it N}'', replacing {\it N} with your issue number. In
|
||||
the example issue, the commit message would be ``Resolves \#3''.
|
||||
\item GitHub detects this commit and marks the issue as closed (Fig \ref{fig:resolved}).
|
||||
At this point, you have successfully created a GitHub issue, fixed the problem in the repository,
|
||||
and marked the issue as resolved.
|
||||
\end{enumerate}
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=\textwidth]{issue-number-cropped.png}
|
||||
\caption{Finding the issue number}
|
||||
\label{fig:issue_number}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=\textwidth]{issue-resolved-cropped.png}
|
||||
\caption{The issue has been resolved}
|
||||
\label{fig:resolved}
|
||||
\end{figure}
|
||||
|
||||
\end{document}
|
||||
BIN
instructions/issue-has-been-assigned-cropped.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
instructions/issue-has-been-assigned.png
Normal file
|
After Width: | Height: | Size: 844 KiB |
BIN
instructions/issue-number-cropped.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
instructions/issue-resolved-cropped.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
instructions/issue-resolved.png
Normal file
|
After Width: | Height: | Size: 858 KiB |
BIN
instructions/label-has-been-added-cropped.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
instructions/label-has-been-added.png
Normal file
|
After Width: | Height: | Size: 840 KiB |
BIN
instructions/new-issue-info-cropped.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
instructions/new-issue-info.png
Normal file
|
After Width: | Height: | Size: 795 KiB |
BIN
progress_report/gannt.jpg
Normal file
|
After Width: | Height: | Size: 31 KiB |
10
progress_report/lit_review.fdb_latexmk
Normal file
@@ -0,0 +1,10 @@
|
||||
# Fdb version 3
|
||||
["latex"] 1429036983 "lit_review.tex" "lit_review.dvi" "lit_review" 1429036987
|
||||
"/usr/local/texlive/2014/texmf-dist/web2c/texmf.cnf" 1398200874 31722 4f52421e59a4b9e910cf18e64c1f2b4a ""
|
||||
"/usr/local/texlive/2014/texmf-var/web2c/pdftex/latex.fmt" 1401025988 3831950 412798929e0196806f9f91e131a01806 ""
|
||||
"/usr/local/texlive/2014/texmf.cnf" 1401025936 577 a59edbde8d3a8c549d0eeaab1739e2ff ""
|
||||
"lit_review.aux" 1429036983 8 a94a2480d3289e625eea47cd1b285758 ""
|
||||
"lit_review.tex" 1429035932 1602 8c64955909e149f1edf1ceb643d93c17 ""
|
||||
(generated)
|
||||
"lit_review.dvi"
|
||||
"lit_review.log"
|
||||
6
progress_report/lit_review.fls
Normal file
@@ -0,0 +1,6 @@
|
||||
PWD /Users/shyam/Dropbox/cdb/progress_report
|
||||
INPUT /usr/local/texlive/2014/texmf.cnf
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/web2c/texmf.cnf
|
||||
INPUT /usr/local/texlive/2014/texmf-var/web2c/pdftex/latex.fmt
|
||||
INPUT lit_review.tex
|
||||
OUTPUT lit_review.log
|
||||
28
progress_report/lit_review.tex
Executable file
@@ -0,0 +1,28 @@
|
||||
\section{Literature Review}
|
||||
Since the start of our project, we have found multiple new information sources;
|
||||
the following are the most important ones.
|
||||
\begin{itemize}
|
||||
\item Nodeunit documentation \\
|
||||
https://github.com/caolan/nodeunit \\
|
||||
% It might be better to put the URLs in the "References" section and add a [\ref{}] here
|
||||
We are using nodeunit to test our virtual machine.
|
||||
Since the c0 bytecode has many different opcodes that it uses, it is very easy
|
||||
for mistakes in the virtual machine to go unnoticed.
|
||||
To prevent this, we are using the nodeunit library to write unit tests for our
|
||||
code.
|
||||
This has already helped us to find and solve multiple bugs in the VM, and having
|
||||
these unit tests will make sure that we can solve any bugs that occur as the
|
||||
result of future changes in the code.
|
||||
\item C0vm Assignment Handout \\
|
||||
https://www.cs.cmu.edu/~rjsimmon/15122-f14/prog/c0vm-writeup.pdf \\
|
||||
This document details how each opcode in the c0 bytecode language works,
|
||||
as well as other important implementation details for the c0 virtual machine.
|
||||
It has been an important reference while developing a JavaScript version
|
||||
of the c0 virtual machine.
|
||||
\end{itemize}
|
||||
So far, the most important thing we have learned is that good unit tests are
|
||||
vital for developing this sort of project. Without unit tests that verify
|
||||
each opcode used by the virtual machine, many bugs would have gone unnoticed,
|
||||
causing problems later down the line. If we only found these bugs by using
|
||||
the frontend, they would have been much harder to debug, as there would have
|
||||
been much more code to work through.
|
||||
BIN
progress_report/new-gantt.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
progress_report/old-gantt.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
progress_report/old-gantt.png
Normal file
|
After Width: | Height: | Size: 99 KiB |
10
progress_report/overview.fdb_latexmk
Normal file
@@ -0,0 +1,10 @@
|
||||
# Fdb version 3
|
||||
["latex"] 1429036987 "overview.tex" "overview.dvi" "overview" 1429036988
|
||||
"/usr/local/texlive/2014/texmf-dist/web2c/texmf.cnf" 1398200874 31722 4f52421e59a4b9e910cf18e64c1f2b4a ""
|
||||
"/usr/local/texlive/2014/texmf-var/web2c/pdftex/latex.fmt" 1401025988 3831950 412798929e0196806f9f91e131a01806 ""
|
||||
"/usr/local/texlive/2014/texmf.cnf" 1401025936 577 a59edbde8d3a8c549d0eeaab1739e2ff ""
|
||||
"overview.aux" 1429036987 8 a94a2480d3289e625eea47cd1b285758 ""
|
||||
"overview.tex" 1429036311 1357 cfaf2a8de5eaf66d6fce726acdb307d4 ""
|
||||
(generated)
|
||||
"overview.log"
|
||||
"overview.dvi"
|
||||
6
progress_report/overview.fls
Normal file
@@ -0,0 +1,6 @@
|
||||
PWD /Users/shyam/Dropbox/cdb/progress_report
|
||||
INPUT /usr/local/texlive/2014/texmf.cnf
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/web2c/texmf.cnf
|
||||
INPUT /usr/local/texlive/2014/texmf-var/web2c/pdftex/latex.fmt
|
||||
INPUT overview.tex
|
||||
OUTPUT overview.log
|
||||
22
progress_report/overview.tex
Normal file
@@ -0,0 +1,22 @@
|
||||
\section{Overview}
|
||||
\subsection{Purpose of the Report}
|
||||
This report serves as an update to the reader on the progress the c0db team has
|
||||
made on the C0 Debugger during the first month of work. The report will detail
|
||||
what has been accomplished so far, what is in progress, what is planned for the
|
||||
future, and any changes that will be made to the original plan of action. In
|
||||
addition, the report will detail new literature that has been gathered and
|
||||
used.
|
||||
\subsection{Purpose of the Project}
|
||||
The purpose of this project is to build a web application that can debug C0
|
||||
code and can aid in a student's understanding of fundamental computational
|
||||
models. This project will benefit students in 15-122 Principals of Imperative
|
||||
Computation at Carnegie Mellon University by helping them create correct
|
||||
programs. The C0 Debugger will enable students to understand how their programs
|
||||
execute and find where problems originate more easily than with existing tools.
|
||||
In addition to debugging, students will have better knowledge for how the
|
||||
underlying computation model works when evaluating their code.
|
||||
\par
|
||||
The C0 Debugger will also enable students to test simple programs with little
|
||||
setup, using only a web browser. They will no longer have to set up and become
|
||||
familiar with a Unix environment before they can program, making C0 accessible
|
||||
to more people, more quickly.
|
||||
45
progress_report/progress.tex
Normal file
@@ -0,0 +1,45 @@
|
||||
\section{Progress}
|
||||
We are nearing completion on the virtual machine upon which the debugger will
|
||||
run. Moving forward, the front end team will polish the existing interface, and
|
||||
expand it to control the debugger. The back end team will work on the core
|
||||
functionality of the debugger and continue to fix bugs with the virtual machine.
|
||||
This places us two weeks behind schedule over all, as we planned to have the
|
||||
virtual machine finished by April 1\textsuperscript{st}.
|
||||
|
||||
\subsection*{Front End: Status}
|
||||
The front end team is keeping pace with the back end team, but is still two
|
||||
weeks behind schedule. We have a working interface where users can input,
|
||||
compile, and run C0 programs, but there are no debugging features.
|
||||
|
||||
\subsection*{Front End: Projections}
|
||||
We will modify our schedule to allow more time for the work on the debugger.
|
||||
This time will come from a shortened user testing and revision period. That
|
||||
said, because of our thorough work on the virtual machine, implementing the
|
||||
debugger should progress more rapidly than originally planned. The modified
|
||||
schedule is depicted in our updated Gannt chart (Figure \ref{gannt}).
|
||||
|
||||
\subsection*{Back End: Status}
|
||||
The back end team is also two weeks behind schedule. The virtual machine, along
|
||||
with most library functions needed to run programs, is complete and working
|
||||
well. The team has started working on stepping through program execution, but
|
||||
those features have not yet been incorporated with the rest of the application.
|
||||
|
||||
\subsection*{Back End: Projections}
|
||||
In the coming time, the back end team will implement the remaining library
|
||||
functions, then transition all of their efforts to the debugging features. Like
|
||||
the front end team, this transition was originally scheduled for
|
||||
April\textsuperscript{st}, but will now occur in the next week.
|
||||
|
||||
\includegraphics{gannt}
|
||||
|
||||
Our revised Gannt chart features two key changes. The back end and front end
|
||||
sections were modified such that the transition of effort from the virtual
|
||||
machine to the debugger aligns with where that actually happened. As a result,
|
||||
the testing and revision section was push back. We are now aiming to start
|
||||
testing and revision the week of April 20\textsuperscript{th}.
|
||||
|
||||
\subsection*{Quantification of Progress}
|
||||
Currently, we have over 50 test files that we use to check for correctness of
|
||||
our virtual machine. We currently pass 44 test cases, and are working to have
|
||||
the rest functioning correctly soon. Once the debugger is more feature complete,
|
||||
we will focus more on user feedback to assess progress.
|
||||
23
progress_report/progress.tex.project.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" ATP project vim script: Tue Apr 14, 2015 at 08:36 PM -0400.
|
||||
|
||||
let b:atp_MainFile = 'progress.tex'
|
||||
let g:atp_mapNn = 0
|
||||
let b:atp_autex = 1
|
||||
let b:atp_TexCompiler = 'pdftex'
|
||||
let b:atp_TexOptions = '-synctex=1'
|
||||
let b:atp_TexFlavor = 'plaintex'
|
||||
let b:atp_auruns = '1'
|
||||
let b:atp_ReloadOnError = '1'
|
||||
let b:atp_OutDir = '/Users/shyam/Dropbox/cdb/progress_report'
|
||||
let b:atp_OpenViewer = '1'
|
||||
let b:atp_XpdfServer = 'progress'
|
||||
let b:atp_Viewer = 'okular'
|
||||
let b:TreeOfFiles = {}
|
||||
let b:ListOfFiles = []
|
||||
let b:TypeDict = {}
|
||||
let b:LevelDict = {}
|
||||
let b:atp_BibCompiler = 'bibtex'
|
||||
let b:atp_StarEnvDefault = ''
|
||||
let b:atp_StarMathEnvDefault = ''
|
||||
let b:atp_updatetime_insert = 4000
|
||||
let b:atp_updatetime_normal = 2000
|
||||
BIN
progress_report/progress_report.dvi
Normal file
86
progress_report/progress_report.fdb_latexmk
Normal file
@@ -0,0 +1,86 @@
|
||||
# Fdb version 3
|
||||
<<<<<<< HEAD
|
||||
["latex"] 1429057416 "progress_report.tex" "progress_report.dvi" "progress_report" 1429057422
|
||||
=======
|
||||
["latex"] 1429044499 "progress_report.tex" "progress_report.dvi" "progress_report" 1429044577
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
"/usr/local/texlive/2014/texmf-dist/fonts/map/fontname/texfonts.map" 1272929888 3287 e6b82fe08f5336d4d5ebc73fb1152e87 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/fonts/tfm/public/cm/cmr10.tfm" 1136768653 1296 45809c5a464d5f32c8f98ba97c1bb47f ""
|
||||
"/usr/local/texlive/2014/texmf-dist/fonts/tfm/public/txfonts/txb.tfm" 1136768653 2452 76194099b4f1c022cb59f4564251c4fe ""
|
||||
"/usr/local/texlive/2014/texmf-dist/fonts/tfm/public/txfonts/txr.tfm" 1136768653 2408 aec793a3c45e495f7ad15b227c91f508 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/fonts/tfm/public/txfonts/txsy.tfm" 1136768653 1268 1d124f224979493f8fd017a7597ea1cd ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/generic/ifxetex/ifxetex.sty" 1284331290 1458 43ab4710dc82f3edeabecd0d099626b2 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/atbegshi.sty" 1335995445 24460 92f559a71aac869021852c227c704b38 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/gettitlestring.sty" 1303254447 8237 52810bdb4db2270e717422560a104aea ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty" 1338332114 189108 8b3553a56c83ff61acecb36b75d817e2 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty" 1338332114 70752 45fa392800e07da61fa13446ad46b34d ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ifpdf.sty" 1303254447 7140 ece2cc23d9f20e1f53975ac167f42d3e ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ifvtex.sty" 1335995445 6797 68c89f65e01894df882dd523d3fc0a8f ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/infwarerr.sty" 1335995445 8253 3bdedc8409aa5d290a2339be6f09af03 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ltxcmds.sty" 1335995445 18425 775b341047ce304520cc7c11ca41392e ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/base/article.cls" 1399675188 20496 66dd832c447553f6776fbeac03bb0580 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/base/ifthen.sty" 1399675188 4947 22c4b902063e8ce2efcc2a8495ecb800 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/base/size11.clo" 1399675188 8983 e08a9a7009d9a8f8c6507333f96e336e ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/eso-pic/eso-pic.sty" 1381444076 11590 2a66b78f3da61ad137452c2777f21b6b ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/geometry/geometry.sty" 1284422013 40502 e003406220954b0716679d7928aedd8a ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/graphics/dvips.def" 1399675188 5104 e68b64366d1946a5893a7f717264ec59 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/graphics/graphics.sty" 1254151804 14183 42a8fc761b806986eef292369afc2988 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/graphics/graphicx.sty" 1399675188 7911 bf0a64f89bfb668c239ddf6324bf4afb ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/graphics/keyval.sty" 1399675188 2317 0ace13e225e9d95dd9defe947adc9fbb ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/graphics/trig.sty" 1156702488 3153 c50e6bd54d2dd3933fc52bcf369bec4a ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/hdvips.def" 1352416072 3471 43fa5241d35e8bdbf02746c6d8e25fc2 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/hyperref.sty" 1352416072 231792 5fc9dc7dd667e773a766ecc63bba7f4b ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/nameref.sty" 1351899753 12847 25b617d63258c4f72870c883493a3cf8 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/pd1enc.def" 1352416072 14005 155ac8fad2e5dd7c2cdd130fabd96633 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/pdfmark.def" 1352416072 49315 059e7f302e066f22f383833cd87167cb ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/latexconfig/color.cfg" 1254097189 802 7b8c8d72c24d795ed7720e4dfd29bff3 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/latexconfig/graphics.cfg" 1278958963 3563 d35e897cae3b8c6848f6677b73370b54 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/latexconfig/hyperref.cfg" 1254097189 235 6031e5765137be07eed51a510b2b8fb7 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/auxhook.sty" 1303254447 3834 707ef09f31d7d2ea47ba89974755dfe0 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/kvoptions.sty" 1335995445 22417 c74ff4af6a1aa2b65d1924020edbbe11 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty" 1303254447 9581 1158efc648bc09d5064db5703c882159 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/pdfpages/pdfpages.sty" 1377467854 51227 e7dc1f34ba805af6251ecb7986bb034f ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/pdfpages/ppnull.def" 1377467854 2528 737efa41d2b4535305b16bdebc3d7d8e ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/pdfpages/pppdftex.def" 1377467854 5975 e550dcf6f005a7223bb41a05edf0e99d ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/setspace/setspace.sty" 1324344192 22913 a27d7908fc6f0385466454a966a316eb ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/tocloft/tocloft.sty" 1367531278 34706 345df874e59e023274392bd0cf090d66 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/tools/array.sty" 1399675188 13073 a6e28ede26c83d406e124b12f368174f ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/tools/calc.sty" 1399675188 10002 f32f4490d0c87a7854adf544bd459155 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/tools/tabularx.sty" 1400196978 6922 d73f54a1f22489be96930629013f1304 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omltxmi.fd" 1137111002 492 e7f8afe4428797548d4301de03a1b15f ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omstxr.fd" 1137111002 857 81ff640acbcd7da3dc30601847d7e35a ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omstxsy.fd" 1137111002 329 6ac7e19535b9f1d64e4d8e3f77dc30a3 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omxtxex.fd" 1137111002 312 11fe1916b0a13a81a05234a6fc7f8738 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/ot1txr.fd" 1137111002 1271 4e3afbd8e832f2f9c7f064894e6e68e4 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/txfonts.sty" 1206746551 50381 d367461010070c7a491b1f6979ab2062 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/utxexa.fd" 1137111002 310 1b00b0b05685b816e4c6caccce437e0d ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/url/url.sty" 1388531844 12796 8edb7d69a20b857904dd0ea757c14ec9 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/tex/latex/xcolor/xcolor.sty" 1169481954 55224 a43bab84e0ac5e6efcaf9a98bde73a94 ""
|
||||
"/usr/local/texlive/2014/texmf-dist/web2c/texmf.cnf" 1398200874 31722 4f52421e59a4b9e910cf18e64c1f2b4a ""
|
||||
"/usr/local/texlive/2014/texmf-var/web2c/pdftex/latex.fmt" 1401025988 3831950 412798929e0196806f9f91e131a01806 ""
|
||||
"/usr/local/texlive/2014/texmf.cnf" 1401025936 577 a59edbde8d3a8c549d0eeaab1739e2ff ""
|
||||
<<<<<<< HEAD
|
||||
"old-gantt.png" 1429057390 101185 f09f139493b49efd4a4a3b3fe455d710 ""
|
||||
"progress_report.aux" 1429057422 1054 1fb7c5c88c3fe5c21808963cf33f2978 ""
|
||||
"progress_report.out" 1429057422 236 3411de8a1192db7b41eeb11bf4c93fef ""
|
||||
"progress_report.tex" 1429057414 7263 ac2a94d16fa7d5564a6b25389d187b52 ""
|
||||
"progress_report.toc" 1429057417 0 d41d8cd98f00b204e9800998ecf8427e ""
|
||||
(generated)
|
||||
"progress_report.aux"
|
||||
"progress_report.log"
|
||||
"progress_report.out"
|
||||
"progress_report.toc"
|
||||
"progress_report.dvi"
|
||||
=======
|
||||
"old-gantt.jpg" 1429044440 24493 24188bdf4f5434787c664b216e3898f2 ""
|
||||
"progress_report.aux" 1429044500 1054 1fb7c5c88c3fe5c21808963cf33f2978 ""
|
||||
"progress_report.out" 1429044500 236 3411de8a1192db7b41eeb11bf4c93fef ""
|
||||
"progress_report.tex" 1429044508 7262 ec5dd8aff911c63e55f0b215ebc5fca1 ""
|
||||
"progress_report.toc" 1429044500 0 d41d8cd98f00b204e9800998ecf8427e ""
|
||||
(generated)
|
||||
"progress_report.dvi"
|
||||
"progress_report.out"
|
||||
"progress_report.toc"
|
||||
"progress_report.aux"
|
||||
"progress_report.log"
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
133
progress_report/progress_report.fls
Normal file
@@ -0,0 +1,133 @@
|
||||
PWD /Users/shyam/Dropbox/cdb/progress_report
|
||||
INPUT /usr/local/texlive/2014/texmf.cnf
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/web2c/texmf.cnf
|
||||
INPUT /usr/local/texlive/2014/texmf-var/web2c/pdftex/latex.fmt
|
||||
INPUT progress_report.tex
|
||||
OUTPUT progress_report.log
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/base/article.cls
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/base/article.cls
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/base/size11.clo
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/base/size11.clo
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/fonts/map/fontname/texfonts.map
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/fonts/map/fontname/texfonts.map
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/fonts/tfm/public/cm/cmr10.tfm
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/setspace/setspace.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/setspace/setspace.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/geometry/geometry.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/geometry/geometry.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/graphics/keyval.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/graphics/keyval.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ifpdf.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ifpdf.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ifvtex.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ifvtex.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/ifxetex/ifxetex.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/ifxetex/ifxetex.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/tools/tabularx.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/tools/tabularx.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/tools/array.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/tools/array.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/tocloft/tocloft.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/tocloft/tocloft.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/graphics/graphicx.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/graphics/graphicx.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/graphics/graphics.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/graphics/graphics.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/graphics/trig.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/graphics/trig.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/latexconfig/graphics.cfg
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/latexconfig/graphics.cfg
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/graphics/dvips.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/graphics/dvips.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/pdfpages/pdfpages.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/pdfpages/pdfpages.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/base/ifthen.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/base/ifthen.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/tools/calc.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/tools/calc.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/eso-pic/eso-pic.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/eso-pic/eso-pic.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/atbegshi.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/atbegshi.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/infwarerr.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/infwarerr.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/xcolor/xcolor.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/xcolor/xcolor.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/xcolor/xcolor.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/latexconfig/color.cfg
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/latexconfig/color.cfg
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/pdfpages/pppdftex.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/pdfpages/pppdftex.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/pdfpages/ppnull.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/pdfpages/ppnull.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/hyperref.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/hyperref.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/auxhook.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/auxhook.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/kvoptions.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/kvoptions.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/pd1enc.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/pd1enc.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/latexconfig/hyperref.cfg
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/latexconfig/hyperref.cfg
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/url/url.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/url/url.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/hdvips.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/hdvips.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/pdfmark.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/pdfmark.def
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/txfonts.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/txfonts.sty
|
||||
INPUT progress_report.aux
|
||||
INPUT progress_report.aux
|
||||
OUTPUT progress_report.aux
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omltxmi.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omltxmi.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omstxsy.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omstxsy.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omxtxex.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omxtxex.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/utxexa.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/utxexa.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/ot1txr.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/ot1txr.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/fonts/tfm/public/txfonts/txr.tfm
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/nameref.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/nameref.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/gettitlestring.sty
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/gettitlestring.sty
|
||||
INPUT progress_report.out
|
||||
INPUT progress_report.out
|
||||
INPUT progress_report.out
|
||||
INPUT progress_report.out
|
||||
INPUT ./progress_report.out
|
||||
INPUT ./progress_report.out
|
||||
OUTPUT progress_report.out
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/fonts/tfm/public/txfonts/txb.tfm
|
||||
OUTPUT progress_report.dvi
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/fonts/tfm/public/txfonts/txr.tfm
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/fonts/tfm/public/txfonts/txb.tfm
|
||||
INPUT progress_report.toc
|
||||
INPUT progress_report.toc
|
||||
OUTPUT progress_report.toc
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/fonts/tfm/public/txfonts/txr.tfm
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/fonts/tfm/public/txfonts/txb.tfm
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omstxr.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/tex/latex/txfonts/omstxr.fd
|
||||
INPUT /usr/local/texlive/2014/texmf-dist/fonts/tfm/public/txfonts/txsy.tfm
|
||||
<<<<<<< HEAD
|
||||
INPUT old-gantt.png
|
||||
INPUT old-gantt.png
|
||||
=======
|
||||
INPUT old-gantt.jpg
|
||||
INPUT old-gantt.jpg
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
19
progress_report/progress_report.out
Normal file
@@ -0,0 +1,19 @@
|
||||
\BOOKMARK [1][-]{section.1}{Overview}{}% 1
|
||||
\BOOKMARK [2][-]{subsection.1.1}{Purpose of the Report}{section.1}% 2
|
||||
\BOOKMARK [2][-]{subsection.1.2}{Purpose of the Project}{section.1}% 3
|
||||
\BOOKMARK [1][-]{section.2}{Literature Review}{}% 4
|
||||
<<<<<<< HEAD
|
||||
\BOOKMARK [1][-]{section.3}{Progress}{}% 5
|
||||
\BOOKMARK [2][-]{subsection.3.1}{Front End: Status}{section.3}% 6
|
||||
\BOOKMARK [2][-]{subsection.3.2}{Front End: Projections}{section.3}% 7
|
||||
\BOOKMARK [2][-]{subsection.3.3}{Back End: Status}{section.3}% 8
|
||||
\BOOKMARK [2][-]{subsection.3.4}{Back End: Projections}{section.3}% 9
|
||||
\BOOKMARK [2][-]{subsection.3.5}{Quantification of Progress}{section.3}% 10
|
||||
\BOOKMARK [1][-]{section.4}{Recommendations}{}% 11
|
||||
\BOOKMARK [2][-]{subsection.4.1}{Changes}{section.4}% 12
|
||||
\BOOKMARK [2][-]{subsection.4.2}{New Timeline}{section.4}% 13
|
||||
\BOOKMARK [2][-]{subsection.4.3}{Future Phases}{section.4}% 14
|
||||
\BOOKMARK [2][-]{subsection.4.4}{Redefined Goals}{section.4}% 15
|
||||
\BOOKMARK [1][-]{section.5}{Discussion}{}% 16
|
||||
=======
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
BIN
progress_report/progress_report.pdf
Normal file
259
progress_report/progress_report.tex
Normal file
@@ -0,0 +1,259 @@
|
||||
\documentclass[11pt]{article}
|
||||
|
||||
\usepackage{setspace}
|
||||
\usepackage[margin=1in]{geometry}
|
||||
|
||||
% Make table of contents look better
|
||||
\usepackage{tabularx}
|
||||
\usepackage{tocloft}
|
||||
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
|
||||
|
||||
\usepackage{graphicx}
|
||||
\usepackage{pdfpages}
|
||||
\usepackage{hyperref}
|
||||
|
||||
% \usepackage[ngerman]{babel}
|
||||
% \usepackage[T1]{fontenc}
|
||||
% \usepackage[ansinew]{inputenc}
|
||||
% \usepackage{lmodern}
|
||||
|
||||
% Times New Roman font
|
||||
\usepackage{txfonts}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\setlength{\parindent}{2em}
|
||||
|
||||
\begin{titlepage}
|
||||
\clearpage
|
||||
\thispagestyle{empty}
|
||||
|
||||
\begin{center}
|
||||
{\bf Technical Communication for Computer Scientists: 15-221}\\
|
||||
{\bf Spring 2015}\\
|
||||
|
||||
\vspace{25 mm}
|
||||
|
||||
{\bf Progress Report:}\\
|
||||
{\bf C0 Debugger}\\
|
||||
\vspace{25 mm}
|
||||
|
||||
Aaron Gutierrez\\
|
||||
Mitchell Plamann\\
|
||||
Shyam Raghavan\\
|
||||
Suhaas Reddy\\
|
||||
|
||||
\vspace{25 mm}
|
||||
|
||||
{\bf Submitted to}\\
|
||||
Thomas M. Keating\\
|
||||
Assistant Teaching Professor\\
|
||||
Computer Science Department\\
|
||||
School of Computer Science\\
|
||||
|
||||
\vspace{25 mm}
|
||||
|
||||
{\bf Prepared and Submitted by}\\
|
||||
Shyam Raghavan - April 14, 2015
|
||||
\end{center}
|
||||
\end{titlepage}
|
||||
|
||||
\pagenumbering{roman}
|
||||
\tableofcontents
|
||||
\newpage
|
||||
|
||||
\pagenumbering{arabic}
|
||||
|
||||
\section{Overview}
|
||||
\subsection{Purpose of the Report}
|
||||
This report serves as an update to the reader on the progress the c0db team has
|
||||
made on the C0 Debugger during the first month of work. The report will detail
|
||||
what has been accomplished so far, what is in progress, what is planned for the
|
||||
future, and any changes that will be made to the original plan of action. In
|
||||
addition, the report will detail new literature that has been gathered and
|
||||
used.
|
||||
\subsection{Purpose of the Project}
|
||||
The purpose of this project is to build a web application that can debug C0
|
||||
code and can aid in a student's understanding of fundamental computational
|
||||
models. This project will benefit students in 15-122 Principals of Imperative
|
||||
Computation at Carnegie Mellon University by helping them create correct
|
||||
programs. The C0 Debugger will enable students to understand how their programs
|
||||
execute and find where problems originate more easily than with existing tools.
|
||||
In addition to debugging, students will have better knowledge for how the
|
||||
underlying computation model works when evaluating their code.
|
||||
\par
|
||||
The C0 Debugger will also enable students to test simple programs with little
|
||||
setup, using only a web browser. They will no longer have to set up and become
|
||||
familiar with a Unix environment before they can program, making C0 accessible
|
||||
to more people, more quickly.
|
||||
\section{Literature Review}
|
||||
Since the start of our project, we have found multiple new information sources;
|
||||
the following are the most important ones.
|
||||
\begin{itemize}
|
||||
\item Nodeunit documentation \\
|
||||
https://github.com/caolan/nodeunit
|
||||
\par
|
||||
We are using nodeunit to test our virtual machine.
|
||||
Since the c0 bytecode has many different opcodes that it uses, it is very
|
||||
easy for mistakes in the virtual machine to go unnoticed.
|
||||
To prevent this, we are using the nodeunit library to write unit tests for
|
||||
our code.
|
||||
This has already helped us to find and solve multiple bugs in the VM, and
|
||||
having these unit tests will make sure that we can solve any bugs that
|
||||
occur as the result of future changes in the code.
|
||||
\item c0vm Assignment Handout \\
|
||||
https://www.cs.cmu.edu/~rjsimmon/15122-f14/prog/c0vm-writeup.pdf
|
||||
\par
|
||||
This document details how each opcode in the c0 bytecode language works,
|
||||
as well as other important implementation details for the c0 virtual
|
||||
machine. It has been an important reference while developing a JavaScript
|
||||
version of the c0 virtual machine.
|
||||
\item Common Gateway Interface Support Documentation \\
|
||||
https://docs.python.org/2/library/cgi.html
|
||||
\par
|
||||
This document explains the support module defined by Python 2.7.10 for
|
||||
common gateway interfaces. A common gateway interface script is usually
|
||||
invoked by a server to process user input submitted through an HTML
|
||||
element. This piece of documentation is an important reference for
|
||||
developing the flow of information from c0 code to c0 bytecode to a
|
||||
working virtual machine.
|
||||
\end{itemize}
|
||||
So far, the most important thing we have learned is that good unit tests are
|
||||
vital for developing this sort of project. Without unit tests that verify
|
||||
each opcode used by the virtual machine, many bugs would have gone unnoticed,
|
||||
causing problems later down the line. If we only found these bugs by using
|
||||
the frontend, they would have been much harder to debug, as there would have
|
||||
been much more code to work through.
|
||||
\section{Progress}
|
||||
<<<<<<< HEAD
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{old-gantt.png}
|
||||
\caption{Old Project Gantt Chart}
|
||||
\label{fig:old-gantt}
|
||||
\end{figure}
|
||||
We are nearing completion on the virtual machine upon which the debugger will
|
||||
run. Moving forward, the front end team will polish the existing interface, and
|
||||
expand it to control the debugger. The back end team will work on the core
|
||||
functionality of the debugger and continue to fix bugs with the virtual machine.
|
||||
This places us two weeks behind schedule over all, as we planned to have the
|
||||
virtual machine finished by April 1\textsuperscript{st}.
|
||||
\subsection{Front End: Status}
|
||||
The front end team is keeping pace with the back end team, but is still two
|
||||
weeks behind schedule. We have a working interface where users can input,
|
||||
compile, and run C0 programs, but there are no debugging features.
|
||||
\subsection{Front End: Projections}
|
||||
We will modify our schedule to allow more time for the work on the debugger.
|
||||
This time will come from a shortened user testing and revision period. That
|
||||
said, because of our thorough work on the virtual machine, implementing the
|
||||
debugger should progress more rapidly than originally planned. The modified
|
||||
schedule is depicted in our updated Gannt chart (Figure 2, below).
|
||||
\subsection{Back End: Status}
|
||||
The back end team is also two weeks behind schedule. The virtual machine, along
|
||||
with most library functions needed to run programs, is complete and working
|
||||
well. The team has started working on stepping through program execution, but
|
||||
those features have not yet been incorporated with the rest of the application.
|
||||
\subsection{Back End: Projections}
|
||||
In the coming time, the back end team will implement the remaining library
|
||||
functions, then transition all of their efforts to the debugging features. Like
|
||||
the front end team, this transition was originally scheduled for
|
||||
April\textsuperscript{st}, but will now occur in the next week.
|
||||
\par
|
||||
\begin{figure}[h]
|
||||
\includegraphics[width=\linewidth]{new-gantt.png}
|
||||
\caption{New Project Gantt Chart}
|
||||
\label{fig:new-gantt}
|
||||
\end{figure}
|
||||
Our revised Gannt chart features two key changes. The back end and front end
|
||||
sections were modified such that the transition of effort from the virtual
|
||||
machine to the debugger aligns with where that actually happened. As a result,
|
||||
the testing and revision section was push back. We are now aiming to start
|
||||
testing and revision the week of April 20\textsuperscript{th}.
|
||||
\subsection{Quantification of Progress}
|
||||
Currently, we have over 50 test files that we use to check for correctness of
|
||||
our virtual machine. We currently pass 44 test cases, and are working to have
|
||||
the rest functioning correctly soon. Once the debugger is more feature complete,
|
||||
we will focus more on user feedback to assess progress.
|
||||
\section{Recommendations}
|
||||
\subsection{Changes}
|
||||
There are three major changes to the project plan: the frontend and backend
|
||||
deadlines have moved back several days, the user testing and revisions period
|
||||
have shifted back accordingly and have shortened, and the frontend goal
|
||||
categories have been redefined. These changes can be identified in the above
|
||||
Gantt charts by in shifts in the bars of the Gantt chart. The development bars
|
||||
have increased in relative size while the testing and revising bars have shrunk.
|
||||
\subsection{New Timeline}
|
||||
=======
|
||||
\section{Recommendations}
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{old-gantt.jpg}
|
||||
\caption{Old Project Gantt Chart}
|
||||
\label{fig:old-gantt}
|
||||
\end{figure}
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{new-gantt.jpg}
|
||||
\caption{New Project Gantt Chart}
|
||||
\label{fig:new-gantt}
|
||||
\end{figure}
|
||||
There are three major changes to the project plan: the frontend and backend
|
||||
deadlines have moved back several days, the user testing and revisions period
|
||||
have shifted back accordingly and have shortened, the frontend goal categories
|
||||
have been redefined. These changes can be identified in the above Gantt charts
|
||||
by in shifts in the bars of the Gantt chart. The development bars have
|
||||
increased in relative size while the testing and revising bars have shrunk.
|
||||
\par
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
The frontend and backend periods needed to shift backwards simply due to the
|
||||
group’s initial underestimation of the amount of time required to create a
|
||||
reasonable product. The team believes additional development time on the
|
||||
backend and frontend until the 20th of April will enable the creation of a high
|
||||
quality product with a robust user interface and powerful c0 virtual machine.
|
||||
Without this pushback the team currently has a working prototype with a basic
|
||||
user interface and native function calls implemented, but the project has yet
|
||||
to include several important features considered necessary for useful
|
||||
application by students.
|
||||
<<<<<<< HEAD
|
||||
\subsection{Future Phases}
|
||||
=======
|
||||
\par
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
The user testing and adjustments periods have shrunk due to the increased
|
||||
development time. The team decided to avoid user testing and adjustments during
|
||||
the main development phase, but due to the time pressure this caused the
|
||||
testing and adjustment phases to shrink by several days each and overlap
|
||||
significantly. The team hopes to consistently implement changes as students
|
||||
provide feedback so that the overlap still provides time to implement
|
||||
suggestions.
|
||||
<<<<<<< HEAD
|
||||
\subsection{Redefined Goals}
|
||||
=======
|
||||
\par
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
The redefined goals within the frontend category reflect altered priorities of
|
||||
the project as a whole. Rather than having the project work to explain topics
|
||||
to the user, the project will be designed to simply run user code and step
|
||||
through user code with the assumption that the user already understands how to
|
||||
use the program. The instructors of 15-122 have already been informed of c0db,
|
||||
so hopefully the TAs of the course could provide their students with brief
|
||||
tutorials for c0db and its uses. This shift away from explanation allows the
|
||||
team to focus more on providing user interface features which will more
|
||||
directly aid in student code development. These features include code stepping
|
||||
and highlighting as well as annotated bytecode as listed in the Gantt chart
|
||||
above.
|
||||
<<<<<<< HEAD
|
||||
\section{Discussion}
|
||||
These changes provide for a more accurate description of the timeline and the
|
||||
remaining work to be accomplished before the deatline. The team believes that
|
||||
this project still has a high likelihood of being completed, and this will
|
||||
allow for the Fall 2015 students of 15-122 being able to better understand
|
||||
and use C0. We also feel that these changes, in the long run, will lead to a
|
||||
better, more polished product. While our deliverables do not change, the focus
|
||||
of the product team has changed to avoid user testing and adjustments during
|
||||
the development phase and consistently implement changes as students provide
|
||||
feedback. In the long run, the team believes that we will accomplish the final
|
||||
product in the timeline specified.
|
||||
=======
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
\end{document}
|
||||
30
progress_report/progress_report.tex.project.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
" ATP project vim script: Tue Apr 14, 2015 at 02:37 PM -0400.
|
||||
|
||||
let b:atp_MainFile = 'progress_report.tex'
|
||||
let g:atp_mapNn = 0
|
||||
let b:atp_autex = 1
|
||||
let b:atp_TexCompiler = 'pdftex'
|
||||
let b:atp_TexOptions = '-synctex=1'
|
||||
<<<<<<< HEAD
|
||||
let b:atp_TexFlavor = 'tex'
|
||||
=======
|
||||
let b:atp_TexFlavor = 'plaintex'
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
let b:atp_auruns = '1'
|
||||
let b:atp_ReloadOnError = '1'
|
||||
let b:atp_OutDir = '/Users/shyam/Dropbox/cdb/progress_report'
|
||||
let b:atp_OpenViewer = '1'
|
||||
let b:atp_XpdfServer = 'progress_report'
|
||||
let b:atp_Viewer = 'okular'
|
||||
let b:TreeOfFiles = {}
|
||||
let b:ListOfFiles = []
|
||||
let b:TypeDict = {}
|
||||
let b:LevelDict = {}
|
||||
let b:atp_BibCompiler = 'bibtex'
|
||||
let b:atp_StarEnvDefault = ''
|
||||
let b:atp_StarMathEnvDefault = ''
|
||||
let b:atp_updatetime_insert = 4000
|
||||
let b:atp_updatetime_normal = 2000
|
||||
let b:atp_LocalCommands = []
|
||||
let b:atp_LocalEnvironments = []
|
||||
let b:atp_LocalColors = []
|
||||
47
progress_report/progress_report_aux
Normal file
@@ -0,0 +1,47 @@
|
||||
\relax
|
||||
\providecommand\hyper@newdestlabel[2]{}
|
||||
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
|
||||
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
|
||||
\global\let\oldcontentsline\contentsline
|
||||
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
|
||||
\global\let\oldnewlabel\newlabel
|
||||
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
|
||||
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
|
||||
\AtEndDocument{\ifx\hyper@anchor\@undefined
|
||||
\let\contentsline\oldcontentsline
|
||||
\let\newlabel\oldnewlabel
|
||||
\fi}
|
||||
\fi}
|
||||
\global\let\hyper@last\relax
|
||||
\gdef\HyperFirstAtBeginDocument#1{#1}
|
||||
<<<<<<< HEAD
|
||||
\providecommand\HyField@AuxAddToFields[1]{}
|
||||
\providecommand\HyField@AuxAddToCoFields[2]{}
|
||||
=======
|
||||
\providecommand*\HyPL@Entry[1]{}
|
||||
\HyPL@Entry{0<</S/D>>}
|
||||
\HyPL@Entry{1<</S/r>>}
|
||||
\HyPL@Entry{2<</S/D>>}
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}{section.1}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Purpose of the Report}{1}{subsection.1.1}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Purpose of the Project}{1}{subsection.1.2}}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Literature Review}{1}{section.2}}
|
||||
<<<<<<< HEAD
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {3}Progress}{2}{section.3}}
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Old Project Gantt Chart}}{2}{figure.1}}
|
||||
\newlabel{fig:old-gantt}{{1}{2}{Old Project Gantt Chart}{figure.1}{}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.1}Front End: Status}{2}{subsection.3.1}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.2}Front End: Projections}{2}{subsection.3.2}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.3}Back End: Status}{3}{subsection.3.3}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.4}Back End: Projections}{3}{subsection.3.4}}
|
||||
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces New Project Gantt Chart}}{3}{figure.2}}
|
||||
\newlabel{fig:new-gantt}{{2}{3}{New Project Gantt Chart}{figure.2}{}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.5}Quantification of Progress}{3}{subsection.3.5}}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {4}Recommendations}{4}{section.4}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}Changes}{4}{subsection.4.1}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}New Timeline}{4}{subsection.4.2}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {4.3}Future Phases}{4}{subsection.4.3}}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {4.4}Redefined Goals}{4}{subsection.4.4}}
|
||||
=======
|
||||
>>>>>>> ff581d8a8ce9932bf474596368f94b00770b98d9
|
||||
26
proposal/proposal.tex.project.vim
Normal file
@@ -0,0 +1,26 @@
|
||||
" ATP project vim script: Tue Apr 14, 2015 at 02:43 PM -0400.
|
||||
|
||||
let b:atp_MainFile = 'proposal.tex'
|
||||
let g:atp_mapNn = 0
|
||||
let b:atp_autex = 1
|
||||
let b:atp_TexCompiler = 'pdflatex'
|
||||
let b:atp_TexOptions = '-synctex=1'
|
||||
let b:atp_TexFlavor = 'tex'
|
||||
let b:atp_auruns = '1'
|
||||
let b:atp_ReloadOnError = '1'
|
||||
let b:atp_OutDir = '/Users/shyam/Dropbox/cdb/proposal'
|
||||
let b:atp_OpenViewer = '1'
|
||||
let b:atp_XpdfServer = 'proposal'
|
||||
let b:atp_Viewer = 'okular'
|
||||
let b:TreeOfFiles = {}
|
||||
let b:ListOfFiles = []
|
||||
let b:TypeDict = {}
|
||||
let b:LevelDict = {}
|
||||
let b:atp_BibCompiler = 'bibtex'
|
||||
let b:atp_StarEnvDefault = ''
|
||||
let b:atp_StarMathEnvDefault = ''
|
||||
let b:atp_updatetime_insert = 4000
|
||||
let b:atp_updatetime_normal = 2000
|
||||
let b:atp_LocalCommands = []
|
||||
let b:atp_LocalEnvironments = []
|
||||
let b:atp_LocalColors = []
|
||||
@@ -4,6 +4,8 @@
|
||||
border-radius: 4px;
|
||||
padding: 4px;
|
||||
border-color: #ddd;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.brad {
|
||||
@@ -28,5 +30,6 @@ nav {
|
||||
}
|
||||
|
||||
.btm-btn {
|
||||
margin-top: 4px;
|
||||
margin-bottom: 4px;
|
||||
margin-top: -14px;
|
||||
}
|
||||
|
||||
4
public/vm/Makefile
Normal file
@@ -0,0 +1,4 @@
|
||||
FILES = c0vm.js bytecode-parser.js byte-stream.js opcodes.js index.js
|
||||
|
||||
all: $(FILES)
|
||||
browserify $(FILES) -o vm.js
|
||||
@@ -24,7 +24,7 @@ ByteStream.prototype.get_u4 = function() {
|
||||
ByteStream.prototype.get_i4 = function() {
|
||||
var unsigned_val = this.get_u4();
|
||||
var sign_mult = (unsigned_val & 0x80000000) ? -1 : 1;
|
||||
return (unsigned_val & 0x7FFFFFFF) * sign_mult;
|
||||
return (unsigned_val & 0x7FFFFFFF) + (unsigned_val & 0x80000000);
|
||||
}
|
||||
|
||||
ByteStream.prototype.get_bytes = function(n) {
|
||||
@@ -2,7 +2,9 @@ fs = require("fs");
|
||||
byte_stream = require("./byte-stream");
|
||||
|
||||
// This is a simple, kinda hacky bytecode parser for .bc0 files
|
||||
function getBytes(filename) {
|
||||
// Now takes in raw bytecode
|
||||
function getBytes(data) {
|
||||
/*
|
||||
var data = fs.readFileSync(filename);
|
||||
|
||||
if (data == null) {
|
||||
@@ -12,9 +14,11 @@ function getBytes(filename) {
|
||||
console.log("Error: " + err);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
// Data contains our file, but we want it as a string
|
||||
var string_data = data.toString();
|
||||
console.log(string_data);
|
||||
|
||||
// Strip all the comments for easier parsing
|
||||
var without_comments = string_data.replace(new RegExp("#.*", "gi"), "");
|
||||
@@ -29,6 +33,7 @@ function getBytes(filename) {
|
||||
});
|
||||
|
||||
// We now have an array of bytes. That's probably everything we need, right?
|
||||
console.log(bytes);
|
||||
return bytes;
|
||||
|
||||
}
|
||||
@@ -72,10 +77,11 @@ var Bc0File = function (filename) {
|
||||
for (var i = 0; i < this.string_count; i++) {
|
||||
var c = stream.get_u1();
|
||||
if (c == 0) {
|
||||
this.string_pool.push(current_string);
|
||||
current_string = "";
|
||||
// this.string_pool.push(current_string);
|
||||
// current_string = "";
|
||||
this.string_pool.push(0);
|
||||
} else {
|
||||
current_string += String.fromCharCode(c);
|
||||
this.string_pool.push(String.fromCharCode(c));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +99,15 @@ var Bc0File = function (filename) {
|
||||
}
|
||||
}
|
||||
|
||||
Bc0File.prototype.string_from_index = function (i) {
|
||||
var result = "";
|
||||
while (this.string_pool[i] !== 0 && i < this.string_pool.length) {
|
||||
result += this.string_pool[i];
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function parse(filename) {
|
||||
return new Bc0File(filename);
|
||||
}
|
||||
110
public/vm/c0ffi.js
Normal file
@@ -0,0 +1,110 @@
|
||||
exports.NATIVE_FADD = 0
|
||||
exports.NATIVE_FDIV = 1
|
||||
exports.NATIVE_FLESS = 2
|
||||
exports.NATIVE_FMUL = 3
|
||||
exports.NATIVE_FSUB = 4
|
||||
exports.NATIVE_FTOI = 5
|
||||
exports.NATIVE_ITOF = 6
|
||||
exports.NATIVE_PRINT_FPT = 7
|
||||
exports.NATIVE_PRINT_HEX = 8
|
||||
exports.NATIVE_PRINT_INT = 9
|
||||
|
||||
/* args */
|
||||
exports.NATIVE_ARGS_FLAG = 10
|
||||
exports.NATIVE_ARGS_INT = 11
|
||||
exports.NATIVE_ARGS_PARSE = 12
|
||||
exports.NATIVE_ARGS_STRING = 13
|
||||
|
||||
/* conio */
|
||||
exports.NATIVE_EOF = 14
|
||||
exports.NATIVE_FLUSH = 15
|
||||
exports.NATIVE_PRINT = 16
|
||||
exports.NATIVE_PRINTBOOL = 17
|
||||
exports.NATIVE_PRINTCHAR = 18
|
||||
exports.NATIVE_PRINTINT = 19
|
||||
exports.NATIVE_PRINTLN = 20
|
||||
exports.NATIVE_READLINE = 21
|
||||
|
||||
/* curses */
|
||||
exports.NATIVE_C_ADDCH = 22
|
||||
exports.NATIVE_C_CBREAK = 23
|
||||
exports.NATIVE_C_CURS_SET = 24
|
||||
exports.NATIVE_C_DELCH = 25
|
||||
exports.NATIVE_C_ENDWIN = 26
|
||||
exports.NATIVE_C_ERASE = 27
|
||||
exports.NATIVE_C_GETCH = 28
|
||||
exports.NATIVE_C_INITSCR = 29
|
||||
exports.NATIVE_C_KEYPAD = 30
|
||||
exports.NATIVE_C_MOVE = 31
|
||||
exports.NATIVE_C_NOECHO = 32
|
||||
exports.NATIVE_C_REFRESH = 33
|
||||
exports.NATIVE_C_SUBWIN = 34
|
||||
exports.NATIVE_C_WADDCH = 35
|
||||
exports.NATIVE_C_WADDSTR = 36
|
||||
exports.NATIVE_C_WCLEAR = 37
|
||||
exports.NATIVE_C_WERASE = 38
|
||||
exports.NATIVE_C_WMOVE = 39
|
||||
exports.NATIVE_C_WREFRESH = 40
|
||||
exports.NATIVE_C_WSTANDEND = 41
|
||||
exports.NATIVE_C_WSTANDOUT = 42
|
||||
exports.NATIVE_CC_GETBEGX = 43
|
||||
exports.NATIVE_CC_GETBEGY = 44
|
||||
exports.NATIVE_CC_GETMAXX = 45
|
||||
exports.NATIVE_CC_GETMAXY = 46
|
||||
exports.NATIVE_CC_GETX = 47
|
||||
exports.NATIVE_CC_GETY = 48
|
||||
exports.NATIVE_CC_HIGHLIGHT = 49
|
||||
exports.NATIVE_CC_KEY_IS_BACKSPACE = 50
|
||||
exports.NATIVE_CC_KEY_IS_DOWN = 51
|
||||
exports.NATIVE_CC_KEY_IS_ENTER = 52
|
||||
exports.NATIVE_CC_KEY_IS_LEFT = 53
|
||||
exports.NATIVE_CC_KEY_IS_RIGHT = 54
|
||||
exports.NATIVE_CC_KEY_IS_UP = 55
|
||||
exports.NATIVE_CC_WBOLDOFF = 56
|
||||
exports.NATIVE_CC_WBOLDON = 57
|
||||
exports.NATIVE_CC_WDIMOFF = 58
|
||||
exports.NATIVE_CC_WDIMON = 59
|
||||
exports.NATIVE_CC_WREVERSEOFF = 60
|
||||
exports.NATIVE_CC_WREVERSEON = 61
|
||||
exports.NATIVE_CC_WUNDEROFF = 62
|
||||
exports.NATIVE_CC_WUNDERON = 63
|
||||
|
||||
/* file */
|
||||
exports.NATIVE_FILE_CLOSE = 64
|
||||
exports.NATIVE_FILE_CLOSED = 65
|
||||
exports.NATIVE_FILE_EOF = 66
|
||||
exports.NATIVE_FILE_READ = 67
|
||||
exports.NATIVE_FILE_READLINE = 68
|
||||
|
||||
/* img */
|
||||
exports.NATIVE_IMAGE_CLONE = 69
|
||||
exports.NATIVE_IMAGE_CREATE = 70
|
||||
exports.NATIVE_IMAGE_DATA = 71
|
||||
exports.NATIVE_IMAGE_DESTROY = 72
|
||||
exports.NATIVE_IMAGE_HEIGHT = 73
|
||||
exports.NATIVE_IMAGE_LOAD = 74
|
||||
exports.NATIVE_IMAGE_SAVE = 75
|
||||
exports.NATIVE_IMAGE_SUBIMAGE = 76
|
||||
exports.NATIVE_IMAGE_WIDTH = 77
|
||||
|
||||
/* parse */
|
||||
exports.NATIVE_PARSE_BOOL = 78
|
||||
exports.NATIVE_PARSE_INT = 79
|
||||
|
||||
/* string */
|
||||
exports.NATIVE_CHAR_CHR = 80
|
||||
exports.NATIVE_CHAR_ORD = 81
|
||||
exports.NATIVE_STRING_CHARAT = 82
|
||||
exports.NATIVE_STRING_COMPARE = 83
|
||||
exports.NATIVE_STRING_EQUAL = 84
|
||||
exports.NATIVE_STRING_FROM_CHARARRAY = 85
|
||||
exports.NATIVE_STRING_FROMBOOL = 86
|
||||
exports.NATIVE_STRING_FROMCHAR = 87
|
||||
exports.NATIVE_STRING_FROMINT = 88
|
||||
exports.NATIVE_STRING_JOIN = 89
|
||||
exports.NATIVE_STRING_LENGTH = 90
|
||||
exports.NATIVE_STRING_SUB = 91
|
||||
exports.NATIVE_STRING_TERMINATED = 92
|
||||
exports.NATIVE_STRING_TO_CHARARRAY = 93
|
||||
exports.NATIVE_STRING_TOLOWER = 94
|
||||
|
||||
@@ -16,12 +16,18 @@ function c0_memory_error(val) {
|
||||
throw ("c0 memory error: " + val);
|
||||
}
|
||||
|
||||
function num_to_i32(num) {
|
||||
log("num is 0x" + num.toString(16));
|
||||
log("num & 0x7FFFFFFF is " + (num & 0x7FFFFFFF));
|
||||
log("neg factor is " + ( (num & 0x80000000)));
|
||||
return (num & 0x7FFFFFFF) + ((num & 0x80000000));
|
||||
}
|
||||
|
||||
function i32_to_array(i32) {
|
||||
return [(i32 & 0xFF),
|
||||
((i32 >> 8) & 0xFF),
|
||||
((i32 >> 16) & 0xFF),
|
||||
((i32 >> 24) & 0xFF)];
|
||||
|
||||
}
|
||||
|
||||
function array_to_i32(array) {
|
||||
@@ -56,13 +62,13 @@ var ProgramState = function(parsed_file, callback_dict) {
|
||||
try {
|
||||
this.natives[i] = callback_dict[i];
|
||||
} catch (key_not_found) {
|
||||
dict[i] = function (arg) {
|
||||
this.natives[i] = function (arg) {
|
||||
console.log("Native function " + name + " called, ran method stub.");
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Memory is just a big array of bytes, right?
|
||||
// "Allocation" is appending onto this array
|
||||
// A pointer to memory is an index into this array.
|
||||
@@ -78,6 +84,8 @@ ProgramState.prototype.push = function(val) {
|
||||
}
|
||||
|
||||
ProgramState.prototype.pop = function() {
|
||||
if (this.frame.stack === [])
|
||||
throw "Tried to pop from an empty stack!";
|
||||
return this.frame.stack.pop();
|
||||
}
|
||||
|
||||
@@ -129,7 +137,7 @@ ProgramState.prototype.step = function() {
|
||||
case op.BIPUSH:
|
||||
this.frame.pc += 2;
|
||||
var val = this.frame.program[this.frame.pc-1];
|
||||
|
||||
|
||||
// Do sign extension if necessary
|
||||
if ((val & 0x80) != 0)
|
||||
val = -0x80 + (val & 0x7F);
|
||||
@@ -152,19 +160,20 @@ ProgramState.prototype.step = function() {
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
log("Adding " + x + " and " + y);
|
||||
this.push((x+y) % 0x100000000);
|
||||
this.push(num_to_i32(x+y));
|
||||
break;
|
||||
case op.ISUB:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
this.push((x-y) % 0x100000000);
|
||||
log("Subtracting " + x + " and " + y);
|
||||
this.push(num_to_i32(x-y));
|
||||
break;
|
||||
case op.IMUL:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
this.push((x*y) % 0x100000000);
|
||||
this.push(num_to_i32(x*y));
|
||||
break;
|
||||
case op.IDIV:
|
||||
this.frame.pc++;
|
||||
@@ -229,7 +238,9 @@ ProgramState.prototype.step = function() {
|
||||
case op.VSTORE:
|
||||
this.frame.pc += 2;
|
||||
var index = this.frame.program[this.frame.pc-1];
|
||||
this.frame.variables[index] = this.pop();
|
||||
var val = this.pop();
|
||||
this.frame.variables[index] = val;
|
||||
log("Set variable " + index + " to value " + val);
|
||||
break;
|
||||
case op.ACONST_NULL:
|
||||
this.frame.pc++;
|
||||
@@ -249,7 +260,7 @@ ProgramState.prototype.step = function() {
|
||||
var c2 = this.frame.program[this.frame.pc-1];
|
||||
var index = (c1 * 0x1000) + c2;
|
||||
|
||||
this.push(this.file.string_pool[index]);
|
||||
this.push(this.file.string_from_index(index));
|
||||
break;
|
||||
|
||||
// Control flow
|
||||
@@ -328,6 +339,8 @@ ProgramState.prototype.step = function() {
|
||||
};
|
||||
console.log("Unknown native function index " + f.function_table_index);
|
||||
}
|
||||
log("Calling native function with index " + index + " with arguments " +
|
||||
arg_array);
|
||||
this.push(native_function(arg_array));
|
||||
break;
|
||||
|
||||
@@ -338,7 +351,7 @@ ProgramState.prototype.step = function() {
|
||||
var address = this.heap.length;
|
||||
|
||||
for (var i = 0; i < size; i++) this.heap.push(0);
|
||||
|
||||
|
||||
this.push(address);
|
||||
this.frame.pc += 2;
|
||||
break;
|
||||
@@ -351,7 +364,7 @@ ProgramState.prototype.step = function() {
|
||||
|
||||
this.heap.push(num_elements);
|
||||
this.heap.push(size);
|
||||
|
||||
|
||||
for (var i = 0; i < num_elements; i++) {
|
||||
for (var j = 0; j < size; j++)
|
||||
this.heap.push(0);
|
||||
@@ -372,7 +385,7 @@ ProgramState.prototype.step = function() {
|
||||
// Read offset into a struct
|
||||
var offset = this.frame.program[this.frame.pc + 1];
|
||||
var index = this.pop();
|
||||
this.push(this.heap[index + offset]);
|
||||
this.push(index + offset);
|
||||
this.frame.pc += 2;
|
||||
break;
|
||||
|
||||
@@ -380,10 +393,16 @@ ProgramState.prototype.step = function() {
|
||||
// Read offset into an array
|
||||
var elt_index = this.pop();
|
||||
var index = this.pop();
|
||||
var array_length = this.heap[index];
|
||||
var elt_size = this.heap[index+1];
|
||||
if (elt_index >= array_length) c0_memory_error("Array index out of bounds.");
|
||||
this.push(this.heap[index + 2 + elt_size*elt_index]);
|
||||
|
||||
if (typeof index == "string") {
|
||||
this.push(index.slice(elt_index));
|
||||
} else {
|
||||
var array_length = this.heap[index];
|
||||
var elt_size = this.heap[index+1];
|
||||
if (elt_index >= array_length)
|
||||
c0_memory_error("Array index out of bounds.");
|
||||
this.push(index + 2 + (elt_size*elt_index));
|
||||
}
|
||||
this.frame.pc++;
|
||||
break;
|
||||
|
||||
@@ -407,6 +426,7 @@ ProgramState.prototype.step = function() {
|
||||
for (var i = 0; i < 4; i++)
|
||||
this.heap[addr + i] = array[i];
|
||||
this.frame.pc++;
|
||||
break;
|
||||
|
||||
case op.AMLOAD:
|
||||
var addr = this.pop();
|
||||
@@ -423,7 +443,10 @@ ProgramState.prototype.step = function() {
|
||||
|
||||
case op.CMLOAD:
|
||||
var addr = this.pop();
|
||||
this.push(this.heap[addr]);
|
||||
if (typeof addr == "string")
|
||||
this.push(addr);
|
||||
else
|
||||
this.push(this.heap[addr]);
|
||||
this.frame.pc++;
|
||||
break;
|
||||
|
||||
@@ -454,17 +477,29 @@ function execute(file, callbacks, v) {
|
||||
|
||||
var state = new ProgramState(file, callbacks);
|
||||
|
||||
if (verbose) log(file);
|
||||
|
||||
log("Beginning execution");
|
||||
|
||||
|
||||
while (true) {
|
||||
var val = state.step();
|
||||
if (val !== undefined) return val;
|
||||
|
||||
if (verbose) {
|
||||
console.log("Machine state:");
|
||||
console.log(" Current Stack Frame:");
|
||||
console.log(" Stack: " + state.frame.stack);
|
||||
console.log(" PC: " + state.frame.pc);
|
||||
console.log(" Vars: " + state.frame.variables);
|
||||
// console.log(" Code: " + state.frame.program);
|
||||
console.log(" Heap: " + state.heap);
|
||||
}
|
||||
|
||||
// if (at_breakpoint) {
|
||||
// save state (maybe in a global in this file?)
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.execute = execute;
|
||||
@@ -10,16 +10,30 @@ c0ffi = require("./c0ffi.js");
|
||||
// console.log(file);
|
||||
// console.log(file.function_pool[0].code);
|
||||
|
||||
// UI interaction functions
|
||||
|
||||
function print(arg) {
|
||||
$("#output").append(arg);
|
||||
}
|
||||
|
||||
callbacks = {};
|
||||
callbacks[c0ffi.NATIVE_PRINT] = function(args) {
|
||||
console.log("Print function says: " + args[0]);
|
||||
print(args[0]);
|
||||
print("<br />");
|
||||
return 0;
|
||||
}
|
||||
|
||||
callbacks[c0ffi.NATIVE_PRINTINT] = function(args) {
|
||||
console.log("Printint function says: " + args[0]);
|
||||
print(args[0]);
|
||||
print("<br />");
|
||||
return 0;
|
||||
}
|
||||
|
||||
console.log(callbacks);
|
||||
|
||||
var file = parser.parse("../test/structs.c0.bc0");
|
||||
console.log("Result is " + c0vm.execute(file, callbacks));
|
||||
|
||||
$("#run").click(function() {
|
||||
var input = $("#bytecode").html().replace(/(\r\n|\n|\r)/gm,"");
|
||||
var file = parser.parse($("#bytecode").text());
|
||||
print("<br />");
|
||||
print(c0vm.execute(file, callbacks));
|
||||
});
|
||||
929
public/vm/vm.js
Normal file
@@ -0,0 +1,929 @@
|
||||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
var ByteStream = function (byte_array) {
|
||||
this.byte_array = byte_array;
|
||||
this.index = 0;
|
||||
};
|
||||
|
||||
ByteStream.prototype.get_u1 = function() {
|
||||
var result = this.byte_array[this.index];
|
||||
this.index += 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
ByteStream.prototype.get_u2 = function() {
|
||||
var high = this.get_u1();
|
||||
var low = this.get_u1();
|
||||
return (high << 8) + low;
|
||||
}
|
||||
|
||||
ByteStream.prototype.get_u4 = function() {
|
||||
var high = this.get_u2();
|
||||
var low = this.get_u2();
|
||||
return (high * 0x10000) + low;
|
||||
}
|
||||
|
||||
ByteStream.prototype.get_i4 = function() {
|
||||
var unsigned_val = this.get_u4();
|
||||
var sign_mult = (unsigned_val & 0x80000000) ? -1 : 1;
|
||||
return (unsigned_val & 0x7FFFFFFF) + (unsigned_val & 0x80000000);
|
||||
}
|
||||
|
||||
ByteStream.prototype.get_bytes = function(n) {
|
||||
var result = [];
|
||||
for (var i = 0; i < n; i++) {
|
||||
result.push(this.get_u1());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
exports.ByteStream = ByteStream;
|
||||
|
||||
},{}],2:[function(require,module,exports){
|
||||
fs = require("fs");
|
||||
byte_stream = require("./byte-stream");
|
||||
|
||||
// This is a simple, kinda hacky bytecode parser for .bc0 files
|
||||
// Now takes in raw bytecode
|
||||
function getBytes(data) {
|
||||
/*
|
||||
var data = fs.readFileSync(filename);
|
||||
|
||||
if (data == null) {
|
||||
if (err["code"] === "ENOENT")
|
||||
console.log("Error: file " + filename + " does not exist.");
|
||||
else
|
||||
console.log("Error: " + err);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
// Data contains our file, but we want it as a string
|
||||
var string_data = data.toString();
|
||||
console.log(string_data);
|
||||
|
||||
// Strip all the comments for easier parsing
|
||||
var without_comments = string_data.replace(new RegExp("#.*", "gi"), "");
|
||||
|
||||
// Each byte should now be a pair of two hex digits.
|
||||
// Put all these in an array.
|
||||
var bytes = [];
|
||||
without_comments.replace(
|
||||
new RegExp("([0123456789ABCDEF][0123456789ABCDEF])", "gi"),
|
||||
function(next_byte) {
|
||||
bytes.push(parseInt(next_byte, 16));
|
||||
});
|
||||
|
||||
// We now have an array of bytes. That's probably everything we need, right?
|
||||
console.log(bytes);
|
||||
return bytes;
|
||||
|
||||
}
|
||||
|
||||
var FunctionInfo = function (stream) {
|
||||
this.num_args = stream.get_u2();
|
||||
this.num_vars = stream.get_u2();
|
||||
this.code_length = stream.get_u2();
|
||||
this.code = stream.get_bytes(this.code_length);
|
||||
}
|
||||
|
||||
var NativeInfo = function (stream) {
|
||||
this.num_args = stream.get_u2();
|
||||
this.function_table_index = stream.get_u2();
|
||||
}
|
||||
|
||||
var Bc0File = function (filename) {
|
||||
var file = getBytes(filename);
|
||||
var stream = new byte_stream.ByteStream(file);
|
||||
|
||||
var magic = stream.get_u4();
|
||||
if (magic != 0xc0c0ffee) {
|
||||
console.log("Error - file is not a c0 bytecode file");
|
||||
return null;
|
||||
}
|
||||
|
||||
// I don't know that we need this, but here it is
|
||||
this.version_arch = stream.get_u2();
|
||||
|
||||
this.int_count = stream.get_u2();
|
||||
|
||||
this.int_pool = [];
|
||||
for (var i = 0; i < this.int_count; i++) {
|
||||
this.int_pool[i] = stream.get_i4();
|
||||
}
|
||||
|
||||
this.string_count = stream.get_u2();
|
||||
|
||||
this.string_pool = [];
|
||||
var current_string = "";
|
||||
for (var i = 0; i < this.string_count; i++) {
|
||||
var c = stream.get_u1();
|
||||
if (c == 0) {
|
||||
// this.string_pool.push(current_string);
|
||||
// current_string = "";
|
||||
this.string_pool.push(0);
|
||||
} else {
|
||||
this.string_pool.push(String.fromCharCode(c));
|
||||
}
|
||||
}
|
||||
|
||||
this.function_count = stream.get_u2();
|
||||
|
||||
this.function_pool = [];
|
||||
for (var i = 0; i < this.function_count; i++) {
|
||||
this.function_pool.push(new FunctionInfo(stream));
|
||||
}
|
||||
|
||||
this.native_count = stream.get_u2();
|
||||
this.native_pool = [];
|
||||
for (var i = 0; i < this.native_count; i++) {
|
||||
this.native_pool.push(new NativeInfo(stream));
|
||||
}
|
||||
}
|
||||
|
||||
Bc0File.prototype.string_from_index = function (i) {
|
||||
var result = "";
|
||||
while (this.string_pool[i] !== 0 && i < this.string_pool.length) {
|
||||
result += this.string_pool[i];
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function parse(filename) {
|
||||
return new Bc0File(filename);
|
||||
}
|
||||
|
||||
exports.getBytes = getBytes;
|
||||
exports.parse = parse;
|
||||
|
||||
},{"./byte-stream":1,"fs":7}],3:[function(require,module,exports){
|
||||
exports.NATIVE_FADD = 0
|
||||
exports.NATIVE_FDIV = 1
|
||||
exports.NATIVE_FLESS = 2
|
||||
exports.NATIVE_FMUL = 3
|
||||
exports.NATIVE_FSUB = 4
|
||||
exports.NATIVE_FTOI = 5
|
||||
exports.NATIVE_ITOF = 6
|
||||
exports.NATIVE_PRINT_FPT = 7
|
||||
exports.NATIVE_PRINT_HEX = 8
|
||||
exports.NATIVE_PRINT_INT = 9
|
||||
|
||||
/* args */
|
||||
exports.NATIVE_ARGS_FLAG = 10
|
||||
exports.NATIVE_ARGS_INT = 11
|
||||
exports.NATIVE_ARGS_PARSE = 12
|
||||
exports.NATIVE_ARGS_STRING = 13
|
||||
|
||||
/* conio */
|
||||
exports.NATIVE_EOF = 14
|
||||
exports.NATIVE_FLUSH = 15
|
||||
exports.NATIVE_PRINT = 16
|
||||
exports.NATIVE_PRINTBOOL = 17
|
||||
exports.NATIVE_PRINTCHAR = 18
|
||||
exports.NATIVE_PRINTINT = 19
|
||||
exports.NATIVE_PRINTLN = 20
|
||||
exports.NATIVE_READLINE = 21
|
||||
|
||||
/* curses */
|
||||
exports.NATIVE_C_ADDCH = 22
|
||||
exports.NATIVE_C_CBREAK = 23
|
||||
exports.NATIVE_C_CURS_SET = 24
|
||||
exports.NATIVE_C_DELCH = 25
|
||||
exports.NATIVE_C_ENDWIN = 26
|
||||
exports.NATIVE_C_ERASE = 27
|
||||
exports.NATIVE_C_GETCH = 28
|
||||
exports.NATIVE_C_INITSCR = 29
|
||||
exports.NATIVE_C_KEYPAD = 30
|
||||
exports.NATIVE_C_MOVE = 31
|
||||
exports.NATIVE_C_NOECHO = 32
|
||||
exports.NATIVE_C_REFRESH = 33
|
||||
exports.NATIVE_C_SUBWIN = 34
|
||||
exports.NATIVE_C_WADDCH = 35
|
||||
exports.NATIVE_C_WADDSTR = 36
|
||||
exports.NATIVE_C_WCLEAR = 37
|
||||
exports.NATIVE_C_WERASE = 38
|
||||
exports.NATIVE_C_WMOVE = 39
|
||||
exports.NATIVE_C_WREFRESH = 40
|
||||
exports.NATIVE_C_WSTANDEND = 41
|
||||
exports.NATIVE_C_WSTANDOUT = 42
|
||||
exports.NATIVE_CC_GETBEGX = 43
|
||||
exports.NATIVE_CC_GETBEGY = 44
|
||||
exports.NATIVE_CC_GETMAXX = 45
|
||||
exports.NATIVE_CC_GETMAXY = 46
|
||||
exports.NATIVE_CC_GETX = 47
|
||||
exports.NATIVE_CC_GETY = 48
|
||||
exports.NATIVE_CC_HIGHLIGHT = 49
|
||||
exports.NATIVE_CC_KEY_IS_BACKSPACE = 50
|
||||
exports.NATIVE_CC_KEY_IS_DOWN = 51
|
||||
exports.NATIVE_CC_KEY_IS_ENTER = 52
|
||||
exports.NATIVE_CC_KEY_IS_LEFT = 53
|
||||
exports.NATIVE_CC_KEY_IS_RIGHT = 54
|
||||
exports.NATIVE_CC_KEY_IS_UP = 55
|
||||
exports.NATIVE_CC_WBOLDOFF = 56
|
||||
exports.NATIVE_CC_WBOLDON = 57
|
||||
exports.NATIVE_CC_WDIMOFF = 58
|
||||
exports.NATIVE_CC_WDIMON = 59
|
||||
exports.NATIVE_CC_WREVERSEOFF = 60
|
||||
exports.NATIVE_CC_WREVERSEON = 61
|
||||
exports.NATIVE_CC_WUNDEROFF = 62
|
||||
exports.NATIVE_CC_WUNDERON = 63
|
||||
|
||||
/* file */
|
||||
exports.NATIVE_FILE_CLOSE = 64
|
||||
exports.NATIVE_FILE_CLOSED = 65
|
||||
exports.NATIVE_FILE_EOF = 66
|
||||
exports.NATIVE_FILE_READ = 67
|
||||
exports.NATIVE_FILE_READLINE = 68
|
||||
|
||||
/* img */
|
||||
exports.NATIVE_IMAGE_CLONE = 69
|
||||
exports.NATIVE_IMAGE_CREATE = 70
|
||||
exports.NATIVE_IMAGE_DATA = 71
|
||||
exports.NATIVE_IMAGE_DESTROY = 72
|
||||
exports.NATIVE_IMAGE_HEIGHT = 73
|
||||
exports.NATIVE_IMAGE_LOAD = 74
|
||||
exports.NATIVE_IMAGE_SAVE = 75
|
||||
exports.NATIVE_IMAGE_SUBIMAGE = 76
|
||||
exports.NATIVE_IMAGE_WIDTH = 77
|
||||
|
||||
/* parse */
|
||||
exports.NATIVE_PARSE_BOOL = 78
|
||||
exports.NATIVE_PARSE_INT = 79
|
||||
|
||||
/* string */
|
||||
exports.NATIVE_CHAR_CHR = 80
|
||||
exports.NATIVE_CHAR_ORD = 81
|
||||
exports.NATIVE_STRING_CHARAT = 82
|
||||
exports.NATIVE_STRING_COMPARE = 83
|
||||
exports.NATIVE_STRING_EQUAL = 84
|
||||
exports.NATIVE_STRING_FROM_CHARARRAY = 85
|
||||
exports.NATIVE_STRING_FROMBOOL = 86
|
||||
exports.NATIVE_STRING_FROMCHAR = 87
|
||||
exports.NATIVE_STRING_FROMINT = 88
|
||||
exports.NATIVE_STRING_JOIN = 89
|
||||
exports.NATIVE_STRING_LENGTH = 90
|
||||
exports.NATIVE_STRING_SUB = 91
|
||||
exports.NATIVE_STRING_TERMINATED = 92
|
||||
exports.NATIVE_STRING_TO_CHARARRAY = 93
|
||||
exports.NATIVE_STRING_TOLOWER = 94
|
||||
|
||||
|
||||
},{}],4:[function(require,module,exports){
|
||||
op = require("./opcodes");
|
||||
|
||||
var INT_MIN = 0x80000000;
|
||||
var INT_MAX = 0x7FFFFFFF;
|
||||
|
||||
var verbose = false;
|
||||
function log(message) {
|
||||
if (verbose) console.log(message);
|
||||
}
|
||||
|
||||
function c0_assertion_failure(val) {
|
||||
throw ("c0 assertion failure: " + val);
|
||||
}
|
||||
|
||||
function c0_memory_error(val) {
|
||||
throw ("c0 memory error: " + val);
|
||||
}
|
||||
|
||||
function num_to_i32(num) {
|
||||
log("num is 0x" + num.toString(16));
|
||||
log("num & 0x7FFFFFFF is " + (num & 0x7FFFFFFF));
|
||||
log("neg factor is " + ( (num & 0x80000000)));
|
||||
return (num & 0x7FFFFFFF) + ((num & 0x80000000));
|
||||
}
|
||||
|
||||
function i32_to_array(i32) {
|
||||
return [(i32 & 0xFF),
|
||||
((i32 >> 8) & 0xFF),
|
||||
((i32 >> 16) & 0xFF),
|
||||
((i32 >> 24) & 0xFF)];
|
||||
|
||||
}
|
||||
|
||||
function array_to_i32(array) {
|
||||
return array[0] +
|
||||
(array[1] << 8) +
|
||||
(array[2] << 16) +
|
||||
(array[3] << 24);
|
||||
}
|
||||
|
||||
var StackFrame = function(file, f) {
|
||||
log("Creating stack frame");
|
||||
this.stack = [];
|
||||
this.pc = 0;
|
||||
this.program = f.code;
|
||||
this.variables = [];
|
||||
for (var i = 0; i < f.num_vars; i++)
|
||||
this.variables.push(0);
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
var ProgramState = function(parsed_file, callback_dict) {
|
||||
log("Creating program state with file " + parsed_file);
|
||||
var main_function = parsed_file.function_pool[0];
|
||||
|
||||
this.frame = new StackFrame(parsed_file, parsed_file.function_pool[0]);
|
||||
this.call_stack = [];
|
||||
this.file = parsed_file;
|
||||
|
||||
this.natives = {};
|
||||
|
||||
for (var i = 0; i < 95; i++) {
|
||||
try {
|
||||
this.natives[i] = callback_dict[i];
|
||||
} catch (key_not_found) {
|
||||
this.natives[i] = function (arg) {
|
||||
console.log("Native function " + name + " called, ran method stub.");
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Memory is just a big array of bytes, right?
|
||||
// "Allocation" is appending onto this array
|
||||
// A pointer to memory is an index into this array.
|
||||
|
||||
// Structs are stored as themselves
|
||||
// Arrays are stored as an entry for the number of elements
|
||||
// and then the array, byte-by-byte
|
||||
this.heap = [];
|
||||
}
|
||||
|
||||
ProgramState.prototype.push = function(val) {
|
||||
this.frame.stack.push(val);
|
||||
}
|
||||
|
||||
ProgramState.prototype.pop = function() {
|
||||
if (this.frame.stack === [])
|
||||
throw "Tried to pop from an empty stack!";
|
||||
return this.frame.stack.pop();
|
||||
}
|
||||
|
||||
ProgramState.prototype.goto_offset = function() {
|
||||
var c1 = this.frame.program[this.frame.pc+1];
|
||||
var c2 = this.frame.program[this.frame.pc+2]
|
||||
|
||||
var address_offset = (c1 << 8) + c2;
|
||||
// Handle negative values
|
||||
if ((address_offset & 0x8000) != 0)
|
||||
address_offset = -0x8000 + (address_offset & 0x7FFF);
|
||||
|
||||
this.frame.pc += address_offset;
|
||||
}
|
||||
|
||||
ProgramState.prototype.doIf = function(f) {
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
if (f(x,y)) {
|
||||
this.goto_offset();
|
||||
} else {
|
||||
this.frame.pc += 3;
|
||||
}
|
||||
}
|
||||
|
||||
ProgramState.prototype.step = function() {
|
||||
var opcode = this.frame.program[this.frame.pc]
|
||||
log("0x" + this.frame.pc.toString(16) + " Running opcode " +
|
||||
op.lookup_table[opcode]);
|
||||
switch (opcode) {
|
||||
// Stack manipulation
|
||||
case op.POP:
|
||||
this.frame.pc++;
|
||||
this.pop();
|
||||
break;
|
||||
case op.DUP:
|
||||
this.frame.pc++;
|
||||
var v = this.pop();
|
||||
this.push(v);
|
||||
this.push(v);
|
||||
break;
|
||||
case op.SWAP:
|
||||
this.frame.pc++;
|
||||
var v1 = this.pop();
|
||||
var v2 = this.pop();
|
||||
this.push(v1);
|
||||
this.push(v2);
|
||||
break;
|
||||
case op.BIPUSH:
|
||||
this.frame.pc += 2;
|
||||
var val = this.frame.program[this.frame.pc-1];
|
||||
|
||||
// Do sign extension if necessary
|
||||
if ((val & 0x80) != 0)
|
||||
val = -0x80 + (val & 0x7F);
|
||||
this.push(val);
|
||||
break;
|
||||
|
||||
// Returning from a function
|
||||
case op.RETURN:
|
||||
var retVal = this.pop();
|
||||
if (this.call_stack.length == 0)
|
||||
return retVal;
|
||||
|
||||
this.frame = this.call_stack.pop();
|
||||
this.push(retVal);
|
||||
|
||||
break;
|
||||
// Arithmetic
|
||||
case op.IADD:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
log("Adding " + x + " and " + y);
|
||||
this.push(num_to_i32(x+y));
|
||||
break;
|
||||
case op.ISUB:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
log("Subtracting " + x + " and " + y);
|
||||
this.push(num_to_i32(x-y));
|
||||
break;
|
||||
case op.IMUL:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
this.push(num_to_i32(x*y));
|
||||
break;
|
||||
case op.IDIV:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
if (y == 0) c0_arith_error("Divide by zero");
|
||||
if (x == INT_MIN && y == -1) c0_arith_error("Arithmetic overflow");
|
||||
|
||||
// This does int division.
|
||||
// As I understand it, the ~~ is treated as the identity on integers
|
||||
// which forces the type to int, not float
|
||||
this.push(~~(x/y));
|
||||
break;
|
||||
case op.IREM:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
if (y == 0) c0_arith_error("Divide by zero");
|
||||
if (x == INT_MIN && y == -1) c0_arith_error("Arithmetic overflow");
|
||||
this.push(x%y);
|
||||
break;
|
||||
case op.IAND:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
this.push(x&y);
|
||||
break;
|
||||
case op.IOR:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
this.push(x|y);
|
||||
break;
|
||||
case op.IXOR:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
this.push(x^y);
|
||||
break;
|
||||
case op.ISHL:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
if (y < 0 || y > 31) c0_arith_error("Shifting by too many bits");
|
||||
this.push(x<<y);
|
||||
break;
|
||||
case op.ISHR:
|
||||
this.frame.pc++;
|
||||
var y = this.pop();
|
||||
var x = this.pop();
|
||||
if (y < 0 || y > 31) c0_arith_error("Shifting by too many bits");
|
||||
this.push(x>>y);
|
||||
break;
|
||||
|
||||
// Operations on local variables
|
||||
|
||||
case op.VLOAD:
|
||||
this.frame.pc += 2;
|
||||
var index = this.frame.program[this.frame.pc-1];
|
||||
this.push(this.frame.variables[index]);
|
||||
break;
|
||||
case op.VSTORE:
|
||||
this.frame.pc += 2;
|
||||
var index = this.frame.program[this.frame.pc-1];
|
||||
var val = this.pop();
|
||||
this.frame.variables[index] = val;
|
||||
log("Set variable " + index + " to value " + val);
|
||||
break;
|
||||
case op.ACONST_NULL:
|
||||
this.frame.pc++;
|
||||
this.push(0);
|
||||
break;
|
||||
case op.ILDC:
|
||||
this.frame.pc += 3;
|
||||
var c1 = this.frame.program[this.frame.pc-2];
|
||||
var c2 = this.frame.program[this.frame.pc-1];
|
||||
var index = (c1 * 0x1000) + c2;
|
||||
|
||||
this.push(this.file.int_pool[index]);
|
||||
break;
|
||||
case op.ALDC:
|
||||
this.frame.pc += 3;
|
||||
var c1 = this.frame.program[this.frame.pc-2];
|
||||
var c2 = this.frame.program[this.frame.pc-1];
|
||||
var index = (c1 * 0x1000) + c2;
|
||||
|
||||
this.push(this.file.string_from_index(index));
|
||||
break;
|
||||
|
||||
// Control flow
|
||||
case op.NOP:
|
||||
this.frame.pc++;
|
||||
break;
|
||||
case op.IF_CMPEQ:
|
||||
this.doIf(function (x,y) {return y == x;});
|
||||
break;
|
||||
case op.IF_CMPNE:
|
||||
this.doIf(function (x,y) {return y != x;});
|
||||
break;
|
||||
case op.IF_ICMPLT:
|
||||
this.doIf(function (x,y) {return y > x;});
|
||||
break;
|
||||
case op.IF_ICMPGE:
|
||||
this.doIf(function (x,y) {return y <= x;});
|
||||
break;
|
||||
case op.IF_ICMPGT:
|
||||
this.doIf(function (x,y) {return y < x;});
|
||||
break;
|
||||
case op.IF_ICMPLE:
|
||||
this.doIf(function (x,y) {return y >= x;});
|
||||
break;
|
||||
case op.GOTO:
|
||||
this.goto_offset();
|
||||
break;
|
||||
case op.ATHROW:
|
||||
this.frame.pc++;
|
||||
c0_user_error(this.pop());
|
||||
break;
|
||||
case op.ASSERT:
|
||||
this.frame.pc++;
|
||||
var a = this.pop();
|
||||
if (this.pop() == 0)
|
||||
c0_assertion_failure(a);
|
||||
break;
|
||||
|
||||
// Function call operations
|
||||
|
||||
case op.INVOKESTATIC:
|
||||
var c1 = this.frame.program[this.frame.pc+1];
|
||||
var c2 = this.frame.program[this.frame.pc+2];
|
||||
this.frame.pc += 3;
|
||||
|
||||
var index = (c1 << 8) + c2;
|
||||
|
||||
var f = this.file.function_pool[index];
|
||||
var newFrame = new StackFrame(this.file, f);
|
||||
for (var i = f.num_args - 1; i >= 0; i--) {
|
||||
newFrame.variables[i] = this.pop();
|
||||
}
|
||||
|
||||
this.call_stack.push(this.frame);
|
||||
this.frame = newFrame;
|
||||
break;
|
||||
|
||||
case op.INVOKENATIVE:
|
||||
var c1 = this.frame.program[this.frame.pc+1];
|
||||
var c2 = this.frame.program[this.frame.pc+2];
|
||||
this.frame.pc += 3;
|
||||
|
||||
var index = (c1 << 8) + c2;
|
||||
|
||||
var f = this.file.native_pool[index];
|
||||
var arg_array = [];
|
||||
for (var i = f.num_args - 1; i >= 0; i--)
|
||||
arg_array[i] = this.pop();
|
||||
|
||||
var native_function = this.natives[f.function_table_index];
|
||||
if (native_function === undefined) {
|
||||
native_function = function (ignored) {
|
||||
console.log("Could not find native function with index " +
|
||||
f.function_table_index);
|
||||
return 0;
|
||||
};
|
||||
console.log("Unknown native function index " + f.function_table_index);
|
||||
}
|
||||
log("Calling native function with index " + index + " with arguments " +
|
||||
arg_array);
|
||||
this.push(native_function(arg_array));
|
||||
break;
|
||||
|
||||
// Memory allocation operations:
|
||||
|
||||
case op.NEW:
|
||||
var size = this.frame.program[this.frame.pc+1];
|
||||
var address = this.heap.length;
|
||||
|
||||
for (var i = 0; i < size; i++) this.heap.push(0);
|
||||
|
||||
this.push(address);
|
||||
this.frame.pc += 2;
|
||||
break;
|
||||
|
||||
case op.NEWARRAY:
|
||||
var size = this.frame.program[this.frame.pc+1];
|
||||
var address = this.heap.length;
|
||||
var num_elements = this.pop();
|
||||
if (num_elements < 0) c0_memory_error("Array size must be nonnegative");
|
||||
|
||||
this.heap.push(num_elements);
|
||||
this.heap.push(size);
|
||||
|
||||
for (var i = 0; i < num_elements; i++) {
|
||||
for (var j = 0; j < size; j++)
|
||||
this.heap.push(0);
|
||||
}
|
||||
|
||||
this.push(address);
|
||||
this.frame.pc += 2;
|
||||
break;
|
||||
|
||||
case op.ARRAYLENGTH:
|
||||
var pointer = this.pop();
|
||||
this.push(this.heap[pointer]);
|
||||
break;
|
||||
|
||||
// Memory access operations:
|
||||
|
||||
case op.AADDF:
|
||||
// Read offset into a struct
|
||||
var offset = this.frame.program[this.frame.pc + 1];
|
||||
var index = this.pop();
|
||||
this.push(index + offset);
|
||||
this.frame.pc += 2;
|
||||
break;
|
||||
|
||||
case op.AADDS:
|
||||
// Read offset into an array
|
||||
var elt_index = this.pop();
|
||||
var index = this.pop();
|
||||
|
||||
if (typeof index == "string") {
|
||||
this.push(index.slice(elt_index));
|
||||
} else {
|
||||
var array_length = this.heap[index];
|
||||
var elt_size = this.heap[index+1];
|
||||
if (elt_index >= array_length)
|
||||
c0_memory_error("Array index out of bounds.");
|
||||
this.push(index + 2 + (elt_size*elt_index));
|
||||
}
|
||||
this.frame.pc++;
|
||||
break;
|
||||
|
||||
case op.IMLOAD:
|
||||
var addr = this.pop();
|
||||
// Get int32 from bytes
|
||||
var c1 = this.heap[addr];
|
||||
var c2 = this.heap[addr+1];
|
||||
var c3 = this.heap[addr+2];
|
||||
var c4 = this.heap[addr+3];
|
||||
var combined = array_to_i32([c1, c2, c3, c4]);
|
||||
this.push(combined);
|
||||
this.frame.pc++;
|
||||
break;
|
||||
|
||||
case op.IMSTORE:
|
||||
var value = this.pop();
|
||||
var addr = this.pop();
|
||||
var array = i32_to_array(value);
|
||||
|
||||
for (var i = 0; i < 4; i++)
|
||||
this.heap[addr + i] = array[i];
|
||||
this.frame.pc++;
|
||||
break;
|
||||
|
||||
case op.AMLOAD:
|
||||
var addr = this.pop();
|
||||
this.push(this.heap[addr]);
|
||||
this.frame.pc++;
|
||||
break;
|
||||
|
||||
case op.AMSTORE:
|
||||
var value = this.pop();
|
||||
var addr = this.pop();
|
||||
this.heap[addr] = value;
|
||||
this.frame.pc++;
|
||||
break;
|
||||
|
||||
case op.CMLOAD:
|
||||
var addr = this.pop();
|
||||
if (typeof addr == "string")
|
||||
this.push(addr);
|
||||
else
|
||||
this.push(this.heap[addr]);
|
||||
this.frame.pc++;
|
||||
break;
|
||||
|
||||
case op.CMSTORE:
|
||||
var value = this.pop();
|
||||
var addr = this.pop();
|
||||
this.heap[addr] = value;
|
||||
this.frame.pc++;
|
||||
break;
|
||||
|
||||
default:
|
||||
var opcode_name;
|
||||
try {
|
||||
opcode_name = op.lookup_table[opcode];
|
||||
} catch (ignored) {
|
||||
opcode_name = "UNKNOWN";
|
||||
}
|
||||
console.log("Error: Unknown opcode: 0x" + opcode.toString(16) +
|
||||
" (" + opcode_name + ")\n");
|
||||
throw "Error - unknown opcode";
|
||||
}
|
||||
}
|
||||
|
||||
// Takes in a parsed .bc0 file and runs it
|
||||
function execute(file, callbacks, v) {
|
||||
verbose = typeof v !== 'undefined' ? v : true;
|
||||
log("Initializing with file " + file);
|
||||
|
||||
var state = new ProgramState(file, callbacks);
|
||||
|
||||
if (verbose) log(file);
|
||||
|
||||
log("Beginning execution");
|
||||
|
||||
while (true) {
|
||||
var val = state.step();
|
||||
if (val !== undefined) return val;
|
||||
|
||||
if (verbose) {
|
||||
console.log("Machine state:");
|
||||
console.log(" Current Stack Frame:");
|
||||
console.log(" Stack: " + state.frame.stack);
|
||||
console.log(" PC: " + state.frame.pc);
|
||||
console.log(" Vars: " + state.frame.variables);
|
||||
// console.log(" Code: " + state.frame.program);
|
||||
console.log(" Heap: " + state.heap);
|
||||
}
|
||||
|
||||
// if (at_breakpoint) {
|
||||
// save state (maybe in a global in this file?)
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
exports.execute = execute;
|
||||
|
||||
},{"./opcodes":6}],5:[function(require,module,exports){
|
||||
parser = require("./bytecode-parser");
|
||||
c0vm = require("./c0vm.js");
|
||||
c0ffi = require("./c0ffi.js");
|
||||
|
||||
// console.log("Reading in sample bytecode file:");
|
||||
// console.log(parser.getBytes("../test/test.bc0"));
|
||||
// console.log("That was the sample bytecode file" +
|
||||
// " -- it probably took up your whole terminal screen.");
|
||||
// var file = parser.parse("../test/test.bc0");
|
||||
// console.log(file);
|
||||
// console.log(file.function_pool[0].code);
|
||||
|
||||
// UI interaction functions
|
||||
|
||||
function print(arg) {
|
||||
$("#output").append(arg);
|
||||
}
|
||||
|
||||
callbacks = {};
|
||||
callbacks[c0ffi.NATIVE_PRINT] = function(args) {
|
||||
print(args[0]);
|
||||
print("<br />");
|
||||
return 0;
|
||||
}
|
||||
|
||||
callbacks[c0ffi.NATIVE_PRINTINT] = function(args) {
|
||||
print(args[0]);
|
||||
print("<br />");
|
||||
return 0;
|
||||
}
|
||||
|
||||
console.log(callbacks);
|
||||
|
||||
$("#run").click(function() {
|
||||
var input = $("#bytecode").html().replace(/(\r\n|\n|\r)/gm,"");
|
||||
var file = parser.parse($("#bytecode").text());
|
||||
print("<br />");
|
||||
print(c0vm.execute(file, callbacks));
|
||||
});
|
||||
|
||||
},{"./bytecode-parser":2,"./c0ffi.js":3,"./c0vm.js":4}],6:[function(require,module,exports){
|
||||
/* arithmetic operations */
|
||||
exports.IADD = 0x60;
|
||||
exports.IAND = 0x7E;
|
||||
exports.IDIV = 0x6C;
|
||||
exports.IMUL = 0x68;
|
||||
exports.IOR = 0x80;
|
||||
exports.IREM = 0x70;
|
||||
exports.ISHL = 0x78;
|
||||
exports.ISHR = 0x7A;
|
||||
exports.ISUB = 0x64;
|
||||
exports.IXOR = 0x82;
|
||||
|
||||
/* stack operations */
|
||||
exports.DUP = 0x59;
|
||||
exports.POP = 0x57;
|
||||
exports.SWAP = 0x5F;
|
||||
|
||||
/* memory allocation */
|
||||
exports.NEWARRAY = 0xBC;
|
||||
exports.ARRAYLENGTH = 0xBE;
|
||||
exports.NEW = 0xBB;
|
||||
|
||||
/* memory access */
|
||||
exports.AADDF = 0x62;
|
||||
exports.AADDS = 0x63;
|
||||
exports.IMLOAD = 0x2E;
|
||||
exports.AMLOAD = 0x2F;
|
||||
exports.IMSTORE = 0x4E;
|
||||
exports.AMSTORE = 0x4F;
|
||||
exports.CMLOAD = 0x34;
|
||||
exports.CMSTORE = 0x55;
|
||||
|
||||
/* local variables */
|
||||
exports.VLOAD = 0x15;
|
||||
exports.VSTORE = 0x36;
|
||||
|
||||
/* constants */
|
||||
exports.ACONST_NULL = 0x01;
|
||||
exports.BIPUSH = 0x10;
|
||||
exports.ILDC = 0x13;
|
||||
exports.ALDC = 0x14;
|
||||
|
||||
/* control flow */
|
||||
exports.NOP = 0x00;
|
||||
exports.IF_CMPEQ = 0x9F;
|
||||
exports.IF_CMPNE = 0xA0;
|
||||
exports.IF_ICMPLT = 0xA1;
|
||||
exports.IF_ICMPGE = 0xA2;
|
||||
exports.IF_ICMPGT = 0xA3;
|
||||
exports.IF_ICMPLE = 0xA4;
|
||||
exports.GOTO = 0xA7;
|
||||
exports.ATHROW = 0xBF;
|
||||
exports.ASSERT = 0xCF;
|
||||
|
||||
/* function calls and returns */
|
||||
exports.INVOKESTATIC = 0xB8;
|
||||
exports.INVOKENATIVE = 0xB7;
|
||||
exports.RETURN = 0xB0
|
||||
|
||||
|
||||
exports.lookup_table = {
|
||||
0x60: "IADD",
|
||||
0x7E: "IAND",
|
||||
0x6C: "IDIV",
|
||||
0x68: "IMUL",
|
||||
0x80: "IOR",
|
||||
0x70: "IREM",
|
||||
0x78: "ISHL",
|
||||
0x7A: "ISHR",
|
||||
0x64: "ISUB",
|
||||
0x82: "IXOR",
|
||||
0x59: "DUP",
|
||||
0x57: "POP",
|
||||
0x5F: "SWAP",
|
||||
0xBC: "NEWARRAY",
|
||||
0xBE: "ARRAYLENGTH",
|
||||
0xBB: "NEW",
|
||||
0x62: "AADDF",
|
||||
0x63: "AADDS",
|
||||
0x2E: "IMLOAD",
|
||||
0x2F: "AMLOAD",
|
||||
0x4E: "IMSTORE",
|
||||
0x4F: "AMSTORE",
|
||||
0x34: "CMLOAD",
|
||||
0x55: "CMSTORE",
|
||||
0x15: "VLOAD",
|
||||
0x36: "VSTORE",
|
||||
0x01: "ACONST",
|
||||
0x10: "BIPUSH",
|
||||
0x13: "ILDC",
|
||||
0x14: "ALDC",
|
||||
0x00: "NOP",
|
||||
0x9F: "IF_CMPEQ",
|
||||
0xA0: "IF_CMPNE",
|
||||
0xA1: "IF_ICMPLT",
|
||||
0xA2: "IF_ICMPGE",
|
||||
0xA3: "IF_ICMPGT",
|
||||
0xA4: "IF_ICMPLE",
|
||||
0xA7: "GOTO",
|
||||
0xBF: "ATHROW",
|
||||
0xCF: "ASSERT",
|
||||
0xB8: "INVOKESTATIC",
|
||||
0xB7: "INVOKENATIVE",
|
||||
0xB0: "RETURN"
|
||||
};
|
||||
|
||||
},{}],7:[function(require,module,exports){
|
||||
|
||||
},{}]},{},[4,2,1,6,5]);
|
||||
6
test/abort.c0
Normal file
@@ -0,0 +1,6 @@
|
||||
#use <conio>
|
||||
|
||||
int main () {
|
||||
error("assertion failure");
|
||||
return 0;
|
||||
}
|
||||
25
test/abort.c0.bc0
Normal file
@@ -0,0 +1,25 @@
|
||||
C0 C0 FF EE # magic number
|
||||
00 09 # version 4, arch = 1 (64 bits)
|
||||
|
||||
00 00 # int pool count
|
||||
# int pool
|
||||
|
||||
00 12 # string pool total size
|
||||
# string pool
|
||||
61 73 73 65 72 74 69 6F 6E 20 66 61 69 6C 75 72 65 00 # "assertion failure"
|
||||
|
||||
00 01 # function count
|
||||
# function_pool
|
||||
|
||||
#<main>
|
||||
00 00 # number of arguments = 0
|
||||
00 00 # number of local variables = 0
|
||||
00 07 # code length = 7 bytes
|
||||
14 00 00 # aldc 0 # s[0] = "assertion failure"
|
||||
BF # athrow # error "assertion failure"
|
||||
10 00 # bipush 0 # 0
|
||||
B0 # return #
|
||||
|
||||
00 00 # native count
|
||||
# native pool
|
||||
|
||||
0
test/abort.c0.bc0out
Normal file
0
test/abort.c0.c0out
Normal file
BIN
test/abort.c0.ex
Executable file
129
test/arith.c0
Normal file
@@ -0,0 +1,129 @@
|
||||
#use <conio>
|
||||
|
||||
int main()
|
||||
{
|
||||
int max; int min;
|
||||
int x; int y; int z;
|
||||
int constant;
|
||||
|
||||
//Testing overflow
|
||||
max = 2147483647;
|
||||
min = -2147483648;
|
||||
y = max + 1;
|
||||
printint(y);
|
||||
print(" ");
|
||||
y = min - 1;
|
||||
printint(y);
|
||||
print(" ");
|
||||
// printint(min / -1);
|
||||
|
||||
//Testing multiplication of negatives
|
||||
|
||||
x = -25;
|
||||
y = 15;
|
||||
printint(x * y);
|
||||
print(" ");
|
||||
printint(-15 * -2147483648);
|
||||
print(" ");
|
||||
|
||||
//Divide by 0
|
||||
// println("");
|
||||
// printint(x / 0);
|
||||
|
||||
//Modulus by 0
|
||||
// println("");
|
||||
// printint(x % 0);
|
||||
|
||||
//Testing addition
|
||||
x = -5;
|
||||
y = -4;
|
||||
printint(x + y);
|
||||
z = x - y;
|
||||
print(" ");
|
||||
printint(z);
|
||||
print(" ");
|
||||
|
||||
|
||||
//Division truncation
|
||||
x = 25;
|
||||
y = 2;
|
||||
z = x / y;
|
||||
printint(z);
|
||||
print(" ");
|
||||
|
||||
println("");
|
||||
x = -25;
|
||||
y = 2;
|
||||
z = x / y;
|
||||
printint(z);
|
||||
print(" ");
|
||||
x = -25;
|
||||
y = -2;
|
||||
z = x / y;
|
||||
printint(z);
|
||||
print(" ");
|
||||
|
||||
//Modulus testing
|
||||
print("Modulus testing ");
|
||||
printint(235%32);
|
||||
printint(-15%2);
|
||||
print(" ");
|
||||
printint(5%6);
|
||||
print(" ");
|
||||
printint(5%-2);
|
||||
print(" ");
|
||||
|
||||
//Testing constants
|
||||
print("Testing constants ");
|
||||
constant = -251;
|
||||
printint(constant);
|
||||
print(" ");
|
||||
|
||||
//Testing inequalities
|
||||
println("Testing inequalities ");
|
||||
if(5>4) print("y1 "); else print("n1 ");
|
||||
if(1>-1) print("y2 "); else print("n2 ");
|
||||
if(0>=0) print("y3 "); else print("n3 ");
|
||||
if(12945<-235) print("y4 "); else print("n4 ");
|
||||
if(5<5) print("y5 "); else print("n5 ");
|
||||
if(-5==5) print("y6 "); else print("n6 ");
|
||||
if(15!=-15) print("y7 "); else print("n7 ");
|
||||
|
||||
//Testing bitwise operators
|
||||
println("Testing bitwise operators ");
|
||||
printint(0xF232C & 0xFF2352);
|
||||
print(" ");
|
||||
printint(0xF232C | 0xFF232);
|
||||
print(" ");
|
||||
printint(0xCD25 ^ 0x1D27);
|
||||
print(" ");
|
||||
printint(~0x2F32);
|
||||
print(" ");
|
||||
|
||||
//Testing bit shifting
|
||||
println("Testing bit shifting");
|
||||
printint(1<<31);
|
||||
print(" ");
|
||||
printint(23<<5);
|
||||
print(" ");
|
||||
printint(1>>5<<7);
|
||||
print(" ");
|
||||
printint(2352352>>2);
|
||||
print(" ");
|
||||
|
||||
//Default value for integers
|
||||
// println("Testing default value for integers");
|
||||
// printint(default_int);
|
||||
// print(" ");
|
||||
|
||||
//Testing other arithmetic functions
|
||||
printint(-6-25);
|
||||
print(" ");
|
||||
printint(6-25);
|
||||
print(" ");
|
||||
|
||||
|
||||
|
||||
println("");
|
||||
return 0;
|
||||
}
|
||||
430
test/arith.c0.bc0
Normal file
@@ -0,0 +1,430 @@
|
||||
C0 C0 FF EE # magic number
|
||||
00 09 # version 4, arch = 1 (64 bits)
|
||||
|
||||
00 0F # int pool count
|
||||
# int pool
|
||||
7F FF FF FF
|
||||
80 00 00 00
|
||||
80 00 00 00
|
||||
00 00 00 EB
|
||||
FF FF FF 05
|
||||
00 00 32 91
|
||||
FF FF FF 15
|
||||
00 0F 23 2C
|
||||
00 FF 23 52
|
||||
00 0F 23 2C
|
||||
00 0F F2 32
|
||||
00 00 CD 25
|
||||
00 00 1D 27
|
||||
00 00 2F 32
|
||||
00 23 E4 E0
|
||||
|
||||
01 16 # string pool total size
|
||||
# string pool
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
00 # ""
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
4D 6F 64 75 6C 75 73 20 74 65 73 74 69 6E 67 20 20 20 00 # "Modulus testing "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
54 65 73 74 69 6E 67 20 63 6F 6E 73 74 61 6E 74 73 20 20 20 00 # "Testing constants "
|
||||
20 20 20 00 # " "
|
||||
54 65 73 74 69 6E 67 20 69 6E 65 71 75 61 6C 69 74 69 65 73 20 20 20 00 # "Testing inequalities "
|
||||
79 31 20 20 00 # "y1 "
|
||||
6E 31 20 20 00 # "n1 "
|
||||
79 32 20 20 00 # "y2 "
|
||||
6E 32 20 20 00 # "n2 "
|
||||
79 33 20 20 00 # "y3 "
|
||||
6E 33 20 20 00 # "n3 "
|
||||
79 34 20 20 00 # "y4 "
|
||||
6E 34 20 20 00 # "n4 "
|
||||
79 35 20 20 00 # "y5 "
|
||||
6E 35 20 20 00 # "n5 "
|
||||
79 36 20 20 00 # "y6 "
|
||||
6E 36 20 20 00 # "n6 "
|
||||
79 37 20 20 00 # "y7 "
|
||||
6E 37 20 20 00 # "n7 "
|
||||
54 65 73 74 69 6E 67 20 62 69 74 77 69 73 65 20 6F 70 65 72 61 74 6F 72 73 20 20 20 00 # "Testing bitwise operators "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
54 65 73 74 69 6E 67 20 62 69 74 20 73 68 69 66 74 69 6E 67 00 # "Testing bit shifting"
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
20 20 20 00 # " "
|
||||
00 # ""
|
||||
|
||||
00 01 # function count
|
||||
# function_pool
|
||||
|
||||
#<main>
|
||||
00 00 # number of arguments = 0
|
||||
00 06 # number of local variables = 6
|
||||
02 C5 # code length = 709 bytes
|
||||
13 00 00 # ildc 0 # c[0] = 2147483647
|
||||
36 00 # vstore 0 # max = 2147483647;
|
||||
13 00 01 # ildc 1 # c[1] = -2147483648
|
||||
36 01 # vstore 1 # min = -(-2147483648);
|
||||
15 00 # vload 0 # max
|
||||
10 01 # bipush 1 # 1
|
||||
60 # iadd # (max + 1)
|
||||
36 03 # vstore 3 # y = (max + 1);
|
||||
15 03 # vload 3 # y
|
||||
B7 00 00 # invokenative 0 # printint(y)
|
||||
57 # pop # (ignore result)
|
||||
14 00 00 # aldc 0 # s[0] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
15 01 # vload 1 # min
|
||||
10 01 # bipush 1 # 1
|
||||
64 # isub # (min - 1)
|
||||
36 03 # vstore 3 # y = (min - 1);
|
||||
15 03 # vload 3 # y
|
||||
B7 00 00 # invokenative 0 # printint(y)
|
||||
57 # pop # (ignore result)
|
||||
14 00 04 # aldc 4 # s[4] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 E7 # bipush -25 # -25
|
||||
36 02 # vstore 2 # x = -(25);
|
||||
10 0F # bipush 15 # 15
|
||||
36 03 # vstore 3 # y = 15;
|
||||
15 02 # vload 2 # x
|
||||
15 03 # vload 3 # y
|
||||
68 # imul # (x * y)
|
||||
B7 00 00 # invokenative 0 # printint((x * y))
|
||||
57 # pop # (ignore result)
|
||||
14 00 08 # aldc 8 # s[8] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 F1 # bipush -15 # -15
|
||||
13 00 02 # ildc 2 # c[2] = -2147483648
|
||||
68 # imul # (-(15) * -(-2147483648))
|
||||
B7 00 00 # invokenative 0 # printint((-(15) * -(-2147483648)))
|
||||
57 # pop # (ignore result)
|
||||
14 00 0C # aldc 12 # s[12] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 FB # bipush -5 # -5
|
||||
36 02 # vstore 2 # x = -(5);
|
||||
10 FC # bipush -4 # -4
|
||||
36 03 # vstore 3 # y = -(4);
|
||||
15 02 # vload 2 # x
|
||||
15 03 # vload 3 # y
|
||||
60 # iadd # (x + y)
|
||||
B7 00 00 # invokenative 0 # printint((x + y))
|
||||
57 # pop # (ignore result)
|
||||
15 02 # vload 2 # x
|
||||
15 03 # vload 3 # y
|
||||
64 # isub # (x - y)
|
||||
36 04 # vstore 4 # z = (x - y);
|
||||
14 00 10 # aldc 16 # s[16] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
15 04 # vload 4 # z
|
||||
B7 00 00 # invokenative 0 # printint(z)
|
||||
57 # pop # (ignore result)
|
||||
14 00 14 # aldc 20 # s[20] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 19 # bipush 25 # 25
|
||||
36 02 # vstore 2 # x = 25;
|
||||
10 02 # bipush 2 # 2
|
||||
36 03 # vstore 3 # y = 2;
|
||||
15 02 # vload 2 # x
|
||||
15 03 # vload 3 # y
|
||||
6C # idiv # (x / y)
|
||||
36 04 # vstore 4 # z = (x / y);
|
||||
15 04 # vload 4 # z
|
||||
B7 00 00 # invokenative 0 # printint(z)
|
||||
57 # pop # (ignore result)
|
||||
14 00 18 # aldc 24 # s[24] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
14 00 1C # aldc 28 # s[28] = ""
|
||||
B7 00 02 # invokenative 2 # println("")
|
||||
57 # pop # (ignore result)
|
||||
10 E7 # bipush -25 # -25
|
||||
36 02 # vstore 2 # x = -(25);
|
||||
10 02 # bipush 2 # 2
|
||||
36 03 # vstore 3 # y = 2;
|
||||
15 02 # vload 2 # x
|
||||
15 03 # vload 3 # y
|
||||
6C # idiv # (x / y)
|
||||
36 04 # vstore 4 # z = (x / y);
|
||||
15 04 # vload 4 # z
|
||||
B7 00 00 # invokenative 0 # printint(z)
|
||||
57 # pop # (ignore result)
|
||||
14 00 1D # aldc 29 # s[29] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 E7 # bipush -25 # -25
|
||||
36 02 # vstore 2 # x = -(25);
|
||||
10 FE # bipush -2 # -2
|
||||
36 03 # vstore 3 # y = -(2);
|
||||
15 02 # vload 2 # x
|
||||
15 03 # vload 3 # y
|
||||
6C # idiv # (x / y)
|
||||
36 04 # vstore 4 # z = (x / y);
|
||||
15 04 # vload 4 # z
|
||||
B7 00 00 # invokenative 0 # printint(z)
|
||||
57 # pop # (ignore result)
|
||||
14 00 21 # aldc 33 # s[33] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
14 00 25 # aldc 37 # s[37] = "Modulus testing "
|
||||
B7 00 01 # invokenative 1 # print("Modulus testing ")
|
||||
57 # pop # (ignore result)
|
||||
13 00 03 # ildc 3 # c[3] = 235
|
||||
10 20 # bipush 32 # 32
|
||||
70 # irem # (235 % 32)
|
||||
B7 00 00 # invokenative 0 # printint((235 % 32))
|
||||
57 # pop # (ignore result)
|
||||
10 F1 # bipush -15 # -15
|
||||
10 02 # bipush 2 # 2
|
||||
70 # irem # (-(15) % 2)
|
||||
B7 00 00 # invokenative 0 # printint((-(15) % 2))
|
||||
57 # pop # (ignore result)
|
||||
14 00 38 # aldc 56 # s[56] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 05 # bipush 5 # 5
|
||||
10 06 # bipush 6 # 6
|
||||
70 # irem # (5 % 6)
|
||||
B7 00 00 # invokenative 0 # printint((5 % 6))
|
||||
57 # pop # (ignore result)
|
||||
14 00 3C # aldc 60 # s[60] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 05 # bipush 5 # 5
|
||||
10 FE # bipush -2 # -2
|
||||
70 # irem # (5 % -(2))
|
||||
B7 00 00 # invokenative 0 # printint((5 % -(2)))
|
||||
57 # pop # (ignore result)
|
||||
14 00 40 # aldc 64 # s[64] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
14 00 44 # aldc 68 # s[68] = "Testing constants "
|
||||
B7 00 01 # invokenative 1 # print("Testing constants ")
|
||||
57 # pop # (ignore result)
|
||||
13 00 04 # ildc 4 # c[4] = -251
|
||||
36 05 # vstore 5 # constant = -(251);
|
||||
15 05 # vload 5 # constant
|
||||
B7 00 00 # invokenative 0 # printint(constant)
|
||||
57 # pop # (ignore result)
|
||||
14 00 59 # aldc 89 # s[89] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
14 00 5D # aldc 93 # s[93] = "Testing inequalities "
|
||||
B7 00 02 # invokenative 2 # println("Testing inequalities ")
|
||||
57 # pop # (ignore result)
|
||||
10 05 # bipush 5 # 5
|
||||
10 04 # bipush 4 # 4
|
||||
A3 00 06 # if_icmpgt +6 # if (5 > 4) goto <00:then>
|
||||
A7 00 0D # goto +13 # goto <01:else>
|
||||
# <00:then>
|
||||
14 00 75 # aldc 117 # s[117] = "y1 "
|
||||
B7 00 01 # invokenative 1 # print("y1 ")
|
||||
57 # pop # (ignore result)
|
||||
A7 00 0A # goto +10 # goto <02:endif>
|
||||
# <01:else>
|
||||
14 00 7A # aldc 122 # s[122] = "n1 "
|
||||
B7 00 01 # invokenative 1 # print("n1 ")
|
||||
57 # pop # (ignore result)
|
||||
# <02:endif>
|
||||
10 01 # bipush 1 # 1
|
||||
10 FF # bipush -1 # -1
|
||||
A3 00 06 # if_icmpgt +6 # if (1 > -(1)) goto <03:then>
|
||||
A7 00 0D # goto +13 # goto <04:else>
|
||||
# <03:then>
|
||||
14 00 7F # aldc 127 # s[127] = "y2 "
|
||||
B7 00 01 # invokenative 1 # print("y2 ")
|
||||
57 # pop # (ignore result)
|
||||
A7 00 0A # goto +10 # goto <05:endif>
|
||||
# <04:else>
|
||||
14 00 84 # aldc 132 # s[132] = "n2 "
|
||||
B7 00 01 # invokenative 1 # print("n2 ")
|
||||
57 # pop # (ignore result)
|
||||
# <05:endif>
|
||||
10 00 # bipush 0 # 0
|
||||
10 00 # bipush 0 # 0
|
||||
A2 00 06 # if_icmpge +6 # if (0 >= 0) goto <06:then>
|
||||
A7 00 0D # goto +13 # goto <07:else>
|
||||
# <06:then>
|
||||
14 00 89 # aldc 137 # s[137] = "y3 "
|
||||
B7 00 01 # invokenative 1 # print("y3 ")
|
||||
57 # pop # (ignore result)
|
||||
A7 00 0A # goto +10 # goto <08:endif>
|
||||
# <07:else>
|
||||
14 00 8E # aldc 142 # s[142] = "n3 "
|
||||
B7 00 01 # invokenative 1 # print("n3 ")
|
||||
57 # pop # (ignore result)
|
||||
# <08:endif>
|
||||
13 00 05 # ildc 5 # c[5] = 12945
|
||||
13 00 06 # ildc 6 # c[6] = -235
|
||||
A1 00 06 # if_icmplt +6 # if (12945 < -(235)) goto <09:then>
|
||||
A7 00 0D # goto +13 # goto <10:else>
|
||||
# <09:then>
|
||||
14 00 93 # aldc 147 # s[147] = "y4 "
|
||||
B7 00 01 # invokenative 1 # print("y4 ")
|
||||
57 # pop # (ignore result)
|
||||
A7 00 0A # goto +10 # goto <11:endif>
|
||||
# <10:else>
|
||||
14 00 98 # aldc 152 # s[152] = "n4 "
|
||||
B7 00 01 # invokenative 1 # print("n4 ")
|
||||
57 # pop # (ignore result)
|
||||
# <11:endif>
|
||||
10 05 # bipush 5 # 5
|
||||
10 05 # bipush 5 # 5
|
||||
A1 00 06 # if_icmplt +6 # if (5 < 5) goto <12:then>
|
||||
A7 00 0D # goto +13 # goto <13:else>
|
||||
# <12:then>
|
||||
14 00 9D # aldc 157 # s[157] = "y5 "
|
||||
B7 00 01 # invokenative 1 # print("y5 ")
|
||||
57 # pop # (ignore result)
|
||||
A7 00 0A # goto +10 # goto <14:endif>
|
||||
# <13:else>
|
||||
14 00 A2 # aldc 162 # s[162] = "n5 "
|
||||
B7 00 01 # invokenative 1 # print("n5 ")
|
||||
57 # pop # (ignore result)
|
||||
# <14:endif>
|
||||
10 FB # bipush -5 # -5
|
||||
10 05 # bipush 5 # 5
|
||||
9F 00 06 # if_cmpeq +6 # if (-(5) == 5) goto <15:then>
|
||||
A7 00 0D # goto +13 # goto <16:else>
|
||||
# <15:then>
|
||||
14 00 A7 # aldc 167 # s[167] = "y6 "
|
||||
B7 00 01 # invokenative 1 # print("y6 ")
|
||||
57 # pop # (ignore result)
|
||||
A7 00 0A # goto +10 # goto <17:endif>
|
||||
# <16:else>
|
||||
14 00 AC # aldc 172 # s[172] = "n6 "
|
||||
B7 00 01 # invokenative 1 # print("n6 ")
|
||||
57 # pop # (ignore result)
|
||||
# <17:endif>
|
||||
10 0F # bipush 15 # 15
|
||||
10 F1 # bipush -15 # -15
|
||||
A0 00 06 # if_cmpne +6 # if (15 != -(15)) goto <18:then>
|
||||
A7 00 0D # goto +13 # goto <19:else>
|
||||
# <18:then>
|
||||
14 00 B1 # aldc 177 # s[177] = "y7 "
|
||||
B7 00 01 # invokenative 1 # print("y7 ")
|
||||
57 # pop # (ignore result)
|
||||
A7 00 0A # goto +10 # goto <20:endif>
|
||||
# <19:else>
|
||||
14 00 B6 # aldc 182 # s[182] = "n7 "
|
||||
B7 00 01 # invokenative 1 # print("n7 ")
|
||||
57 # pop # (ignore result)
|
||||
# <20:endif>
|
||||
14 00 BB # aldc 187 # s[187] = "Testing bitwise operators "
|
||||
B7 00 02 # invokenative 2 # println("Testing bitwise operators ")
|
||||
57 # pop # (ignore result)
|
||||
13 00 07 # ildc 7 # c[7] = 992044
|
||||
13 00 08 # ildc 8 # c[8] = 16720722
|
||||
7E # iand # (992044 & 16720722)
|
||||
B7 00 00 # invokenative 0 # printint((992044 & 16720722))
|
||||
57 # pop # (ignore result)
|
||||
14 00 D8 # aldc 216 # s[216] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
13 00 09 # ildc 9 # c[9] = 992044
|
||||
13 00 0A # ildc 10 # c[10] = 1045042
|
||||
80 # ior # (992044 | 1045042)
|
||||
B7 00 00 # invokenative 0 # printint((992044 | 1045042))
|
||||
57 # pop # (ignore result)
|
||||
14 00 DC # aldc 220 # s[220] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
13 00 0B # ildc 11 # c[11] = 52517
|
||||
13 00 0C # ildc 12 # c[12] = 7463
|
||||
82 # ixor # (52517 ^ 7463)
|
||||
B7 00 00 # invokenative 0 # printint((52517 ^ 7463))
|
||||
57 # pop # (ignore result)
|
||||
14 00 E0 # aldc 224 # s[224] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
13 00 0D # ildc 13 # c[13] = 12082
|
||||
10 FF # bipush -1 #
|
||||
82 # ixor # ~(12082)
|
||||
B7 00 00 # invokenative 0 # printint(~(12082))
|
||||
57 # pop # (ignore result)
|
||||
14 00 E4 # aldc 228 # s[228] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
14 00 E8 # aldc 232 # s[232] = "Testing bit shifting"
|
||||
B7 00 02 # invokenative 2 # println("Testing bit shifting")
|
||||
57 # pop # (ignore result)
|
||||
10 01 # bipush 1 # 1
|
||||
10 1F # bipush 31 # 31
|
||||
78 # ishl # (1 << 31)
|
||||
B7 00 00 # invokenative 0 # printint((1 << 31))
|
||||
57 # pop # (ignore result)
|
||||
14 00 FD # aldc 253 # s[253] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 17 # bipush 23 # 23
|
||||
10 05 # bipush 5 # 5
|
||||
78 # ishl # (23 << 5)
|
||||
B7 00 00 # invokenative 0 # printint((23 << 5))
|
||||
57 # pop # (ignore result)
|
||||
14 01 01 # aldc 257 # s[257] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 01 # bipush 1 # 1
|
||||
10 05 # bipush 5 # 5
|
||||
7A # ishr # (1 >> 5)
|
||||
10 07 # bipush 7 # 7
|
||||
78 # ishl # ((1 >> 5) << 7)
|
||||
B7 00 00 # invokenative 0 # printint(((1 >> 5) << 7))
|
||||
57 # pop # (ignore result)
|
||||
14 01 05 # aldc 261 # s[261] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
13 00 0E # ildc 14 # c[14] = 2352352
|
||||
10 02 # bipush 2 # 2
|
||||
7A # ishr # (2352352 >> 2)
|
||||
B7 00 00 # invokenative 0 # printint((2352352 >> 2))
|
||||
57 # pop # (ignore result)
|
||||
14 01 09 # aldc 265 # s[265] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 FA # bipush -6 # -6
|
||||
10 19 # bipush 25 # 25
|
||||
64 # isub # (-(6) - 25)
|
||||
B7 00 00 # invokenative 0 # printint((-(6) - 25))
|
||||
57 # pop # (ignore result)
|
||||
14 01 0D # aldc 269 # s[269] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
10 06 # bipush 6 # 6
|
||||
10 19 # bipush 25 # 25
|
||||
64 # isub # (6 - 25)
|
||||
B7 00 00 # invokenative 0 # printint((6 - 25))
|
||||
57 # pop # (ignore result)
|
||||
14 01 11 # aldc 273 # s[273] = " "
|
||||
B7 00 01 # invokenative 1 # print(" ")
|
||||
57 # pop # (ignore result)
|
||||
14 01 15 # aldc 277 # s[277] = ""
|
||||
B7 00 02 # invokenative 2 # println("")
|
||||
57 # pop # (ignore result)
|
||||
10 00 # bipush 0 # 0
|
||||
B0 # return #
|
||||
|
||||
00 03 # native count
|
||||
# native pool
|
||||
00 01 00 13 # printint
|
||||
00 01 00 10 # print
|
||||
00 01 00 14 # println
|
||||
|
||||
6
test/arith.c0.bc0out
Normal file
@@ -0,0 +1,6 @@
|
||||
-2147483648 2147483647 -375 -2147483648 -9 -1 12
|
||||
-12 12 Modulus testing 11-1 5 1 Testing constants -251 Testing inequalities
|
||||
y1 y2 y3 n4 n5 n6 y7 Testing bitwise operators
|
||||
992000 1045310 53250 -12083 Testing bit shifting
|
||||
-2147483648 736 0 588088 -31 -19
|
||||
0
|
||||
6
test/arith.c0.c0out
Normal file
@@ -0,0 +1,6 @@
|
||||
-2147483648 2147483647 -375 -2147483648 -9 -1 12
|
||||
-12 12 Modulus testing 11-1 5 1 Testing constants -251 Testing inequalities
|
||||
y1 y2 y3 n4 n5 n6 y7 Testing bitwise operators
|
||||
992000 1045310 53250 -12083 Testing bit shifting
|
||||
-2147483648 736 0 588088 -31 -19
|
||||
0
|
||||
BIN
test/arith.c0.ex
Executable file
@@ -48,5 +48,5 @@ B0 # return #
|
||||
|
||||
00 01 # native count
|
||||
# native pool
|
||||
00 01 00 09 # printint
|
||||
00 01 00 10 # printint
|
||||
|
||||
|
||||
7
test/chararrays.c0
Normal file
@@ -0,0 +1,7 @@
|
||||
#use <conio>
|
||||
|
||||
int main() {
|
||||
char[] A = alloc_array(char, 5);
|
||||
printchar(A[3]);
|
||||
return 0;
|
||||
}
|
||||
3
test/easyMath.c0
Normal file
@@ -0,0 +1,3 @@
|
||||
int main() {
|
||||
return (23 * 19)<<2;
|
||||
}
|
||||
26
test/easyMath.c0.bc0
Normal file
@@ -0,0 +1,26 @@
|
||||
C0 C0 FF EE # magic number
|
||||
00 09 # version 4, arch = 1 (64 bits)
|
||||
|
||||
00 00 # int pool count
|
||||
# int pool
|
||||
|
||||
00 00 # string pool total size
|
||||
# string pool
|
||||
|
||||
00 01 # function count
|
||||
# function_pool
|
||||
|
||||
#<main>
|
||||
00 00 # number of arguments = 0
|
||||
00 00 # number of local variables = 0
|
||||
00 09 # code length = 9 bytes
|
||||
10 17 # bipush 23 # 23
|
||||
10 13 # bipush 19 # 19
|
||||
68 # imul # (23 * 19)
|
||||
10 02 # bipush 2 # 2
|
||||
78 # ishl # ((23 * 19) << 2)
|
||||
B0 # return #
|
||||
|
||||
00 00 # native count
|
||||
# native pool
|
||||
|
||||
1
test/easyMath.c0.bc0out
Normal file
@@ -0,0 +1 @@
|
||||
1748
|
||||
1
test/easyMath.c0.c0out
Normal file
@@ -0,0 +1 @@
|
||||
1748
|
||||
BIN
test/easyMath.c0.ex
Executable file
9
test/hellosir.c0
Normal file
@@ -0,0 +1,9 @@
|
||||
#use <conio>
|
||||
#use <string>
|
||||
|
||||
int main () {
|
||||
print("What's your name? ");
|
||||
string name = readline();
|
||||
print(string_join("Hello, ", string_join(name, "!\n")));
|
||||
return 0;
|
||||
}
|
||||
40
test/hellosir.c0.bc0
Normal file
@@ -0,0 +1,40 @@
|
||||
C0 C0 FF EE # magic number
|
||||
00 09 # version 4, arch = 1 (64 bits)
|
||||
|
||||
00 00 # int pool count
|
||||
# int pool
|
||||
|
||||
00 1E # string pool total size
|
||||
# string pool
|
||||
57 68 61 74 27 73 20 79 6F 75 72 20 6E 61 6D 65 3F 20 00 # "What\'s your name\? "
|
||||
48 65 6C 6C 6F 2C 20 00 # "Hello, "
|
||||
21 0A 00 # "!\n"
|
||||
|
||||
00 01 # function count
|
||||
# function_pool
|
||||
|
||||
#<main>
|
||||
00 00 # number of arguments = 0
|
||||
00 01 # number of local variables = 1
|
||||
00 21 # code length = 33 bytes
|
||||
14 00 00 # aldc 0 # s[0] = "What\'s your name\? "
|
||||
B7 00 00 # invokenative 0 # print("What\'s your name\? ")
|
||||
57 # pop # (ignore result)
|
||||
B7 00 01 # invokenative 1 # readline()
|
||||
36 00 # vstore 0 # name = readline();
|
||||
14 00 13 # aldc 19 # s[19] = "Hello, "
|
||||
15 00 # vload 0 # name
|
||||
14 00 1B # aldc 27 # s[27] = "!\n"
|
||||
B7 00 02 # invokenative 2 # string_join(name, "!\n")
|
||||
B7 00 02 # invokenative 2 # string_join("Hello, ", string_join(name, "!\n"))
|
||||
B7 00 00 # invokenative 0 # print(string_join("Hello, ", string_join(name, "!\n")))
|
||||
57 # pop # (ignore result)
|
||||
10 00 # bipush 0 # 0
|
||||
B0 # return #
|
||||
|
||||
00 03 # native count
|
||||
# native pool
|
||||
00 01 00 06 # print
|
||||
00 00 00 0B # readline
|
||||
00 02 00 4F # string_join
|
||||
|
||||
2
test/hellosir.c0.bc0out
Normal file
@@ -0,0 +1,2 @@
|
||||
What's your name? Hello, uo!
|
||||
0
|
||||
2
test/hellosir.c0.c0out
Normal file
@@ -0,0 +1,2 @@
|
||||
What's your name? Hello, hi!
|
||||
0
|
||||
BIN
test/hellosir.c0.ex
Executable file
1
test/iadd.c0.bc0out
Normal file
@@ -0,0 +1 @@
|
||||
-2
|
||||
1
test/iadd.c0.c0out
Normal file
@@ -0,0 +1 @@
|
||||
-2
|
||||
BIN
test/iadd.c0.ex
Executable file
10
test/moreArrays.c0
Normal file
@@ -0,0 +1,10 @@
|
||||
#use <conio>
|
||||
|
||||
int main() {
|
||||
int[] A = alloc_array(int, 50);
|
||||
A[3] = 23;
|
||||
A[2] = 12;
|
||||
printint(A[3]);
|
||||
printint(A[2]);
|
||||
return 0;
|
||||
}
|
||||
48
test/moreArrays.c0.bc0
Normal file
@@ -0,0 +1,48 @@
|
||||
C0 C0 FF EE # magic number
|
||||
00 09 # version 4, arch = 1 (64 bits)
|
||||
|
||||
00 00 # int pool count
|
||||
# int pool
|
||||
|
||||
00 00 # string pool total size
|
||||
# string pool
|
||||
|
||||
00 01 # function count
|
||||
# function_pool
|
||||
|
||||
#<main>
|
||||
00 00 # number of arguments = 0
|
||||
00 01 # number of local variables = 1
|
||||
00 2D # code length = 45 bytes
|
||||
10 32 # bipush 50 # 50
|
||||
BC 04 # newarray 4 # alloc_array(int, 50)
|
||||
36 00 # vstore 0 # A = alloc_array(int, 50);
|
||||
15 00 # vload 0 # A
|
||||
10 03 # bipush 3 # 3
|
||||
63 # aadds # &A[3]
|
||||
10 17 # bipush 23 # 23
|
||||
4E # imstore # A[3] = 23;
|
||||
15 00 # vload 0 # A
|
||||
10 02 # bipush 2 # 2
|
||||
63 # aadds # &A[2]
|
||||
10 0C # bipush 12 # 12
|
||||
4E # imstore # A[2] = 12;
|
||||
15 00 # vload 0 # A
|
||||
10 03 # bipush 3 # 3
|
||||
63 # aadds # &A[3]
|
||||
2E # imload # A[3]
|
||||
B7 00 00 # invokenative 0 # printint(A[3])
|
||||
57 # pop # (ignore result)
|
||||
15 00 # vload 0 # A
|
||||
10 02 # bipush 2 # 2
|
||||
63 # aadds # &A[2]
|
||||
2E # imload # A[2]
|
||||
B7 00 00 # invokenative 0 # printint(A[2])
|
||||
57 # pop # (ignore result)
|
||||
10 00 # bipush 0 # 0
|
||||
B0 # return #
|
||||
|
||||
00 01 # native count
|
||||
# native pool
|
||||
00 01 00 13 # printint
|
||||
|
||||
1
test/moreArrays.c0.bc0out
Normal file
@@ -0,0 +1 @@
|
||||
23120
|
||||
1
test/moreArrays.c0.c0out
Normal file
@@ -0,0 +1 @@
|
||||
23120
|
||||
BIN
test/moreArrays.c0.ex
Executable file
22
test/piazza1.c0
Normal file
@@ -0,0 +1,22 @@
|
||||
struct s
|
||||
{
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int[] a;
|
||||
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
struct s* example=alloc(struct s);
|
||||
example->y=5;
|
||||
example->x=6;
|
||||
int x = example->x + 1;
|
||||
example->a=alloc_array(int,4);
|
||||
example->a[0] = 5;
|
||||
int y = example->a[0];
|
||||
example->a[0]=3;
|
||||
//@assert(\length(example->a)==4);
|
||||
return example->x + x +y;
|
||||
}
|
||||
70
test/piazza1.c0.bc0
Normal file
@@ -0,0 +1,70 @@
|
||||
C0 C0 FF EE # magic number
|
||||
00 09 # version 4, arch = 1 (64 bits)
|
||||
|
||||
00 00 # int pool count
|
||||
# int pool
|
||||
|
||||
00 00 # string pool total size
|
||||
# string pool
|
||||
|
||||
00 01 # function count
|
||||
# function_pool
|
||||
|
||||
#<main>
|
||||
00 00 # number of arguments = 0
|
||||
00 03 # number of local variables = 3
|
||||
00 52 # code length = 82 bytes
|
||||
BB 10 # new 16 # alloc(struct s)
|
||||
36 00 # vstore 0 # example = alloc(struct s);
|
||||
15 00 # vload 0 # example
|
||||
62 04 # aaddf 4 # &example->y
|
||||
10 05 # bipush 5 # 5
|
||||
4E # imstore # example->y = 5;
|
||||
15 00 # vload 0 # example
|
||||
62 00 # aaddf 0 # &example->x
|
||||
10 06 # bipush 6 # 6
|
||||
4E # imstore # example->x = 6;
|
||||
15 00 # vload 0 # example
|
||||
62 00 # aaddf 0 # &example->x
|
||||
2E # imload # example->x
|
||||
10 01 # bipush 1 # 1
|
||||
60 # iadd # (example->x + 1)
|
||||
36 01 # vstore 1 # x = (example->x + 1);
|
||||
15 00 # vload 0 # example
|
||||
62 08 # aaddf 8 # &example->a
|
||||
10 04 # bipush 4 # 4
|
||||
BC 04 # newarray 4 # alloc_array(int, 4)
|
||||
4F # amstore # example->a = alloc_array(int, 4);
|
||||
15 00 # vload 0 # example
|
||||
62 08 # aaddf 8 # &example->a
|
||||
2F # amload # example->a
|
||||
10 00 # bipush 0 # 0
|
||||
63 # aadds # &example->a[0]
|
||||
10 05 # bipush 5 # 5
|
||||
4E # imstore # example->a[0] = 5;
|
||||
15 00 # vload 0 # example
|
||||
62 08 # aaddf 8 # &example->a
|
||||
2F # amload # example->a
|
||||
10 00 # bipush 0 # 0
|
||||
63 # aadds # &example->a[0]
|
||||
2E # imload # example->a[0]
|
||||
36 02 # vstore 2 # y = example->a[0];
|
||||
15 00 # vload 0 # example
|
||||
62 08 # aaddf 8 # &example->a
|
||||
2F # amload # example->a
|
||||
10 00 # bipush 0 # 0
|
||||
63 # aadds # &example->a[0]
|
||||
10 03 # bipush 3 # 3
|
||||
4E # imstore # example->a[0] = 3;
|
||||
15 00 # vload 0 # example
|
||||
62 00 # aaddf 0 # &example->x
|
||||
2E # imload # example->x
|
||||
15 01 # vload 1 # x
|
||||
60 # iadd # (example->x + x)
|
||||
15 02 # vload 2 # y
|
||||
60 # iadd # ((example->x + x) + y)
|
||||
B0 # return #
|
||||
|
||||
00 00 # native count
|
||||
# native pool
|
||||
|
||||
1
test/piazza1.c0.bc0out
Normal file
@@ -0,0 +1 @@
|
||||
18
|
||||
1
test/piazza1.c0.c0out
Normal file
@@ -0,0 +1 @@
|
||||
18
|
||||
BIN
test/piazza1.c0.ex
Executable file
29
test/strings.c0
Normal file
@@ -0,0 +1,29 @@
|
||||
#use <conio>
|
||||
#use <string>
|
||||
|
||||
char char_tolower(char c) {
|
||||
int ccode = char_ord(c);
|
||||
if (char_ord('A') <= ccode && ccode <= char_ord('Z')) {
|
||||
int shift = char_ord('a') - char_ord('A');
|
||||
return char_chr(ccode + shift);
|
||||
} else {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
string string_lower(string s)
|
||||
//@ensures string_length(s) == string_length(\result);
|
||||
{
|
||||
int len = string_length(s);
|
||||
char[] A = string_to_chararray(s);
|
||||
char[] B = alloc_array(char, len+1);
|
||||
for (int i = 0; i < len; i++)
|
||||
B[i] = char_tolower(A[i]);
|
||||
B[len] = '\0'; /* redundant */
|
||||
return string_from_chararray(B);
|
||||
}
|
||||
|
||||
int main() {
|
||||
print (string_lower("HEllo There!?"));
|
||||
return 0;
|
||||
}
|
||||
118
test/strings.c0.bc0
Normal file
@@ -0,0 +1,118 @@
|
||||
C0 C0 FF EE # magic number
|
||||
00 09 # version 4, arch = 1 (64 bits)
|
||||
|
||||
00 00 # int pool count
|
||||
# int pool
|
||||
|
||||
00 0E # string pool total size
|
||||
# string pool
|
||||
48 45 6C 6C 6F 20 54 68 65 72 65 21 3F 00 # "HEllo There!\?"
|
||||
|
||||
00 03 # function count
|
||||
# function_pool
|
||||
|
||||
#<main>
|
||||
00 00 # number of arguments = 0
|
||||
00 05 # number of local variables = 5
|
||||
00 0D # code length = 13 bytes
|
||||
14 00 00 # aldc 0 # s[0] = "HEllo There!\?"
|
||||
B8 00 02 # invokestatic 2 # string_lower("HEllo There!\?")
|
||||
B7 00 05 # invokenative 5 # print(string_lower("HEllo There!\?"))
|
||||
57 # pop # (ignore result)
|
||||
10 00 # bipush 0 # 0
|
||||
B0 # return #
|
||||
|
||||
|
||||
#<char_tolower>
|
||||
00 01 # number of arguments = 1
|
||||
00 03 # number of local variables = 3
|
||||
00 3D # code length = 61 bytes
|
||||
15 00 # vload 0 # c
|
||||
B7 00 00 # invokenative 0 # char_ord(c)
|
||||
36 01 # vstore 1 # ccode = char_ord(c);
|
||||
10 41 # bipush 65 # 'A'
|
||||
B7 00 00 # invokenative 0 # char_ord('A')
|
||||
15 01 # vload 1 # ccode
|
||||
A4 00 06 # if_icmple +6 # if (char_ord('A') <= ccode) goto <03:and>
|
||||
A7 00 29 # goto +41 # goto <01:else>
|
||||
# <03:and>
|
||||
15 01 # vload 1 # ccode
|
||||
10 5A # bipush 90 # 'Z'
|
||||
B7 00 00 # invokenative 0 # char_ord('Z')
|
||||
A4 00 06 # if_icmple +6 # if (ccode <= char_ord('Z')) goto <00:then>
|
||||
A7 00 1C # goto +28 # goto <01:else>
|
||||
# <00:then>
|
||||
10 61 # bipush 97 # 'a'
|
||||
B7 00 00 # invokenative 0 # char_ord('a')
|
||||
10 41 # bipush 65 # 'A'
|
||||
B7 00 00 # invokenative 0 # char_ord('A')
|
||||
64 # isub # (char_ord('a') - char_ord('A'))
|
||||
36 02 # vstore 2 # shift = (char_ord('a') - char_ord('A'));
|
||||
15 01 # vload 1 # ccode
|
||||
15 02 # vload 2 # shift
|
||||
60 # iadd # (ccode + shift)
|
||||
B7 00 01 # invokenative 1 # char_chr((ccode + shift))
|
||||
B0 # return #
|
||||
A7 00 06 # goto +6 # goto <02:endif>
|
||||
# <01:else>
|
||||
15 00 # vload 0 # c
|
||||
B0 # return #
|
||||
# <02:endif>
|
||||
|
||||
|
||||
#<string_lower>
|
||||
00 01 # number of arguments = 1
|
||||
00 05 # number of local variables = 5
|
||||
00 4C # code length = 76 bytes
|
||||
15 00 # vload 0 # s
|
||||
B7 00 02 # invokenative 2 # string_length(s)
|
||||
36 01 # vstore 1 # len = string_length(s);
|
||||
15 00 # vload 0 # s
|
||||
B7 00 03 # invokenative 3 # string_to_chararray(s)
|
||||
36 02 # vstore 2 # A = string_to_chararray(s);
|
||||
15 01 # vload 1 # len
|
||||
10 01 # bipush 1 # 1
|
||||
60 # iadd # (len + 1)
|
||||
BC 01 # newarray 1 # alloc_array(char, (len + 1))
|
||||
36 03 # vstore 3 # B = alloc_array(char, (len + 1));
|
||||
10 00 # bipush 0 # 0
|
||||
36 04 # vstore 4 # i = 0;
|
||||
# <04:loop>
|
||||
15 04 # vload 4 # i
|
||||
15 01 # vload 1 # len
|
||||
A1 00 06 # if_icmplt +6 # if (i < len) goto <05:body>
|
||||
A7 00 1C # goto +28 # goto <06:exit>
|
||||
# <05:body>
|
||||
15 03 # vload 3 # B
|
||||
15 04 # vload 4 # i
|
||||
63 # aadds # &B[i]
|
||||
15 02 # vload 2 # A
|
||||
15 04 # vload 4 # i
|
||||
63 # aadds # &A[i]
|
||||
34 # cmload # A[i]
|
||||
B8 00 01 # invokestatic 1 # char_tolower(A[i])
|
||||
55 # cmstore # B[i] = char_tolower(A[i]);
|
||||
15 04 # vload 4 # i
|
||||
10 01 # bipush 1 # 1
|
||||
60 # iadd #
|
||||
36 04 # vstore 4 # i += 1;
|
||||
A7 FF E0 # goto -32 # goto <04:loop>
|
||||
# <06:exit>
|
||||
15 03 # vload 3 # B
|
||||
15 01 # vload 1 # len
|
||||
63 # aadds # &B[len]
|
||||
10 00 # bipush 0 # '\000'
|
||||
55 # cmstore # B[len] = '\0';
|
||||
15 03 # vload 3 # B
|
||||
B7 00 04 # invokenative 4 # string_from_chararray(B)
|
||||
B0 # return #
|
||||
|
||||
00 06 # native count
|
||||
# native pool
|
||||
00 01 00 51 # char_ord
|
||||
00 01 00 50 # char_chr
|
||||
00 01 00 5A # string_length
|
||||
00 01 00 5D # string_to_chararray
|
||||
00 01 00 55 # string_from_chararray
|
||||
00 01 00 10 # print
|
||||
|
||||
1
test/strings.c0.bc0out
Normal file
@@ -0,0 +1 @@
|
||||
hello there!?0
|
||||
1
test/strings.c0.c0out
Normal file
@@ -0,0 +1 @@
|
||||
hello there!?0
|
||||
BIN
test/strings.c0.ex
Executable file
25
test/swapTest.c0.bc0
Normal file
@@ -0,0 +1,25 @@
|
||||
C0 C0 FF EE # magic number
|
||||
00 09 # version 4, arch = 1 (64 bits)
|
||||
|
||||
00 00 # int pool count
|
||||
# int pool
|
||||
|
||||
00 00 # string pool total size
|
||||
# string pool
|
||||
|
||||
00 01 # function count
|
||||
# function_pool
|
||||
|
||||
#<main>
|
||||
00 00 # number of arguments = 0
|
||||
00 00 # number of local variables = 0
|
||||
00 07 # code length = 6 bytes
|
||||
10 FF # bipush -1 # -1
|
||||
10 23
|
||||
5F
|
||||
57
|
||||
B0 # return #
|
||||
|
||||
00 00 # native count
|
||||
# native pool
|
||||
|
||||
7
test/testError.c0
Normal file
@@ -0,0 +1,7 @@
|
||||
#use <conio>
|
||||
|
||||
int main() {
|
||||
assert(2==2);
|
||||
print("yolomode");
|
||||
return 1;
|
||||
}
|
||||