diff --git a/CS-MIC/csmic/.vs/csmic/DesignTimeBuild/.dtbcache b/CS-MIC/csmic/.vs/csmic/DesignTimeBuild/.dtbcache
new file mode 100644
index 0000000..25e0b96
Binary files /dev/null and b/CS-MIC/csmic/.vs/csmic/DesignTimeBuild/.dtbcache differ
diff --git a/CS-MIC/csmic/.vs/csmic/v15/.suo b/CS-MIC/csmic/.vs/csmic/v15/.suo
new file mode 100644
index 0000000..4bccefe
Binary files /dev/null and b/CS-MIC/csmic/.vs/csmic/v15/.suo differ
diff --git a/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/db.lock b/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/db.lock
new file mode 100644
index 0000000..e69de29
diff --git a/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/storage.ide b/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/storage.ide
new file mode 100644
index 0000000..56758a8
Binary files /dev/null and b/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/storage.ide differ
diff --git a/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/storage.ide-shm b/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/storage.ide-shm
new file mode 100644
index 0000000..58f3d59
Binary files /dev/null and b/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/storage.ide-shm differ
diff --git a/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/storage.ide-wal b/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/storage.ide-wal
new file mode 100644
index 0000000..f5e5e53
Binary files /dev/null and b/CS-MIC/csmic/.vs/csmic/v15/Server/sqlite3/storage.ide-wal differ
diff --git a/CS-MIC/csmic/CSMICTests/CSMICTests.csproj b/CS-MIC/csmic/CSMICTests/CSMICTests.csproj
index 000d928..be90d28 100644
--- a/CS-MIC/csmic/CSMICTests/CSMICTests.csproj
+++ b/CS-MIC/csmic/CSMICTests/CSMICTests.csproj
@@ -84,9 +84,6 @@
csmic
-
-
-
False
@@ -109,6 +106,7 @@
true
+
begin
using System;
-using System.CodeDom.Compiler;
-->namespace
-[GeneratedCodeAttribute("Coco/R", "")]
public class Parser {
-->constants
- const bool T = true;
- const bool x = false;
+ const bool _T = true;
+ const bool _x = false;
const int minErrDist = 2;
public Scanner scanner;
@@ -110,7 +108,6 @@ public class Parser {
la.val = "";
Get();
-->parseRoot
- Expect(0);
}
static readonly bool[,] set = {
@@ -121,35 +118,35 @@ public class Parser {
public class Errors {
public int count = 0; // number of errors detected
- public StringBuilder builder = new StringBuilder(); // error messages go to this stream
- public string errMsgFormat = "-- position {0}: {1}"; // 0=line, 1=column, 2=text
-
- public void SynErr (int line, int col, int n) {
+ public System.IO.TextWriter errorStream = Console.Out; // error messages go to this stream
+ public string errMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text
+
+ public virtual void SynErr (int line, int col, int n) {
string s;
switch (n) {
-->errors
default: s = "error " + n; break;
}
- builder.AppendFormat(errMsgFormat, col, s);
+ errorStream.WriteLine(errMsgFormat, line, col, s);
count++;
}
- public void SemErr (int line, int col, string s) {
- builder.AppendFormat(errMsgFormat, col, s);
+ public virtual void SemErr (int line, int col, string s) {
+ errorStream.WriteLine(errMsgFormat, line, col, s);
count++;
}
- public void SemErr (string s) {
- builder.AppendLine(s);
+ public virtual void SemErr (string s) {
+ errorStream.WriteLine(s);
count++;
}
- public void Warning (int line, int col, string s) {
- builder.AppendFormat(errMsgFormat, col, s);
+ public virtual void Warning (int line, int col, string s) {
+ errorStream.WriteLine(errMsgFormat, line, col, s);
}
- public void Warning(string s) {
- builder.AppendLine(s);
+ public virtual void Warning(string s) {
+ errorStream.WriteLine(s);
}
} // Errors
@@ -157,4 +154,3 @@ public class Errors {
public class FatalError: Exception {
public FatalError(string m): base(m) {}
}
-
diff --git a/CS-MIC/csmic/csmic/InterpreterParser/Scanner.cs b/CS-MIC/csmic/csmic/InterpreterParser/Scanner.cs
index 630ede2..abecef8 100644
--- a/CS-MIC/csmic/csmic/InterpreterParser/Scanner.cs
+++ b/CS-MIC/csmic/csmic/InterpreterParser/Scanner.cs
@@ -2,12 +2,9 @@
using System;
using System.IO;
using System.Collections;
-using System.Collections.Generic;
-using System.CodeDom.Compiler;
namespace csmic.Interpreter {
-[GeneratedCodeAttribute("Coco/R", "")]
public class Token {
public int kind; // token kind
public int pos; // token position in bytes in the source text (starting at 0)
@@ -219,7 +216,7 @@ public class Scanner {
int col; // column number of current character
int line; // line number of current character
int oldEols; // EOLs that appeared in a comment;
- static readonly Dictionary start; // maps first token character to start state
+ static readonly Hashtable start; // maps first token character to start state
Token tokens; // list of tokens already peeked (first token is a dummy)
Token pt; // current peek token
@@ -228,7 +225,7 @@ public class Scanner {
int tlen; // length of current token
static Scanner() {
- start = new Dictionary(128);
+ start = new Hashtable(128);
for (int i = 65; i <= 90; ++i) start[i] = 1;
for (int i = 97; i <= 122; ++i) start[i] = 1;
start[43] = 2;
@@ -332,7 +329,8 @@ public class Scanner {
t = new Token();
t.pos = pos; t.col = col; t.line = line; t.charPos = charPos;
int state;
- state = (int) start[ch];
+ if (start.ContainsKey(ch)) { state = (int) start[ch]; }
+ else { state = 0; }
tlen = 0; AddCh();
switch (state) {
diff --git a/CS-MIC/csmic/csmic/InterpreterParser/Scanner.cs.old b/CS-MIC/csmic/csmic/InterpreterParser/Scanner.cs.old
new file mode 100644
index 0000000..8c97818
--- /dev/null
+++ b/CS-MIC/csmic/csmic/InterpreterParser/Scanner.cs.old
@@ -0,0 +1,489 @@
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace csmic.Interpreter {
+
+public class Token {
+ public int kind; // token kind
+ public int pos; // token position in bytes in the source text (starting at 0)
+ public int charPos; // token position in characters in the source text (starting at 0)
+ public int col; // token column (starting at 1)
+ public int line; // token line (starting at 1)
+ public string val; // token value
+ public Token next; // ML 2005-03-11 Tokens are kept in linked list
+}
+
+//-----------------------------------------------------------------------------------
+// Buffer
+//-----------------------------------------------------------------------------------
+public class Buffer {
+ // This Buffer supports the following cases:
+ // 1) seekable stream (file)
+ // a) whole stream in buffer
+ // b) part of stream in buffer
+ // 2) non seekable stream (network, console)
+
+ public const int EOF = char.MaxValue + 1;
+ const int MIN_BUFFER_LENGTH = 1024; // 1KB
+ const int MAX_BUFFER_LENGTH = MIN_BUFFER_LENGTH * 64; // 64KB
+ byte[] buf; // input buffer
+ int bufStart; // position of first byte in buffer relative to input stream
+ int bufLen; // length of buffer
+ int fileLen; // length of input stream (may change if the stream is no file)
+ int bufPos; // current position in buffer
+ Stream stream; // input stream (seekable)
+ bool isUserStream; // was the stream opened by the user?
+
+ public Buffer (Stream s, bool isUserStream) {
+ stream = s; this.isUserStream = isUserStream;
+
+ if (stream.CanSeek) {
+ fileLen = (int) stream.Length;
+ bufLen = Math.Min(fileLen, MAX_BUFFER_LENGTH);
+ bufStart = Int32.MaxValue; // nothing in the buffer so far
+ } else {
+ fileLen = bufLen = bufStart = 0;
+ }
+
+ buf = new byte[(bufLen>0) ? bufLen : MIN_BUFFER_LENGTH];
+ if (fileLen > 0) Pos = 0; // setup buffer to position 0 (start)
+ else bufPos = 0; // index 0 is already after the file, thus Pos = 0 is invalid
+ if (bufLen == fileLen && stream.CanSeek) Close();
+ }
+
+ protected Buffer(Buffer b) { // called in UTF8Buffer constructor
+ buf = b.buf;
+ bufStart = b.bufStart;
+ bufLen = b.bufLen;
+ fileLen = b.fileLen;
+ bufPos = b.bufPos;
+ stream = b.stream;
+ // keep destructor from closing the stream
+ b.stream = null;
+ isUserStream = b.isUserStream;
+ }
+
+ ~Buffer() { Close(); }
+
+ protected void Close() {
+ if (!isUserStream && stream != null) {
+ stream.Close();
+ stream = null;
+ }
+ }
+
+ public virtual int Read () {
+ if (bufPos < bufLen) {
+ return buf[bufPos++];
+ } else if (Pos < fileLen) {
+ Pos = Pos; // shift buffer start to Pos
+ return buf[bufPos++];
+ } else if (stream != null && !stream.CanSeek && ReadNextStreamChunk() > 0) {
+ return buf[bufPos++];
+ } else {
+ return EOF;
+ }
+ }
+
+ public int Peek () {
+ int curPos = Pos;
+ int ch = Read();
+ Pos = curPos;
+ return ch;
+ }
+
+ // beg .. begin, zero-based, inclusive, in byte
+ // end .. end, zero-based, exclusive, in byte
+ public string GetString (int beg, int end) {
+ int len = 0;
+ char[] buf = new char[end - beg];
+ int oldPos = Pos;
+ Pos = beg;
+ while (Pos < end) buf[len++] = (char) Read();
+ Pos = oldPos;
+ return new String(buf, 0, len);
+ }
+
+ public int Pos {
+ get { return bufPos + bufStart; }
+ set {
+ if (value >= fileLen && stream != null && !stream.CanSeek) {
+ // Wanted position is after buffer and the stream
+ // is not seek-able e.g. network or console,
+ // thus we have to read the stream manually till
+ // the wanted position is in sight.
+ while (value >= fileLen && ReadNextStreamChunk() > 0);
+ }
+
+ if (value < 0 || value > fileLen) {
+ throw new FatalError("buffer out of bounds access, position: " + value);
+ }
+
+ if (value >= bufStart && value < bufStart + bufLen) { // already in buffer
+ bufPos = value - bufStart;
+ } else if (stream != null) { // must be swapped in
+ stream.Seek(value, SeekOrigin.Begin);
+ bufLen = stream.Read(buf, 0, buf.Length);
+ bufStart = value; bufPos = 0;
+ } else {
+ // set the position to the end of the file, Pos will return fileLen.
+ bufPos = fileLen - bufStart;
+ }
+ }
+ }
+
+ // Read the next chunk of bytes from the stream, increases the buffer
+ // if needed and updates the fields fileLen and bufLen.
+ // Returns the number of bytes read.
+ private int ReadNextStreamChunk() {
+ int free = buf.Length - bufLen;
+ if (free == 0) {
+ // in the case of a growing input stream
+ // we can neither seek in the stream, nor can we
+ // foresee the maximum length, thus we must adapt
+ // the buffer size on demand.
+ byte[] newBuf = new byte[bufLen * 2];
+ Array.Copy(buf, newBuf, bufLen);
+ buf = newBuf;
+ free = bufLen;
+ }
+ int read = stream.Read(buf, bufLen, free);
+ if (read > 0) {
+ fileLen = bufLen = (bufLen + read);
+ return read;
+ }
+ // end of stream reached
+ return 0;
+ }
+}
+
+//-----------------------------------------------------------------------------------
+// UTF8Buffer
+//-----------------------------------------------------------------------------------
+public class UTF8Buffer: Buffer {
+ public UTF8Buffer(Buffer b): base(b) {}
+
+ public override int Read() {
+ int ch;
+ do {
+ ch = base.Read();
+ // until we find a utf8 start (0xxxxxxx or 11xxxxxx)
+ } while ((ch >= 128) && ((ch & 0xC0) != 0xC0) && (ch != EOF));
+ if (ch < 128 || ch == EOF) {
+ // nothing to do, first 127 chars are the same in ascii and utf8
+ // 0xxxxxxx or end of file character
+ } else if ((ch & 0xF0) == 0xF0) {
+ // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ int c1 = ch & 0x07; ch = base.Read();
+ int c2 = ch & 0x3F; ch = base.Read();
+ int c3 = ch & 0x3F; ch = base.Read();
+ int c4 = ch & 0x3F;
+ ch = (((((c1 << 6) | c2) << 6) | c3) << 6) | c4;
+ } else if ((ch & 0xE0) == 0xE0) {
+ // 1110xxxx 10xxxxxx 10xxxxxx
+ int c1 = ch & 0x0F; ch = base.Read();
+ int c2 = ch & 0x3F; ch = base.Read();
+ int c3 = ch & 0x3F;
+ ch = (((c1 << 6) | c2) << 6) | c3;
+ } else if ((ch & 0xC0) == 0xC0) {
+ // 110xxxxx 10xxxxxx
+ int c1 = ch & 0x1F; ch = base.Read();
+ int c2 = ch & 0x3F;
+ ch = (c1 << 6) | c2;
+ }
+ return ch;
+ }
+}
+
+//-----------------------------------------------------------------------------------
+// Scanner
+//-----------------------------------------------------------------------------------
+public class Scanner {
+ const char EOL = '\n';
+ const int eofSym = 0; /* pdt */
+ const int maxT = 22;
+ const int noSym = 22;
+
+
+ public Buffer buffer; // scanner buffer
+
+ Token t; // current token
+ int ch; // current input character
+ int pos; // byte position of current character
+ int charPos; // position by unicode characters starting with 0
+ int col; // column number of current character
+ int line; // line number of current character
+ int oldEols; // EOLs that appeared in a comment;
+ static readonly Hashtable start; // maps first token character to start state
+
+ Token tokens; // list of tokens already peeked (first token is a dummy)
+ Token pt; // current peek token
+
+ char[] tval = new char[128]; // text of current token
+ int tlen; // length of current token
+
+ static Scanner() {
+ start = new Hashtable(128);
+ for (int i = 65; i <= 90; ++i) start[i] = 1;
+ for (int i = 97; i <= 122; ++i) start[i] = 1;
+ start[43] = 2;
+ for (int i = 50; i <= 57; ++i) start[i] = 6;
+ start[48] = 17;
+ start[49] = 18;
+ start[34] = 11;
+ start[40] = 13;
+ start[41] = 14;
+ start[61] = 15;
+ start[60] = 19;
+ start[62] = 20;
+ start[42] = 21;
+ start[47] = 22;
+ start[37] = 23;
+ start[94] = 24;
+ start[91] = 25;
+ start[93] = 26;
+ start[44] = 27;
+ start[58] = 31;
+ start[45] = 32;
+ start[Buffer.EOF] = -1;
+
+ }
+
+ public Scanner (string fileName) {
+ try {
+ Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
+ buffer = new Buffer(stream, false);
+ Init();
+ } catch (IOException) {
+ throw new FatalError("Cannot open file " + fileName);
+ }
+ }
+
+ public Scanner (Stream s) {
+ buffer = new Buffer(s, true);
+ Init();
+ }
+
+ void Init() {
+ pos = -1; line = 1; col = 0; charPos = -1;
+ oldEols = 0;
+ NextCh();
+ if (ch == 0xEF) { // check optional byte order mark for UTF-8
+ NextCh(); int ch1 = ch;
+ NextCh(); int ch2 = ch;
+ if (ch1 != 0xBB || ch2 != 0xBF) {
+ throw new FatalError(String.Format("illegal byte order mark: EF {0,2:X} {1,2:X}", ch1, ch2));
+ }
+ buffer = new UTF8Buffer(buffer); col = 0; charPos = -1;
+ NextCh();
+ }
+ pt = tokens = new Token(); // first token is a dummy
+ }
+
+ void NextCh() {
+ if (oldEols > 0) { ch = EOL; oldEols--; }
+ else {
+ pos = buffer.Pos;
+ // buffer reads unicode chars, if UTF8 has been detected
+ ch = buffer.Read(); col++; charPos++;
+ // replace isolated '\r' by '\n' in order to make
+ // eol handling uniform across Windows, Unix and Mac
+ if (ch == '\r' && buffer.Peek() != '\n') ch = EOL;
+ if (ch == EOL) { line++; col = 0; }
+ }
+
+ }
+
+ void AddCh() {
+ if (tlen >= tval.Length) {
+ char[] newBuf = new char[2 * tval.Length];
+ Array.Copy(tval, 0, newBuf, 0, tval.Length);
+ tval = newBuf;
+ }
+ if (ch != Buffer.EOF) {
+ tval[tlen++] = (char) ch;
+ NextCh();
+ }
+ }
+
+
+
+
+ void CheckLiteral() {
+ switch (t.val) {
+ case "+": t.kind = 10; break;
+ case "-": t.kind = 11; break;
+ default: break;
+ }
+ }
+
+ Token NextToken() {
+ while (ch == ' ' ||
+ ch == 9 || ch == 13
+ ) NextCh();
+
+ int recKind = noSym;
+ int recEnd = pos;
+ t = new Token();
+ t.pos = pos; t.col = col; t.line = line; t.charPos = charPos;
+ int state;
+ if (start.ContainsKey(ch)) { state = (int) start[ch]; }
+ else { state = 0; }
+ tlen = 0; AddCh();
+
+ switch (state) {
+ case -1: { t.kind = eofSym; break; } // NextCh already done
+ case 0: {
+ if (recKind != noSym) {
+ tlen = recEnd - t.pos;
+ SetScannerBehindT();
+ }
+ t.kind = recKind; break;
+ } // NextCh already done
+ case 1:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z') {AddCh(); goto case 1;}
+ else {t.kind = 1; break;}
+ case 2:
+ {t.kind = 2; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 3:
+ {t.kind = 3; break;}
+ case 4:
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 5;}
+ else {goto case 0;}
+ case 5:
+ recEnd = pos; recKind = 4;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 5;}
+ else {t.kind = 4; break;}
+ case 6:
+ recEnd = pos; recKind = 5;
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 6;}
+ else if (ch == 'E' || ch == 'e') {AddCh(); goto case 7;}
+ else if (ch == '.') {AddCh(); goto case 10;}
+ else {t.kind = 5; break;}
+ case 7:
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 9;}
+ else if (ch == '+' || ch == '-') {AddCh(); goto case 8;}
+ else {goto case 0;}
+ case 8:
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 9;}
+ else {goto case 0;}
+ case 9:
+ recEnd = pos; recKind = 5;
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 9;}
+ else {t.kind = 5; break;}
+ case 10:
+ recEnd = pos; recKind = 5;
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 10;}
+ else if (ch == 'E' || ch == 'e') {AddCh(); goto case 7;}
+ else {t.kind = 5; break;}
+ case 11:
+ if (ch <= '!' || ch >= '#' && ch <= 65535) {AddCh(); goto case 11;}
+ else if (ch == '"') {AddCh(); goto case 12;}
+ else {goto case 0;}
+ case 12:
+ {t.kind = 6; break;}
+ case 13:
+ {t.kind = 7; break;}
+ case 14:
+ {t.kind = 8; break;}
+ case 15:
+ if (ch == '=') {AddCh(); goto case 16;}
+ else {goto case 0;}
+ case 16:
+ {t.kind = 9; break;}
+ case 17:
+ recEnd = pos; recKind = 5;
+ if (ch >= '2' && ch <= '9') {AddCh(); goto case 6;}
+ else if (ch == 'B' || ch == 'b') {AddCh(); goto case 3;}
+ else if (ch >= '0' && ch <= '1') {AddCh(); goto case 18;}
+ else if (ch == 'x') {AddCh(); goto case 4;}
+ else if (ch == 'E' || ch == 'e') {AddCh(); goto case 7;}
+ else if (ch == '.') {AddCh(); goto case 10;}
+ else {t.kind = 5; break;}
+ case 18:
+ recEnd = pos; recKind = 5;
+ if (ch >= '2' && ch <= '9') {AddCh(); goto case 6;}
+ else if (ch == 'B' || ch == 'b') {AddCh(); goto case 3;}
+ else if (ch >= '0' && ch <= '1') {AddCh(); goto case 18;}
+ else if (ch == 'E' || ch == 'e') {AddCh(); goto case 7;}
+ else if (ch == '.') {AddCh(); goto case 10;}
+ else {t.kind = 5; break;}
+ case 19:
+ recEnd = pos; recKind = 9;
+ if (ch == '=') {AddCh(); goto case 16;}
+ else {t.kind = 9; break;}
+ case 20:
+ recEnd = pos; recKind = 9;
+ if (ch == '=') {AddCh(); goto case 16;}
+ else {t.kind = 9; break;}
+ case 21:
+ {t.kind = 12; break;}
+ case 22:
+ {t.kind = 13; break;}
+ case 23:
+ {t.kind = 14; break;}
+ case 24:
+ {t.kind = 15; break;}
+ case 25:
+ {t.kind = 16; break;}
+ case 26:
+ {t.kind = 17; break;}
+ case 27:
+ {t.kind = 18; break;}
+ case 28:
+ {t.kind = 19; break;}
+ case 29:
+ {t.kind = 20; break;}
+ case 30:
+ {t.kind = 21; break;}
+ case 31:
+ if (ch == ':') {AddCh(); goto case 28;}
+ else if (ch == '=') {AddCh(); goto case 29;}
+ else {goto case 0;}
+ case 32:
+ recEnd = pos; recKind = 2;
+ if (ch == '>') {AddCh(); goto case 30;}
+ else {t.kind = 2; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+
+ }
+ t.val = new String(tval, 0, tlen);
+ return t;
+ }
+
+ private void SetScannerBehindT() {
+ buffer.Pos = t.pos;
+ NextCh();
+ line = t.line; col = t.col; charPos = t.charPos;
+ for (int i = 0; i < tlen; i++) NextCh();
+ }
+
+ // get the next token (possibly a token already seen during peeking)
+ public Token Scan () {
+ if (tokens.next == null) {
+ return NextToken();
+ } else {
+ pt = tokens = tokens.next;
+ return tokens;
+ }
+ }
+
+ // peek for the next token, ignore pragmas
+ public Token Peek () {
+ do {
+ if (pt.next == null) {
+ pt.next = NextToken();
+ }
+ pt = pt.next;
+ } while (pt.kind > maxT); // skip pragmas
+
+ return pt;
+ }
+
+ // make sure that peeking starts at the current scan position
+ public void ResetPeek () { pt = tokens; }
+
+} // end Scanner
+}
\ No newline at end of file
diff --git a/CS-MIC/csmic/csmic/InterpreterParser/Scanner.frame b/CS-MIC/csmic/csmic/InterpreterParser/Scanner.frame
index 8010e59..abac75d 100644
--- a/CS-MIC/csmic/csmic/InterpreterParser/Scanner.frame
+++ b/CS-MIC/csmic/csmic/InterpreterParser/Scanner.frame
@@ -28,12 +28,9 @@ Coco/R itself) does not fall under the GNU General Public License.
using System;
using System.IO;
using System.Collections;
-using System.Collections.Generic;
-using System.CodeDom.Compiler;
-->namespace
-[GeneratedCodeAttribute("Coco/R", "")]
public class Token {
public int kind; // token kind
public int pos; // token position in bytes in the source text (starting at 0)
@@ -243,7 +240,7 @@ public class Scanner {
int col; // column number of current character
int line; // line number of current character
int oldEols; // EOLs that appeared in a comment;
- static readonly Dictionary start; // maps first token character to start state
+ static readonly Hashtable start; // maps first token character to start state
Token tokens; // list of tokens already peeked (first token is a dummy)
Token pt; // current peek token
@@ -252,7 +249,7 @@ public class Scanner {
int tlen; // length of current token
static Scanner() {
- start = new Dictionary(128);
+ start = new Hashtable(128);
-->initialization
}
@@ -330,7 +327,8 @@ public class Scanner {
t = new Token();
t.pos = pos; t.col = col; t.line = line; t.charPos = charPos;
int state;
- state = (int) start[ch];
+ if (start.ContainsKey(ch)) { state = (int) start[ch]; }
+ else { state = 0; }
tlen = 0; AddCh();
switch (state) {
diff --git a/CS-MIC/csmic/csmic/ScriptParser/Parser.cs b/CS-MIC/csmic/csmic/ScriptParser/Parser.cs
index 4f29bbe..1906973 100644
--- a/CS-MIC/csmic/csmic/ScriptParser/Parser.cs
+++ b/CS-MIC/csmic/csmic/ScriptParser/Parser.cs
@@ -5,13 +5,11 @@ using System.Collections.Generic;
using System;
-using System.CodeDom.Compiler;
namespace csmic.Scripting {
-[GeneratedCodeAttribute("Coco/R", "")]
public class Parser {
public const int _EOF = 0;
public const int _identifier = 1;
@@ -26,8 +24,8 @@ public class Parser {
public const int _COMPARER = 10;
public const int maxT = 34;
- const bool T = true;
- const bool x = false;
+ const bool _T = true;
+ const bool _x = false;
const int minErrDist = 2;
public Scanner scanner;
@@ -702,15 +700,14 @@ bool IsArrayCall()
SCRIPT();
Expect(0);
- Expect(0);
}
static readonly bool[,] set = {
- {T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,T,x,T, T,T,x,x, T,x,x,T, x,x,x,T, T,x,T,T, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,T,x,T, T,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,T,x,T, T,T,x,x, T,x,x,T, x,x,x,T, T,x,x,T, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,T,x}
+ {_T,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x},
+ {_x,_T,_x,_T, _T,_T,_x,_x, _T,_x,_x,_T, _x,_x,_x,_T, _T,_x,_T,_T, _T,_T,_T,_T, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x},
+ {_x,_T,_x,_T, _T,_T,_x,_x, _T,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_T,_T, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x},
+ {_x,_T,_x,_T, _T,_T,_x,_x, _T,_x,_x,_T, _x,_x,_x,_T, _T,_x,_x,_T, _T,_T,_T,_T, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x},
+ {_x,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_x,_T,_x}
};
} // end Parser
@@ -719,9 +716,9 @@ bool IsArrayCall()
public class Errors {
public int count = 0; // number of errors detected
public System.IO.TextWriter errorStream = Console.Out; // error messages go to this stream
- public string errMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text
-
- public void SynErr (int line, int col, int n) {
+ public string errMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text
+
+ public virtual void SynErr (int line, int col, int n) {
string s;
switch (n) {
case 0: s = "EOF expected"; break;
@@ -771,21 +768,21 @@ public class Errors {
count++;
}
- public void SemErr (int line, int col, string s) {
+ public virtual void SemErr (int line, int col, string s) {
errorStream.WriteLine(errMsgFormat, line, col, s);
count++;
}
- public void SemErr (string s) {
+ public virtual void SemErr (string s) {
errorStream.WriteLine(s);
count++;
}
- public void Warning (int line, int col, string s) {
+ public virtual void Warning (int line, int col, string s) {
errorStream.WriteLine(errMsgFormat, line, col, s);
}
- public void Warning(string s) {
+ public virtual void Warning(string s) {
errorStream.WriteLine(s);
}
} // Errors
@@ -794,5 +791,4 @@ public class Errors {
public class FatalError: Exception {
public FatalError(string m): base(m) {}
}
-
}
\ No newline at end of file
diff --git a/CS-MIC/csmic/csmic/ScriptParser/Parser.cs.old b/CS-MIC/csmic/csmic/ScriptParser/Parser.cs.old
new file mode 100644
index 0000000..6995c23
--- /dev/null
+++ b/CS-MIC/csmic/csmic/ScriptParser/Parser.cs.old
@@ -0,0 +1,794 @@
+using csmic;
+using System.Text;
+using System.Collections.Generic;
+
+
+
+using System;
+
+namespace csmic.Scripting {
+
+
+
+public class Parser {
+ public const int _EOF = 0;
+ public const int _identifier = 1;
+ public const int _sign = 2;
+ public const int _binary = 3;
+ public const int _hex = 4;
+ public const int _number = 5;
+ public const int _newline = 6;
+ public const int _string = 7;
+ public const int _LPAREN = 8;
+ public const int _RPAREN = 9;
+ public const int _COMPARER = 10;
+ public const int maxT = 34;
+
+ const bool _T = true;
+ const bool _x = false;
+ const int minErrDist = 2;
+
+ public Scanner scanner;
+ public Errors errors;
+
+ public Token t; // last recognized token
+ public Token la; // lookahead token
+ int errDist = minErrDist;
+
+private MacroOperation root = new MacroOperation(OperationType.Unknown);
+
+internal MacroOperation Root
+{
+ get
+ {
+ return this.root;
+ }
+ set
+ {
+ this.root = value;
+ }
+}
+
+bool IsFunctionCall()
+{
+ scanner.ResetPeek();
+ Token next = scanner.Peek();
+ if (next.kind == _LPAREN && la.kind == _identifier)
+ return true;
+ return false;
+}
+
+bool IsCompare()
+{
+ scanner.ResetPeek();
+ Token next = scanner.Peek();
+ if (next.kind == _COMPARER)
+ return true;
+ return false;
+}
+
+bool IsAssignment()
+{
+ scanner.ResetPeek();
+ Token next = scanner.Peek();
+ if (next.val == "::" || next.val == ":=" || next.val == "->")
+ return true;
+ return false;
+}
+
+bool IsArrayCall()
+{
+ scanner.ResetPeek();
+ Token next = scanner.Peek();
+ if(next.val == "[")
+ return true;
+ return false;
+}
+
+
+
+ public Parser(Scanner scanner) {
+ this.scanner = scanner;
+ errors = new Errors();
+ }
+
+ void SynErr (int n) {
+ if (errDist >= minErrDist) errors.SynErr(la.line, la.col, n);
+ errDist = 0;
+ }
+
+ public void SemErr (string msg) {
+ if (errDist >= minErrDist) errors.SemErr(t.line, t.col, msg);
+ errDist = 0;
+ }
+
+ void Get () {
+ for (;;) {
+ t = la;
+ la = scanner.Scan();
+ if (la.kind <= maxT) { ++errDist; break; }
+
+ la = t;
+ }
+ }
+
+ void Expect (int n) {
+ if (la.kind==n) Get(); else { SynErr(n); }
+ }
+
+ bool StartOf (int s) {
+ return set[s, la.kind];
+ }
+
+ void ExpectWeak (int n, int follow) {
+ if (la.kind == n) Get();
+ else {
+ SynErr(n);
+ while (!StartOf(follow)) Get();
+ }
+ }
+
+
+ bool WeakSeparator(int n, int syFol, int repFol) {
+ int kind = la.kind;
+ if (kind == n) {Get(); return true;}
+ else if (StartOf(repFol)) {return false;}
+ else {
+ SynErr(n);
+ while (!(set[syFol, kind] || set[repFol, kind] || set[0, kind])) {
+ Get();
+ kind = la.kind;
+ }
+ return StartOf(syFol);
+ }
+ }
+
+
+ void SCRIPT() {
+ string statement = string.Empty;
+ while (StartOf(1)) {
+ switch (la.kind) {
+ case 1: case 3: case 4: case 5: case 8: case 22: case 23: {
+ Statement(out statement);
+ MacroOperation operation = new MacroOperation(OperationType.Statement);
+ operation.Input.Add(statement);
+ this.root.Children.Add(operation);
+
+ break;
+ }
+ case 11: {
+ IfBlock(ref this.root);
+ break;
+ }
+ case 15: {
+ WhileBlock(ref this.root);
+ break;
+ }
+ case 18: {
+ FunctionDeclaration(ref this.root);
+ break;
+ }
+ case 19: {
+ EchoStatement(ref this.root);
+ break;
+ }
+ case 20: {
+ SayStatement(ref this.root);
+ break;
+ }
+ case 21: {
+ DisplayStatement(ref this.root);
+ break;
+ }
+ case 16: {
+ ForBlock(ref this.root);
+ break;
+ }
+ }
+ }
+ }
+
+ void Statement(out string value) {
+ value = string.Empty;
+ StringBuilder builder = new StringBuilder();
+
+ if (IsAssignment()) {
+ Assignment(ref builder);
+ value = builder.ToString();
+ } else if (StartOf(2)) {
+ Expression(ref builder);
+ value = builder.ToString();
+ } else SynErr(35);
+ }
+
+ void IfBlock(ref MacroOperation parent) {
+ MacroOperation ifBlock = new MacroOperation(OperationType.If);
+ MacroOperation elseBlock = new MacroOperation(OperationType.Else);
+ string ifStatement = string.Empty;
+ string statement = string.Empty;
+ StringBuilder builder = new StringBuilder();
+ bool hasElse = false;
+
+ Expect(11);
+ Expect(8);
+ Comparison(ref builder);
+ ifStatement = builder.ToString(); ifBlock.Input.Add(ifStatement);
+ Expect(9);
+ Expect(12);
+ while (StartOf(3)) {
+ switch (la.kind) {
+ case 1: case 3: case 4: case 5: case 8: case 22: case 23: {
+ Statement(out statement);
+ MacroOperation operation = new MacroOperation(OperationType.Statement);
+ operation.Input.Add(statement);
+ ifBlock.Children.Add(operation);
+
+ break;
+ }
+ case 11: {
+ IfBlock(ref ifBlock);
+ break;
+ }
+ case 15: {
+ WhileBlock(ref ifBlock);
+ break;
+ }
+ case 19: {
+ EchoStatement(ref ifBlock);
+ break;
+ }
+ case 20: {
+ SayStatement(ref ifBlock);
+ break;
+ }
+ case 21: {
+ DisplayStatement(ref ifBlock);
+ break;
+ }
+ case 16: {
+ ForBlock(ref ifBlock);
+ break;
+ }
+ }
+ }
+ Expect(13);
+ if (la.kind == 14) {
+ Get();
+ hasElse = true;
+ Expect(12);
+ while (StartOf(3)) {
+ switch (la.kind) {
+ case 1: case 3: case 4: case 5: case 8: case 22: case 23: {
+ Statement(out statement);
+ MacroOperation operation = new MacroOperation(OperationType.Statement);
+ operation.Input.Add(statement);
+ elseBlock.Children.Add(operation);
+
+ break;
+ }
+ case 11: {
+ IfBlock(ref elseBlock);
+ break;
+ }
+ case 15: {
+ WhileBlock(ref elseBlock);
+ break;
+ }
+ case 19: {
+ EchoStatement(ref elseBlock);
+ break;
+ }
+ case 20: {
+ SayStatement(ref elseBlock);
+ break;
+ }
+ case 21: {
+ DisplayStatement(ref elseBlock);
+ break;
+ }
+ case 16: {
+ ForBlock(ref elseBlock);
+ break;
+ }
+ }
+ }
+ Expect(13);
+ }
+ if(hasElse)
+ {
+ MacroOperation ifelse = new MacroOperation(OperationType.IfElse);
+ ifelse.Children.Add(ifBlock);
+ ifelse.Children.Add(elseBlock);
+ parent.Children.Add(ifelse);
+ }
+ else
+ {
+ parent.Children.Add(ifBlock);
+ }
+
+ }
+
+ void WhileBlock(ref MacroOperation parent) {
+ StringBuilder builder = new StringBuilder();
+ MacroOperation whileBlock = new MacroOperation(OperationType.While);
+ string statement = string.Empty;
+
+ Expect(15);
+ Expect(8);
+ Comparison(ref builder);
+ whileBlock.Input.Add(builder.ToString());
+ Expect(9);
+ Expect(12);
+ while (StartOf(3)) {
+ switch (la.kind) {
+ case 1: case 3: case 4: case 5: case 8: case 22: case 23: {
+ Statement(out statement);
+ MacroOperation operation = new MacroOperation(OperationType.Statement);
+ operation.Input.Add(statement);
+ whileBlock.Children.Add(operation);
+
+ break;
+ }
+ case 11: {
+ IfBlock(ref whileBlock);
+ break;
+ }
+ case 15: {
+ WhileBlock(ref whileBlock);
+ break;
+ }
+ case 19: {
+ EchoStatement(ref whileBlock);
+ break;
+ }
+ case 20: {
+ SayStatement(ref whileBlock);
+ break;
+ }
+ case 21: {
+ DisplayStatement(ref whileBlock);
+ break;
+ }
+ case 16: {
+ ForBlock(ref whileBlock);
+ break;
+ }
+ }
+ }
+ Expect(13);
+ parent.Children.Add(whileBlock);
+
+ }
+
+ void FunctionDeclaration(ref MacroOperation parent) {
+ StringBuilder builder = new StringBuilder();
+ string statement = string.Empty;
+ MacroOperation func = new MacroOperation(OperationType.FunctionDeclaration);
+
+ Expect(18);
+ Expect(8);
+ CommaList(ref builder);
+ string[] args = builder.ToString().Split(','); func.Input.AddRange(args);
+ Expect(9);
+ Expect(12);
+ while (StartOf(3)) {
+ switch (la.kind) {
+ case 1: case 3: case 4: case 5: case 8: case 22: case 23: {
+ Statement(out statement);
+ MacroOperation operation = new MacroOperation(OperationType.Statement);
+ operation.Input.Add(statement);
+ func.Children.Add(operation);
+
+ break;
+ }
+ case 11: {
+ IfBlock(ref func);
+ break;
+ }
+ case 15: {
+ WhileBlock(ref func);
+ break;
+ }
+ case 19: {
+ EchoStatement(ref func);
+ break;
+ }
+ case 20: {
+ SayStatement(ref func);
+ break;
+ }
+ case 21: {
+ DisplayStatement(ref func);
+ break;
+ }
+ case 16: {
+ ForBlock(ref func);
+ break;
+ }
+ }
+ }
+ Expect(13);
+ parent.Children.Add(func);
+
+ }
+
+ void EchoStatement(ref MacroOperation parent) {
+ StringBuilder builder = new StringBuilder();
+ MacroOperation echoStatement = new MacroOperation(OperationType.Echo);
+ string statement = string.Empty;
+
+ Expect(19);
+ Statement(out statement);
+ MacroOperation operation = new MacroOperation(OperationType.Statement);
+ operation.Input.Add(statement);
+ echoStatement.Children.Add(operation);
+ parent.Children.Add(echoStatement);
+
+ }
+
+ void SayStatement(ref MacroOperation parent) {
+ StringBuilder builder = new StringBuilder();
+ MacroOperation sayStatement = new MacroOperation(OperationType.Say);
+ string statement = string.Empty;
+
+ Expect(20);
+ Expect(7);
+ statement = t.val.Replace("\"", "");
+ sayStatement.Input.Add(statement);
+ parent.Children.Add(sayStatement);
+
+ }
+
+ void DisplayStatement(ref MacroOperation parent) {
+ StringBuilder builder = new StringBuilder();
+ MacroOperation displayStatement = new MacroOperation(OperationType.Display);
+ string statement = string.Empty;
+
+ Expect(21);
+ if (StartOf(2)) {
+ Statement(out statement);
+ MacroOperation operation = new MacroOperation(OperationType.Statement);
+ operation.Input.Add(statement);
+ displayStatement.Children.Add(operation);
+
+ } else if (la.kind == 7) {
+ Get();
+ statement = t.val.Replace("\"", "");
+ MacroOperation operation = new MacroOperation(OperationType.String);
+ operation.Input.Add(statement);
+ displayStatement.Children.Add(operation);
+
+ } else SynErr(36);
+ while (la.kind == 17) {
+ Get();
+ if (StartOf(2)) {
+ Statement(out statement);
+ MacroOperation operation = new MacroOperation(OperationType.Statement);
+ operation.Input.Add(statement);
+ displayStatement.Children.Add(operation);
+
+ } else if (la.kind == 7) {
+ Get();
+ statement = t.val.Replace("\"", "");
+ MacroOperation operation = new MacroOperation(OperationType.String);
+ operation.Input.Add(statement);
+ displayStatement.Children.Add(operation);
+
+ } else SynErr(37);
+ }
+ parent.Children.Add(displayStatement);
+
+ }
+
+ void ForBlock(ref MacroOperation parent) {
+ StringBuilder builder = new StringBuilder();
+ string statement = string.Empty;
+ string statement2 = string.Empty;
+ MacroOperation forBlock = new MacroOperation(OperationType.For);
+
+ Expect(16);
+ Expect(8);
+ Statement(out statement);
+ Expect(17);
+ Comparison(ref builder);
+ Expect(17);
+ Statement(out statement2);
+ forBlock.Input.Add(statement); forBlock.Input.Add(builder.ToString()); forBlock.Input.Add(statement2);
+ Expect(9);
+ Expect(12);
+ while (StartOf(3)) {
+ switch (la.kind) {
+ case 1: case 3: case 4: case 5: case 8: case 22: case 23: {
+ Statement(out statement);
+ MacroOperation operation = new MacroOperation(OperationType.Statement);
+ operation.Input.Add(statement);
+ forBlock.Children.Add(operation);
+
+ break;
+ }
+ case 11: {
+ IfBlock(ref forBlock);
+ break;
+ }
+ case 15: {
+ WhileBlock(ref forBlock);
+ break;
+ }
+ case 19: {
+ EchoStatement(ref forBlock);
+ break;
+ }
+ case 20: {
+ SayStatement(ref forBlock);
+ break;
+ }
+ case 21: {
+ DisplayStatement(ref forBlock);
+ break;
+ }
+ case 16: {
+ ForBlock(ref forBlock);
+ break;
+ }
+ }
+ }
+ Expect(13);
+ parent.Children.Add(forBlock);
+
+ }
+
+ void Comparison(ref StringBuilder result) {
+ Expression(ref result);
+ Expect(10);
+ result.Append(t.val);
+ Expression(ref result);
+ }
+
+ void CommaList(ref StringBuilder builder) {
+ Expression(ref builder);
+ while (la.kind == 17) {
+ Get();
+ builder.Append(t.val);
+ Expression(ref builder);
+ }
+ }
+
+ void Assignment(ref StringBuilder builder) {
+ Expect(1);
+ builder.Append(t.val);
+ if (la.kind == 30) {
+ Get();
+ builder.Append(t.val);
+ Expression(ref builder);
+ } else if (la.kind == 31) {
+ Get();
+ builder.Append(t.val); string value = string.Empty;
+ AnyExpression(out value);
+ builder.Append(value);
+ Expect(6);
+ } else if (la.kind == 32) {
+ Get();
+ builder.Append(t.val);
+ ArrayL(ref builder);
+ } else SynErr(38);
+ }
+
+ void Expression(ref StringBuilder builder) {
+ Term(ref builder);
+ while (la.kind == 22 || la.kind == 23 || la.kind == 24) {
+ if (la.kind == 22) {
+ Get();
+ builder.Append(t.val);
+ Term(ref builder);
+ } else if (la.kind == 23) {
+ Get();
+ builder.Append(t.val);
+ Term(ref builder);
+ } else {
+ Get();
+ builder.Append(t.val);
+ Term(ref builder);
+ }
+ }
+ }
+
+ void Term(ref StringBuilder builder) {
+ Factor(ref builder);
+ while (la.kind == 25 || la.kind == 26) {
+ if (la.kind == 25) {
+ Get();
+ builder.Append(t.val);
+ Factor(ref builder);
+ } else {
+ Get();
+ builder.Append(t.val);
+ Factor(ref builder);
+ }
+ }
+ }
+
+ void Factor(ref StringBuilder builder) {
+ Value(ref builder);
+ while (la.kind == 27) {
+ Get();
+ builder.Append(t.val);
+ Value(ref builder);
+ }
+ }
+
+ void Value(ref StringBuilder builder) {
+ if (la.kind == 22 || la.kind == 23) {
+ if (la.kind == 22) {
+ Get();
+ builder.Append(t.val);
+ } else {
+ Get();
+ builder.Append(t.val);
+ }
+ }
+ if (IsFunctionCall()) {
+ Function(ref builder);
+ } else if (IsArrayCall()) {
+ ArrayCall(ref builder);
+ } else if (la.kind == 1) {
+ Get();
+ builder.Append(t.val);
+ } else if (la.kind == 5) {
+ Get();
+ builder.Append(t.val);
+ } else if (la.kind == 4) {
+ Get();
+ builder.Append(t.val);
+ } else if (la.kind == 3) {
+ Get();
+ builder.Append(t.val);
+ } else if (la.kind == 8) {
+ Get();
+ builder.Append(t.val);
+ Expression(ref builder);
+ Expect(9);
+ builder.Append(t.val);
+ } else SynErr(39);
+ }
+
+ void Function(ref StringBuilder builder) {
+ Expect(1);
+ builder.Append(t.val);
+ Expect(8);
+ builder.Append(t.val);
+ CommaList(ref builder);
+ Expect(9);
+ builder.Append(t.val);
+ }
+
+ void ArrayCall(ref StringBuilder builder) {
+ Expect(1);
+ builder.Append(t.val);
+ Expect(28);
+ builder.Append(t.val);
+ Expression(ref builder);
+ Expect(29);
+ builder.Append(t.val);
+ }
+
+ void ArrayL(ref StringBuilder builder) {
+ Expect(28);
+ builder.Append(t.val);
+ CommaList(ref builder);
+ Expect(29);
+ builder.Append(t.val);
+ }
+
+ void AnyExpression(out string value) {
+ value = string.Empty; StringBuilder builder = new StringBuilder();
+ Get();
+ builder.Append(t.val);
+ while (StartOf(4)) {
+ Get();
+ builder.Append(t.val);
+ }
+ Expect(33);
+ value = builder.ToString();
+ }
+
+
+
+ public void Parse() {
+ la = new Token();
+ la.val = "";
+ Get();
+ SCRIPT();
+ Expect(0);
+
+ }
+
+ static readonly bool[,] set = {
+ {_T,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x},
+ {_x,_T,_x,_T, _T,_T,_x,_x, _T,_x,_x,_T, _x,_x,_x,_T, _T,_x,_T,_T, _T,_T,_T,_T, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x},
+ {_x,_T,_x,_T, _T,_T,_x,_x, _T,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_T,_T, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x},
+ {_x,_T,_x,_T, _T,_T,_x,_x, _T,_x,_x,_T, _x,_x,_x,_T, _T,_x,_x,_T, _T,_T,_T,_T, _x,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x},
+ {_x,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_x,_T,_x}
+
+ };
+} // end Parser
+
+
+public class Errors {
+ public int count = 0; // number of errors detected
+ public System.IO.TextWriter errorStream = Console.Out; // error messages go to this stream
+ public string errMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text
+
+ public virtual void SynErr (int line, int col, int n) {
+ string s;
+ switch (n) {
+ case 0: s = "EOF expected"; break;
+ case 1: s = "identifier expected"; break;
+ case 2: s = "sign expected"; break;
+ case 3: s = "binary expected"; break;
+ case 4: s = "hex expected"; break;
+ case 5: s = "number expected"; break;
+ case 6: s = "newline expected"; break;
+ case 7: s = "string expected"; break;
+ case 8: s = "LPAREN expected"; break;
+ case 9: s = "RPAREN expected"; break;
+ case 10: s = "COMPARER expected"; break;
+ case 11: s = "\"if\" expected"; break;
+ case 12: s = "\"{\" expected"; break;
+ case 13: s = "\"}\" expected"; break;
+ case 14: s = "\"else\" expected"; break;
+ case 15: s = "\"while\" expected"; break;
+ case 16: s = "\"for\" expected"; break;
+ case 17: s = "\",\" expected"; break;
+ case 18: s = "\"function\" expected"; break;
+ case 19: s = "\"echo:\" expected"; break;
+ case 20: s = "\"say:\" expected"; break;
+ case 21: s = "\"display:\" expected"; break;
+ case 22: s = "\"+\" expected"; break;
+ case 23: s = "\"-\" expected"; break;
+ case 24: s = "\"%\" expected"; break;
+ case 25: s = "\"*\" expected"; break;
+ case 26: s = "\"/\" expected"; break;
+ case 27: s = "\"^\" expected"; break;
+ case 28: s = "\"[\" expected"; break;
+ case 29: s = "\"]\" expected"; break;
+ case 30: s = "\"::\" expected"; break;
+ case 31: s = "\":=\" expected"; break;
+ case 32: s = "\"->\" expected"; break;
+ case 33: s = "\"\\n\" expected"; break;
+ case 34: s = "??? expected"; break;
+ case 35: s = "invalid Statement"; break;
+ case 36: s = "invalid DisplayStatement"; break;
+ case 37: s = "invalid DisplayStatement"; break;
+ case 38: s = "invalid Assignment"; break;
+ case 39: s = "invalid Value"; break;
+
+ default: s = "error " + n; break;
+ }
+ errorStream.WriteLine(errMsgFormat, line, col, s);
+ count++;
+ }
+
+ public virtual void SemErr (int line, int col, string s) {
+ errorStream.WriteLine(errMsgFormat, line, col, s);
+ count++;
+ }
+
+ public virtual void SemErr (string s) {
+ errorStream.WriteLine(s);
+ count++;
+ }
+
+ public virtual void Warning (int line, int col, string s) {
+ errorStream.WriteLine(errMsgFormat, line, col, s);
+ }
+
+ public virtual void Warning(string s) {
+ errorStream.WriteLine(s);
+ }
+} // Errors
+
+
+public class FatalError: Exception {
+ public FatalError(string m): base(m) {}
+}
+}
\ No newline at end of file
diff --git a/CS-MIC/csmic/csmic/ScriptParser/Parser.frame b/CS-MIC/csmic/csmic/ScriptParser/Parser.frame
index ac4cdf0..85e022f 100644
--- a/CS-MIC/csmic/csmic/ScriptParser/Parser.frame
+++ b/CS-MIC/csmic/csmic/ScriptParser/Parser.frame
@@ -26,15 +26,13 @@ Coco/R itself) does not fall under the GNU General Public License.
----------------------------------------------------------------------*/
-->begin
using System;
-using System.CodeDom.Compiler;
-->namespace
-[GeneratedCodeAttribute("Coco/R", "")]
public class Parser {
-->constants
- const bool T = true;
- const bool x = false;
+ const bool _T = true;
+ const bool _x = false;
const int minErrDist = 2;
public Scanner scanner;
@@ -110,7 +108,6 @@ public class Parser {
la.val = "";
Get();
-->parseRoot
- Expect(0);
}
static readonly bool[,] set = {
@@ -122,9 +119,9 @@ public class Parser {
public class Errors {
public int count = 0; // number of errors detected
public System.IO.TextWriter errorStream = Console.Out; // error messages go to this stream
- public string errMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text
-
- public void SynErr (int line, int col, int n) {
+ public string errMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text
+
+ public virtual void SynErr (int line, int col, int n) {
string s;
switch (n) {
-->errors
@@ -134,21 +131,21 @@ public class Errors {
count++;
}
- public void SemErr (int line, int col, string s) {
+ public virtual void SemErr (int line, int col, string s) {
errorStream.WriteLine(errMsgFormat, line, col, s);
count++;
}
- public void SemErr (string s) {
+ public virtual void SemErr (string s) {
errorStream.WriteLine(s);
count++;
}
- public void Warning (int line, int col, string s) {
+ public virtual void Warning (int line, int col, string s) {
errorStream.WriteLine(errMsgFormat, line, col, s);
}
- public void Warning(string s) {
+ public virtual void Warning(string s) {
errorStream.WriteLine(s);
}
} // Errors
@@ -157,4 +154,3 @@ public class Errors {
public class FatalError: Exception {
public FatalError(string m): base(m) {}
}
-
diff --git a/CS-MIC/csmic/csmic/ScriptParser/Scanner.cs b/CS-MIC/csmic/csmic/ScriptParser/Scanner.cs
index 846daae..5d86fec 100644
--- a/CS-MIC/csmic/csmic/ScriptParser/Scanner.cs
+++ b/CS-MIC/csmic/csmic/ScriptParser/Scanner.cs
@@ -2,12 +2,9 @@
using System;
using System.IO;
using System.Collections;
-using System.Collections.Generic;
-using System.CodeDom.Compiler;
namespace csmic.Scripting {
-[GeneratedCodeAttribute("Coco/R", "")]
public class Token {
public int kind; // token kind
public int pos; // token position in bytes in the source text (starting at 0)
@@ -219,7 +216,7 @@ public class Scanner {
int col; // column number of current character
int line; // line number of current character
int oldEols; // EOLs that appeared in a comment;
- static readonly Dictionary start; // maps first token character to start state
+ static readonly Hashtable start; // maps first token character to start state
Token tokens; // list of tokens already peeked (first token is a dummy)
Token pt; // current peek token
@@ -228,7 +225,7 @@ public class Scanner {
int tlen; // length of current token
static Scanner() {
- start = new Dictionary(128);
+ start = new Hashtable(128);
for (int i = 65; i <= 90; ++i) start[i] = 1;
for (int i = 97; i <= 99; ++i) start[i] = 1;
for (int i = 102; i <= 114; ++i) start[i] = 1;
@@ -393,7 +390,8 @@ public class Scanner {
t = new Token();
t.pos = pos; t.col = col; t.line = line; t.charPos = charPos;
int state;
- state = (int) start[ch];
+ if (start.ContainsKey(ch)) { state = (int) start[ch]; }
+ else { state = 0; }
tlen = 0; AddCh();
switch (state) {
diff --git a/CS-MIC/csmic/csmic/ScriptParser/Scanner.cs.old b/CS-MIC/csmic/csmic/ScriptParser/Scanner.cs.old
new file mode 100644
index 0000000..d4290ed
--- /dev/null
+++ b/CS-MIC/csmic/csmic/ScriptParser/Scanner.cs.old
@@ -0,0 +1,635 @@
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace csmic.Scripting {
+
+public class Token {
+ public int kind; // token kind
+ public int pos; // token position in bytes in the source text (starting at 0)
+ public int charPos; // token position in characters in the source text (starting at 0)
+ public int col; // token column (starting at 1)
+ public int line; // token line (starting at 1)
+ public string val; // token value
+ public Token next; // ML 2005-03-11 Tokens are kept in linked list
+}
+
+//-----------------------------------------------------------------------------------
+// Buffer
+//-----------------------------------------------------------------------------------
+public class Buffer {
+ // This Buffer supports the following cases:
+ // 1) seekable stream (file)
+ // a) whole stream in buffer
+ // b) part of stream in buffer
+ // 2) non seekable stream (network, console)
+
+ public const int EOF = char.MaxValue + 1;
+ const int MIN_BUFFER_LENGTH = 1024; // 1KB
+ const int MAX_BUFFER_LENGTH = MIN_BUFFER_LENGTH * 64; // 64KB
+ byte[] buf; // input buffer
+ int bufStart; // position of first byte in buffer relative to input stream
+ int bufLen; // length of buffer
+ int fileLen; // length of input stream (may change if the stream is no file)
+ int bufPos; // current position in buffer
+ Stream stream; // input stream (seekable)
+ bool isUserStream; // was the stream opened by the user?
+
+ public Buffer (Stream s, bool isUserStream) {
+ stream = s; this.isUserStream = isUserStream;
+
+ if (stream.CanSeek) {
+ fileLen = (int) stream.Length;
+ bufLen = Math.Min(fileLen, MAX_BUFFER_LENGTH);
+ bufStart = Int32.MaxValue; // nothing in the buffer so far
+ } else {
+ fileLen = bufLen = bufStart = 0;
+ }
+
+ buf = new byte[(bufLen>0) ? bufLen : MIN_BUFFER_LENGTH];
+ if (fileLen > 0) Pos = 0; // setup buffer to position 0 (start)
+ else bufPos = 0; // index 0 is already after the file, thus Pos = 0 is invalid
+ if (bufLen == fileLen && stream.CanSeek) Close();
+ }
+
+ protected Buffer(Buffer b) { // called in UTF8Buffer constructor
+ buf = b.buf;
+ bufStart = b.bufStart;
+ bufLen = b.bufLen;
+ fileLen = b.fileLen;
+ bufPos = b.bufPos;
+ stream = b.stream;
+ // keep destructor from closing the stream
+ b.stream = null;
+ isUserStream = b.isUserStream;
+ }
+
+ ~Buffer() { Close(); }
+
+ protected void Close() {
+ if (!isUserStream && stream != null) {
+ stream.Close();
+ stream = null;
+ }
+ }
+
+ public virtual int Read () {
+ if (bufPos < bufLen) {
+ return buf[bufPos++];
+ } else if (Pos < fileLen) {
+ Pos = Pos; // shift buffer start to Pos
+ return buf[bufPos++];
+ } else if (stream != null && !stream.CanSeek && ReadNextStreamChunk() > 0) {
+ return buf[bufPos++];
+ } else {
+ return EOF;
+ }
+ }
+
+ public int Peek () {
+ int curPos = Pos;
+ int ch = Read();
+ Pos = curPos;
+ return ch;
+ }
+
+ // beg .. begin, zero-based, inclusive, in byte
+ // end .. end, zero-based, exclusive, in byte
+ public string GetString (int beg, int end) {
+ int len = 0;
+ char[] buf = new char[end - beg];
+ int oldPos = Pos;
+ Pos = beg;
+ while (Pos < end) buf[len++] = (char) Read();
+ Pos = oldPos;
+ return new String(buf, 0, len);
+ }
+
+ public int Pos {
+ get { return bufPos + bufStart; }
+ set {
+ if (value >= fileLen && stream != null && !stream.CanSeek) {
+ // Wanted position is after buffer and the stream
+ // is not seek-able e.g. network or console,
+ // thus we have to read the stream manually till
+ // the wanted position is in sight.
+ while (value >= fileLen && ReadNextStreamChunk() > 0);
+ }
+
+ if (value < 0 || value > fileLen) {
+ throw new FatalError("buffer out of bounds access, position: " + value);
+ }
+
+ if (value >= bufStart && value < bufStart + bufLen) { // already in buffer
+ bufPos = value - bufStart;
+ } else if (stream != null) { // must be swapped in
+ stream.Seek(value, SeekOrigin.Begin);
+ bufLen = stream.Read(buf, 0, buf.Length);
+ bufStart = value; bufPos = 0;
+ } else {
+ // set the position to the end of the file, Pos will return fileLen.
+ bufPos = fileLen - bufStart;
+ }
+ }
+ }
+
+ // Read the next chunk of bytes from the stream, increases the buffer
+ // if needed and updates the fields fileLen and bufLen.
+ // Returns the number of bytes read.
+ private int ReadNextStreamChunk() {
+ int free = buf.Length - bufLen;
+ if (free == 0) {
+ // in the case of a growing input stream
+ // we can neither seek in the stream, nor can we
+ // foresee the maximum length, thus we must adapt
+ // the buffer size on demand.
+ byte[] newBuf = new byte[bufLen * 2];
+ Array.Copy(buf, newBuf, bufLen);
+ buf = newBuf;
+ free = bufLen;
+ }
+ int read = stream.Read(buf, bufLen, free);
+ if (read > 0) {
+ fileLen = bufLen = (bufLen + read);
+ return read;
+ }
+ // end of stream reached
+ return 0;
+ }
+}
+
+//-----------------------------------------------------------------------------------
+// UTF8Buffer
+//-----------------------------------------------------------------------------------
+public class UTF8Buffer: Buffer {
+ public UTF8Buffer(Buffer b): base(b) {}
+
+ public override int Read() {
+ int ch;
+ do {
+ ch = base.Read();
+ // until we find a utf8 start (0xxxxxxx or 11xxxxxx)
+ } while ((ch >= 128) && ((ch & 0xC0) != 0xC0) && (ch != EOF));
+ if (ch < 128 || ch == EOF) {
+ // nothing to do, first 127 chars are the same in ascii and utf8
+ // 0xxxxxxx or end of file character
+ } else if ((ch & 0xF0) == 0xF0) {
+ // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ int c1 = ch & 0x07; ch = base.Read();
+ int c2 = ch & 0x3F; ch = base.Read();
+ int c3 = ch & 0x3F; ch = base.Read();
+ int c4 = ch & 0x3F;
+ ch = (((((c1 << 6) | c2) << 6) | c3) << 6) | c4;
+ } else if ((ch & 0xE0) == 0xE0) {
+ // 1110xxxx 10xxxxxx 10xxxxxx
+ int c1 = ch & 0x0F; ch = base.Read();
+ int c2 = ch & 0x3F; ch = base.Read();
+ int c3 = ch & 0x3F;
+ ch = (((c1 << 6) | c2) << 6) | c3;
+ } else if ((ch & 0xC0) == 0xC0) {
+ // 110xxxxx 10xxxxxx
+ int c1 = ch & 0x1F; ch = base.Read();
+ int c2 = ch & 0x3F;
+ ch = (c1 << 6) | c2;
+ }
+ return ch;
+ }
+}
+
+//-----------------------------------------------------------------------------------
+// Scanner
+//-----------------------------------------------------------------------------------
+public class Scanner {
+ const char EOL = '\n';
+ const int eofSym = 0; /* pdt */
+ const int maxT = 34;
+ const int noSym = 34;
+
+
+ public Buffer buffer; // scanner buffer
+
+ Token t; // current token
+ int ch; // current input character
+ int pos; // byte position of current character
+ int charPos; // position by unicode characters starting with 0
+ int col; // column number of current character
+ int line; // line number of current character
+ int oldEols; // EOLs that appeared in a comment;
+ static readonly Hashtable start; // maps first token character to start state
+
+ Token tokens; // list of tokens already peeked (first token is a dummy)
+ Token pt; // current peek token
+
+ char[] tval = new char[128]; // text of current token
+ int tlen; // length of current token
+
+ static Scanner() {
+ start = new Hashtable(128);
+ for (int i = 65; i <= 90; ++i) start[i] = 1;
+ for (int i = 97; i <= 99; ++i) start[i] = 1;
+ for (int i = 102; i <= 114; ++i) start[i] = 1;
+ for (int i = 116; i <= 122; ++i) start[i] = 1;
+ start[43] = 2;
+ for (int i = 50; i <= 57; ++i) start[i] = 6;
+ for (int i = 10; i <= 10; ++i) start[i] = 12;
+ for (int i = 13; i <= 13; ++i) start[i] = 11;
+ start[48] = 19;
+ start[49] = 20;
+ start[34] = 13;
+ start[40] = 15;
+ start[41] = 16;
+ start[61] = 17;
+ start[60] = 21;
+ start[62] = 22;
+ start[123] = 23;
+ start[125] = 24;
+ start[44] = 25;
+ start[101] = 38;
+ start[115] = 39;
+ start[100] = 40;
+ start[37] = 29;
+ start[42] = 30;
+ start[47] = 31;
+ start[94] = 32;
+ start[91] = 33;
+ start[93] = 34;
+ start[58] = 41;
+ start[45] = 42;
+ start[Buffer.EOF] = -1;
+
+ }
+
+ public Scanner (string fileName) {
+ try {
+ Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
+ buffer = new Buffer(stream, false);
+ Init();
+ } catch (IOException) {
+ throw new FatalError("Cannot open file " + fileName);
+ }
+ }
+
+ public Scanner (Stream s) {
+ buffer = new Buffer(s, true);
+ Init();
+ }
+
+ void Init() {
+ pos = -1; line = 1; col = 0; charPos = -1;
+ oldEols = 0;
+ NextCh();
+ if (ch == 0xEF) { // check optional byte order mark for UTF-8
+ NextCh(); int ch1 = ch;
+ NextCh(); int ch2 = ch;
+ if (ch1 != 0xBB || ch2 != 0xBF) {
+ throw new FatalError(String.Format("illegal byte order mark: EF {0,2:X} {1,2:X}", ch1, ch2));
+ }
+ buffer = new UTF8Buffer(buffer); col = 0; charPos = -1;
+ NextCh();
+ }
+ pt = tokens = new Token(); // first token is a dummy
+ }
+
+ void NextCh() {
+ if (oldEols > 0) { ch = EOL; oldEols--; }
+ else {
+ pos = buffer.Pos;
+ // buffer reads unicode chars, if UTF8 has been detected
+ ch = buffer.Read(); col++; charPos++;
+ // replace isolated '\r' by '\n' in order to make
+ // eol handling uniform across Windows, Unix and Mac
+ if (ch == '\r' && buffer.Peek() != '\n') ch = EOL;
+ if (ch == EOL) { line++; col = 0; }
+ }
+
+ }
+
+ void AddCh() {
+ if (tlen >= tval.Length) {
+ char[] newBuf = new char[2 * tval.Length];
+ Array.Copy(tval, 0, newBuf, 0, tval.Length);
+ tval = newBuf;
+ }
+ if (ch != Buffer.EOF) {
+ tval[tlen++] = (char) ch;
+ NextCh();
+ }
+ }
+
+
+
+ bool Comment0() {
+ int level = 1, pos0 = pos, line0 = line, col0 = col, charPos0 = charPos;
+ NextCh();
+ if (ch == '/') {
+ NextCh();
+ for(;;) {
+ if (ch == 10) {
+ level--;
+ if (level == 0) { oldEols = line - line0; NextCh(); return true; }
+ NextCh();
+ } else if (ch == Buffer.EOF) return false;
+ else NextCh();
+ }
+ } else {
+ buffer.Pos = pos0; NextCh(); line = line0; col = col0; charPos = charPos0;
+ }
+ return false;
+ }
+
+ bool Comment1() {
+ int level = 1, pos0 = pos, line0 = line, col0 = col, charPos0 = charPos;
+ NextCh();
+ if (ch == '*') {
+ NextCh();
+ for(;;) {
+ if (ch == '*') {
+ NextCh();
+ if (ch == '/') {
+ level--;
+ if (level == 0) { oldEols = line - line0; NextCh(); return true; }
+ NextCh();
+ }
+ } else if (ch == '/') {
+ NextCh();
+ if (ch == '*') {
+ level++; NextCh();
+ }
+ } else if (ch == Buffer.EOF) return false;
+ else NextCh();
+ }
+ } else {
+ buffer.Pos = pos0; NextCh(); line = line0; col = col0; charPos = charPos0;
+ }
+ return false;
+ }
+
+
+ void CheckLiteral() {
+ switch (t.val) {
+ case "if": t.kind = 11; break;
+ case "else": t.kind = 14; break;
+ case "while": t.kind = 15; break;
+ case "for": t.kind = 16; break;
+ case "function": t.kind = 18; break;
+ case "+": t.kind = 22; break;
+ case "-": t.kind = 23; break;
+ case "\n": t.kind = 33; break;
+ default: break;
+ }
+ }
+
+ Token NextToken() {
+ while (ch == ' ' ||
+ ch >= 9 && ch <= 10 || ch == 13
+ ) NextCh();
+ if (ch == '/' && Comment0() ||ch == '/' && Comment1()) return NextToken();
+ int recKind = noSym;
+ int recEnd = pos;
+ t = new Token();
+ t.pos = pos; t.col = col; t.line = line; t.charPos = charPos;
+ int state;
+ if (start.ContainsKey(ch)) { state = (int) start[ch]; }
+ else { state = 0; }
+ tlen = 0; AddCh();
+
+ switch (state) {
+ case -1: { t.kind = eofSym; break; } // NextCh already done
+ case 0: {
+ if (recKind != noSym) {
+ tlen = recEnd - t.pos;
+ SetScannerBehindT();
+ }
+ t.kind = recKind; break;
+ } // NextCh already done
+ case 1:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z') {AddCh(); goto case 1;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 2:
+ {t.kind = 2; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 3:
+ {t.kind = 3; break;}
+ case 4:
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 5;}
+ else {goto case 0;}
+ case 5:
+ recEnd = pos; recKind = 4;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 5;}
+ else {t.kind = 4; break;}
+ case 6:
+ recEnd = pos; recKind = 5;
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 6;}
+ else if (ch == 'E' || ch == 'e') {AddCh(); goto case 7;}
+ else if (ch == '.') {AddCh(); goto case 10;}
+ else {t.kind = 5; break;}
+ case 7:
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 9;}
+ else if (ch == '+' || ch == '-') {AddCh(); goto case 8;}
+ else {goto case 0;}
+ case 8:
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 9;}
+ else {goto case 0;}
+ case 9:
+ recEnd = pos; recKind = 5;
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 9;}
+ else {t.kind = 5; break;}
+ case 10:
+ recEnd = pos; recKind = 5;
+ if (ch >= '0' && ch <= '9') {AddCh(); goto case 10;}
+ else if (ch == 'E' || ch == 'e') {AddCh(); goto case 7;}
+ else {t.kind = 5; break;}
+ case 11:
+ if (ch == 10) {AddCh(); goto case 12;}
+ else {goto case 0;}
+ case 12:
+ {t.kind = 6; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 13:
+ if (ch <= '!' || ch >= '#' && ch <= 65535) {AddCh(); goto case 13;}
+ else if (ch == '"') {AddCh(); goto case 14;}
+ else {goto case 0;}
+ case 14:
+ {t.kind = 7; break;}
+ case 15:
+ {t.kind = 8; break;}
+ case 16:
+ {t.kind = 9; break;}
+ case 17:
+ if (ch == '=') {AddCh(); goto case 18;}
+ else {goto case 0;}
+ case 18:
+ {t.kind = 10; break;}
+ case 19:
+ recEnd = pos; recKind = 5;
+ if (ch >= '2' && ch <= '9') {AddCh(); goto case 6;}
+ else if (ch == 'B' || ch == 'b') {AddCh(); goto case 3;}
+ else if (ch >= '0' && ch <= '1') {AddCh(); goto case 20;}
+ else if (ch == 'x') {AddCh(); goto case 4;}
+ else if (ch == 'E' || ch == 'e') {AddCh(); goto case 7;}
+ else if (ch == '.') {AddCh(); goto case 10;}
+ else {t.kind = 5; break;}
+ case 20:
+ recEnd = pos; recKind = 5;
+ if (ch >= '2' && ch <= '9') {AddCh(); goto case 6;}
+ else if (ch == 'B' || ch == 'b') {AddCh(); goto case 3;}
+ else if (ch >= '0' && ch <= '1') {AddCh(); goto case 20;}
+ else if (ch == 'E' || ch == 'e') {AddCh(); goto case 7;}
+ else if (ch == '.') {AddCh(); goto case 10;}
+ else {t.kind = 5; break;}
+ case 21:
+ recEnd = pos; recKind = 10;
+ if (ch == '=') {AddCh(); goto case 18;}
+ else {t.kind = 10; break;}
+ case 22:
+ recEnd = pos; recKind = 10;
+ if (ch == '=') {AddCh(); goto case 18;}
+ else {t.kind = 10; break;}
+ case 23:
+ {t.kind = 12; break;}
+ case 24:
+ {t.kind = 13; break;}
+ case 25:
+ {t.kind = 17; break;}
+ case 26:
+ {t.kind = 19; break;}
+ case 27:
+ {t.kind = 20; break;}
+ case 28:
+ {t.kind = 21; break;}
+ case 29:
+ {t.kind = 24; break;}
+ case 30:
+ {t.kind = 25; break;}
+ case 31:
+ {t.kind = 26; break;}
+ case 32:
+ {t.kind = 27; break;}
+ case 33:
+ {t.kind = 28; break;}
+ case 34:
+ {t.kind = 29; break;}
+ case 35:
+ {t.kind = 30; break;}
+ case 36:
+ {t.kind = 31; break;}
+ case 37:
+ {t.kind = 32; break;}
+ case 38:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'b' || ch >= 'd' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == 'c') {AddCh(); goto case 43;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 39:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'b' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == 'a') {AddCh(); goto case 44;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 40:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'h' || ch >= 'j' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == 'i') {AddCh(); goto case 45;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 41:
+ if (ch == ':') {AddCh(); goto case 35;}
+ else if (ch == '=') {AddCh(); goto case 36;}
+ else {goto case 0;}
+ case 42:
+ recEnd = pos; recKind = 2;
+ if (ch == '>') {AddCh(); goto case 37;}
+ else {t.kind = 2; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 43:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'g' || ch >= 'i' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == 'h') {AddCh(); goto case 46;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 44:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'x' || ch == 'z') {AddCh(); goto case 1;}
+ else if (ch == 'y') {AddCh(); goto case 47;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 45:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'r' || ch >= 't' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == 's') {AddCh(); goto case 48;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 46:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'n' || ch >= 'p' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == 'o') {AddCh(); goto case 49;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 47:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == ':') {AddCh(); goto case 27;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 48:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'o' || ch >= 'q' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == 'p') {AddCh(); goto case 50;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 49:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == ':') {AddCh(); goto case 26;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 50:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'k' || ch >= 'm' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == 'l') {AddCh(); goto case 51;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 51:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'b' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == 'a') {AddCh(); goto case 52;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 52:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'x' || ch == 'z') {AddCh(); goto case 1;}
+ else if (ch == 'y') {AddCh(); goto case 53;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+ case 53:
+ recEnd = pos; recKind = 1;
+ if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z') {AddCh(); goto case 1;}
+ else if (ch == ':') {AddCh(); goto case 28;}
+ else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
+
+ }
+ t.val = new String(tval, 0, tlen);
+ return t;
+ }
+
+ private void SetScannerBehindT() {
+ buffer.Pos = t.pos;
+ NextCh();
+ line = t.line; col = t.col; charPos = t.charPos;
+ for (int i = 0; i < tlen; i++) NextCh();
+ }
+
+ // get the next token (possibly a token already seen during peeking)
+ public Token Scan () {
+ if (tokens.next == null) {
+ return NextToken();
+ } else {
+ pt = tokens = tokens.next;
+ return tokens;
+ }
+ }
+
+ // peek for the next token, ignore pragmas
+ public Token Peek () {
+ do {
+ if (pt.next == null) {
+ pt.next = NextToken();
+ }
+ pt = pt.next;
+ } while (pt.kind > maxT); // skip pragmas
+
+ return pt;
+ }
+
+ // make sure that peeking starts at the current scan position
+ public void ResetPeek () { pt = tokens; }
+
+} // end Scanner
+}
\ No newline at end of file
diff --git a/CS-MIC/csmic/csmic/ScriptParser/Scanner.frame b/CS-MIC/csmic/csmic/ScriptParser/Scanner.frame
index 8010e59..abac75d 100644
--- a/CS-MIC/csmic/csmic/ScriptParser/Scanner.frame
+++ b/CS-MIC/csmic/csmic/ScriptParser/Scanner.frame
@@ -28,12 +28,9 @@ Coco/R itself) does not fall under the GNU General Public License.
using System;
using System.IO;
using System.Collections;
-using System.Collections.Generic;
-using System.CodeDom.Compiler;
-->namespace
-[GeneratedCodeAttribute("Coco/R", "")]
public class Token {
public int kind; // token kind
public int pos; // token position in bytes in the source text (starting at 0)
@@ -243,7 +240,7 @@ public class Scanner {
int col; // column number of current character
int line; // line number of current character
int oldEols; // EOLs that appeared in a comment;
- static readonly Dictionary start; // maps first token character to start state
+ static readonly Hashtable start; // maps first token character to start state
Token tokens; // list of tokens already peeked (first token is a dummy)
Token pt; // current peek token
@@ -252,7 +249,7 @@ public class Scanner {
int tlen; // length of current token
static Scanner() {
- start = new Dictionary(128);
+ start = new Hashtable(128);
-->initialization
}
@@ -330,7 +327,8 @@ public class Scanner {
t = new Token();
t.pos = pos; t.col = col; t.line = line; t.charPos = charPos;
int state;
- state = (int) start[ch];
+ if (start.ContainsKey(ch)) { state = (int) start[ch]; }
+ else { state = 0; }
tlen = 0; AddCh();
switch (state) {
diff --git a/CS-MIC/csmic/csmic/bin/Debug/csmic.XML b/CS-MIC/csmic/csmic/bin/Debug/csmic.XML
new file mode 100644
index 0000000..b170882
--- /dev/null
+++ b/CS-MIC/csmic/csmic/bin/Debug/csmic.XML
@@ -0,0 +1,1028 @@
+
+
+
+ csmic
+
+
+
+ Coded function factory.
+
+ This class generates new coded functions dynamically.
+
+
+
+ Creates a new ICodedFunction interface object that implements the dynamic method described.
+ Name of the function.
+ Number of expected arguments.
+ The method body.
+ An ICodedFunction interface object.
+
+
+
+ A coded implementation of the absolute value function.
+
+
+
+
+ Expects 1 argument.
+
+
+
+
+ The name of the function.
+
+
+
+
+ Executes a code block.
+
+ The arguments used in the code block.
+ The absolute value of the argument.
+
+
+
+ A coded implementation of the exponential function based on the constant e.
+
+
+
+
+ Expects 1 argument.
+
+
+
+
+ The name of the function.
+
+
+
+
+ Executes a code block.
+
+ The arguments used in the code block.
+ The constant e raised to the power of the argument.
+
+
+
+ A coded implementation of the log function.
+
+
+
+
+ Expects 2 arguments.
+
+
+
+
+ The name of the function.
+
+
+
+
+ Executes a code block.
+
+ The arguments used in the code block.
+ The log of the first argument to the base of the second argument.
+
+
+
+ A coded implementation of a precision function.
+
+
+
+
+ Expects 2 arguments.
+
+
+
+
+ The name of the function.
+
+
+
+
+ Executes a code block.
+
+ The arguments used in the code block.
+ The first argument to the precision of the argument.
+
+
+
+ A coded implementation of the squre root function.
+
+
+
+
+ Expects 1 argument.
+
+
+
+
+ The name of the function.
+
+
+
+
+ Executes a code block.
+
+ The arguments used in the code block.
+ The square root of the argument.
+
+
+
+ A coded implementation of the cosine function.
+
+
+
+
+ Expects 1 argument.
+
+
+
+
+ The name of the function.
+
+
+
+
+ Executes a code block.
+
+ The arguments used in the code block.
+ The cosine of the argument.
+
+
+
+ A coded implementation of a rounded function.
+
+
+
+
+ Expects 1 argument.
+
+
+
+
+ The name of the function.
+
+
+
+
+ Executes a code block.
+
+ The arguments used in the code block.
+ The rounded argument.
+
+
+
+ A coded implementation of the sine function.
+
+
+
+
+ Expects 1 argument.
+
+
+
+
+ The name of the function.
+
+
+
+
+ Executes a code block.
+
+ The arguments used in the code block.
+ The sine of the argument.
+
+
+
+ A coded implementation of the tangent function.
+
+
+
+
+ Expects 1 argument.
+
+
+
+
+ The name of the function.
+
+
+
+
+ Executes a code block.
+
+ The arguments used in the code block.
+ The tangent of the argument.
+
+
+ Computable class.
+
+
+ The expression to be built.
+
+
+ The interpreter to act as a base.
+
+
+ The add symbol.
+
+
+ The substract symbol.
+
+
+ The divide symbol.
+
+
+ The multiply symbol.
+
+
+ The modifier symbol.
+
+
+ The power symbol.
+
+
+ Gets the expression.
+ The expression.
+
+
+ Creates a Computable instance.
+ The expression.
+ The interpreter.
+
+
+ Resolves the computable as an input interpreter having calculated the input.
+ The computable as an input interpreter.
+
+
+ Resolve the computer to a type .
+ Generic type parameter.
+ The selector function.
+ .
+
+
+ Form the operation given the operation constant and an argument.
+ The operation constant.
+ The argument.
+ A string with the given operation appended.
+
+
+ Form the function with the current expression as the first argument, followed by .
+ The name of the function.
+ The arguments.
+ .
+
+
+ Adds addend.
+ The decimal to add.
+ A computable class after the addition.
+
+
+ Subtracts the subtrahend.
+ The subtrahend.
+ A computable class after the subtraction.
+
+
+ Multiplies the multiplicand.
+ The multiplicand.
+ A computable class after the mulitplication.
+
+
+ Divides the divisor.
+ The divisor.
+ A computable class after the divison.
+
+
+ Mods using a given divisor.
+ The divisor.
+ A computable class after the mod.
+
+
+ Raises to power of the given integer value.
+ The power.
+ A computable class after the power operation.
+
+
+ Applies the function with the current expression as the first argument, followed by .
+ The name of the function.
+ The arguments.
+ A computable class after the function is applied.
+
+
+ Executes a command for all items in a collection.
+ Generic type parameter.
+ The items of type .
+ The action belonging to type .
+ .
+
+
+ CS-MIC extension methods.
+
+
+ A string extension method that interprets as input the string that calls it.
+ The input to act on.
+ The output from the interpretation of the string.
+
+
+ A string extension method that executes as macro operation.
+ The script to act on.
+ The final output of the script.
+
+
+
+ A string extension method that interprets as input the string that calls it.
+
+ The collection to act on.
+ The output from the interpretation of the string.
+
+
+
+ A string extension method that interprets as input the string that calls it.
+
+ The collection to act on.
+ The action.
+ The output from the interpretation of the string.
+
+
+ Enumerates input in this collection, returning a selection on the interpreter.
+ Generic type parameter.
+ The collection to act on.
+ The selection.
+
+ An enumerator that allows foreach to be used to process interpret< t> in this
+ collection.
+
+
+
+ A string extension method that executes as macro operation.
+ The collection to act on.
+ The final output of the script.
+
+
+ Enumerates input in parallel in this collection.
+ The collection to act on.
+
+ An enumerator that allows foreach to be used to process interpret in parallel in this
+ collection.
+
+
+
+ Enumerates input in parallel this collection, returning a selection on the interpreter.
+ Generic type parameter.
+ The collection to act on.
+ The selection.
+
+ An enumerator that allows foreach to be used to process interpret in parallel< t> in
+ this collection.
+
+
+
+
+ A string extension method that interprets as input the strings that calls it in parallel.
+
+ The collection to act on.
+ The output from the interpretation of the string.
+
+
+
+ A generically coded implementation of the ICodedFunction interface.
+
+
+
+ Number of expected arguments.
+
+
+ Name of the function.
+
+
+ The method body.
+
+
+ Constructor.
+ Name of the function.
+ Number of expected arguments.
+ The method body.
+
+
+ Gets the number of expected arguments.
+ The total number of expected arguments.
+
+
+ Gets the name of the function.
+ The name of the function.
+
+
+ Executes a code block that computes the value of the function.
+ A variable-length parameters list containing arguments.
+ The decimal value computed by the function.
+
+
+
+ Implements a function that is coded in the .Net environment.
+
+ This interface is required to implement a method or function
+ that can be used by the CS-MIC inputInterpreter. It is worth noting that the
+ function's name will be the text that is used in the inputInterpreter as the
+ executable text.
+
+
+
+ Gets the number of expected arguments.
+
+
+
+
+ Gets the name of the function.
+
+ The input inputInterpreter will use this function name as
+ executable text, expecting an opening and closing parenthesis following
+ it.
+
+
+
+ Executes a code block that computes the value of the function.
+
+ An array of arguments passed to the function.
+ The decimal value computed by the function.
+ Any code block is valid. Error handling must be done by the
+ developer, as the inputInterpreter cannot determine if there is an error.
+
+ This example shows how to implement the sine function through the interface's
+ Execute() function.
+
+ public decimal Execute(params decimal[] args)
+ {
+ //Set up an output variable.
+ decimal output = 0;
+
+ //Check to see if the number or arguments recieved
+ //is equal to the number of arguments expected.
+ if (args.Length == this.NumExpectedArguments)
+ {
+ //Grab the argument and set a local variable for clarity.
+ decimal input = args[0];
+
+ //Set the output as a sine of the input.
+ output = (decimal)Math.Sin((double)input);
+ }
+
+ //Return the output. The function will return the sine if the arguments
+ //matched what was expected, and will return 0 otherwise. Returning 0 on
+ //errors is the standard in CS-MIC.
+ return output;
+ }
+
+
+
+
+
+ An interpreter object that reads user input and evaluates the code.
+
+ The interpreter does not support exceptions by design. Instead, invalid
+ calculations, parameters, etc. will result in a result of zero.
+
+ InputInterpreter interpreter = new InputInterpreter();
+ interpreter.Interpret("1/0"); // The result will be 0, not an exception.
+
+
+
+
+
+ The output generated.
+
+
+
+
+ The variables assigned.
+
+
+
+
+ The time for execution.
+
+
+
+
+ The verbose message of the calculation.
+
+
+
+
+ The list of coded functions that can be executed.
+
+
+
+
+ The list of user defined functions that can be executed.
+
+
+
+
+ The private calculated value.
+
+
+
+
+ Creates a new InputInterpreter.
+
+
+
+
+ Creates a new InputInterpreter from an original.
+
+ The orginal input interpreter to copy.
+
+
+
+ Gets the message that represents the InputInterpreters output.
+
+
+
+
+ Gets the verbose message that is generated with a calculation.
+
+
+
+
+ Gets the value of the output as a decimal.
+
+
+
+
+ Gets the value of the output cast as an int.
+
+
+
+
+ Gets the value of the output cast as a float.
+
+
+
+
+ Gets the value of the output cast as a double.
+
+
+
+
+ Gets the value (cast as a long) converted to its binary equivalent.
+
+
+
+
+ Gets the execution time of the last calculation.
+
+
+
+
+ Gets or sets a list of coded functions that the interpreter supports.
+
+
+
+
+ Gets or sets a list of user generated interpreted functions that the interpreter supports.
+
+ The interpreted functions.
+
+
+ Gets the variables.
+ The variables.
+
+
+
+ Interprets and executes given input.
+
+ The input to interpret and execute.
+
+
+
+ Computes an expression and returns the result as a decimal.
+
+ The expression to be calculated.
+ The value that was computed.
+
+
+
+ Assigns a decimal value to a variable.
+
+ The name of the variable.
+ The value of the variable.
+ True if the variable was set, false otherwise.
+
+
+
+ Assigns a decimal value to a variable.
+
+ The name of the variable.
+ The expression of the variable.
+ True if the variable was set, false otherwise.
+
+
+
+ Assigns a decimal value to a variable.
+
+ The name of the variable.
+ The values of the variable.
+ True if the variable was set, false otherwise.
+
+
+
+ Executes a function stored in the interpreter.
+
+ The name of the function to execute.
+ The arguments to pass to the function.
+ The value computed from the function execution.
+
+
+
+ Loads the default coded functions supported by the interpreter.
+
+
+
+
+ Produces output given a single object.
+
+ The object representing the output.
+
+
+
+ Produces output given an object and a message.
+
+ The object representing the output.
+ The message to be displayed with the output.
+
+
+ Interpret an input asynchronously.
+ The input to interpret and execute.
+ The callback.
+
+
+ Interpret asynchronous threading work.
+ The input to interpret and execute.
+
+
+ Interpret asynchronous delegate.
+ The input.
+ .
+
+
+ Converts this object to a computable.
+ This object as a Computable.
+
+
+ Treats the current object as a computable and performs an action in that context.
+ The action to execute as a computable object.
+ This object as a Computable, after the given action.
+
+
+
+ Represents a user defined function that can be executed by the interpreter.
+
+
+
+
+ The name of the function.
+
+
+
+
+ The number of expected arguments.
+
+
+
+
+ The set of instructions to be passed to the internal inputInterpreter.
+
+
+
+
+ A set of arguments used in computation of the function.
+
+
+
+
+ The internal macro builder used for computation.
+
+
+
+
+ The internal input inputInterpreter that macro builder will use for computation.
+
+
+
+
+ Creates a new interpreted function.
+
+ The name of the fuction.
+ The node to be used in computation.
+ A set of argument names to be used in computation.
+
+
+
+ Gets the name of the function.
+
+
+
+
+ Gets the number of expected arguments for the function.
+
+
+
+
+ Computes the value of the function.
+
+ The arguments used for computation.
+ The decimal value computed by the function.
+
+
+
+ Because a function's internal pattern may be different, we must manually check to see if the function
+ names are the same.
+
+ The object to test.
+ True if the functions are the same.
+
+
+ Serves as a hash function for a particular type.
+ A hash code for the current .
+
+
+
+ Represents an argument made in an interpreted function.
+
+
+
+
+ The name of the argument.
+
+
+
+
+ The value of the argument.
+
+
+
+
+ Creates a new interpreted function argument.
+
+
+
+
+ Creates a new interpreted function argument.
+
+ The name of the argument in the interpreted function.
+ The value of the argument to use in the interpreted function.
+
+
+
+ Gets or sets the name of the argument.
+
+
+
+
+ Gets or sets the value of the argument.
+
+
+
+
+ A builder object that executes macro scripts.
+
+
+
+
+ The input inputInterpreter.
+
+
+
+ The script to run as a macro.
+
+
+
+ The output as a list of strings.
+
+
+
+
+ The time for execution.
+
+
+
+
+ The root macro operation.
+
+
+
+
+ Creates a new builder object that executes a given macro script.
+
+ A list of strings representing the macro.
+ The InputInterpreter to be used.
+
+
+
+ Creates a new builder object that executes a given macro script.
+
+ A list of strings representing the macro.
+ The InputInterpreter to be used.
+
+
+
+ Gets a list of strings representing the output.
+
+
+
+
+ Gets the execution time of the last script computation.
+
+
+
+
+ Gets the decimal value last computed by the macrobuilder.
+
+
+
+ Runs this macro.
+
+
+ Executes the asynchronous operation.
+ The input.
+ The callback.
+
+
+ Executes the asynchronous threading work operation.
+ The input.
+ .
+
+
+ Macro asynchronous delegate.
+ The input.
+ .
+
+
+
+ Represents the operation types supported by a scripted macro.
+
+
+
+
+ Represents a conditional block.
+
+
+
+
+ Represents a conditional else block.
+
+
+
+
+ Represents a complete conditional block.
+
+
+
+
+ A while block.
+
+
+
+
+ A for block.
+
+
+
+
+ A function declaration.
+
+
+
+
+ An echo statement.
+
+
+
+
+ A say statement.
+
+
+
+
+ A display statement.
+
+
+
+
+ A statement to execute.
+
+
+
+
+ A string to display.
+
+
+
+
+ An unknown or malformed block.
+
+
+
+
+ An operation object that executes a specified action.
+
+
+
+
+ The type of operation represented by the operation.
+
+
+
+
+ The collection of children nodes that belong to the operation.
+
+
+
+
+ A list of the necesary input to execute the operation.
+
+
+
+
+ Creates a new macro operation node.
+
+ The type of operation the node represents.
+
+
+
+ Gets or sets the children nodes of the operation.
+
+
+
+
+ Gets or sets the input for the operation.
+
+
+
+
+ Gets or sets the operation type for this operation.
+
+
+
+
+ Represents the data types supported in a variable.
+
+
+
+
+ Decimal
+
+
+
+
+ Equation
+
+
+
+
+ Array
+
+
+
+
+ Unknown
+
+
+
+
+ No type associated
+
+
+
+
+ An object that contains information about a variable.
+
+
+
+
+ The type of variable.
+
+
+
+
+ The value of the variable.
+
+
+
+
+ Creates an empty variable.
+
+
+
+
+ Gets or sets an object representing the variable's value.
+
+
+
+
+ Gets or sets the type of the variable.
+
+
+
+
diff --git a/CS-MIC/csmic/csmic/bin/Debug/csmic.dll b/CS-MIC/csmic/csmic/bin/Debug/csmic.dll
new file mode 100644
index 0000000..f707ec3
Binary files /dev/null and b/CS-MIC/csmic/csmic/bin/Debug/csmic.dll differ
diff --git a/CS-MIC/csmic/csmic/bin/Debug/csmic.pdb b/CS-MIC/csmic/csmic/bin/Debug/csmic.pdb
new file mode 100644
index 0000000..6a42ea8
Binary files /dev/null and b/CS-MIC/csmic/csmic/bin/Debug/csmic.pdb differ
diff --git a/CS-MIC/csmic/csmic/coco.exe b/CS-MIC/csmic/csmic/coco.exe
new file mode 100644
index 0000000..6822fa6
Binary files /dev/null and b/CS-MIC/csmic/csmic/coco.exe differ
diff --git a/CS-MIC/csmic/csmic/obj/Debug/csmic.csproj.CoreCompileInputs.cache b/CS-MIC/csmic/csmic/obj/Debug/csmic.csproj.CoreCompileInputs.cache
new file mode 100644
index 0000000..6d52104
--- /dev/null
+++ b/CS-MIC/csmic/csmic/obj/Debug/csmic.csproj.CoreCompileInputs.cache
@@ -0,0 +1 @@
+5775a073493428828d0febeeaa7c8078a54e5d15
diff --git a/CS-MIC/csmic/csmic/obj/Debug/csmic.csproj.FileListAbsolute.txt b/CS-MIC/csmic/csmic/obj/Debug/csmic.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..0286e20
--- /dev/null
+++ b/CS-MIC/csmic/csmic/obj/Debug/csmic.csproj.FileListAbsolute.txt
@@ -0,0 +1,6 @@
+C:\Users\wages\Documents\GitHub\cs-mic\CS-MIC\csmic\csmic\bin\Debug\csmic.XML
+C:\Users\wages\Documents\GitHub\cs-mic\CS-MIC\csmic\csmic\bin\Debug\csmic.dll
+C:\Users\wages\Documents\GitHub\cs-mic\CS-MIC\csmic\csmic\bin\Debug\csmic.pdb
+C:\Users\wages\Documents\GitHub\cs-mic\CS-MIC\csmic\csmic\obj\Debug\csmic.csproj.CoreCompileInputs.cache
+C:\Users\wages\Documents\GitHub\cs-mic\CS-MIC\csmic\csmic\obj\Debug\csmic.dll
+C:\Users\wages\Documents\GitHub\cs-mic\CS-MIC\csmic\csmic\obj\Debug\csmic.pdb
diff --git a/CS-MIC/csmic/csmic/obj/Debug/csmic.dll b/CS-MIC/csmic/csmic/obj/Debug/csmic.dll
new file mode 100644
index 0000000..f707ec3
Binary files /dev/null and b/CS-MIC/csmic/csmic/obj/Debug/csmic.dll differ
diff --git a/CS-MIC/csmic/csmic/obj/Debug/csmic.pdb b/CS-MIC/csmic/csmic/obj/Debug/csmic.pdb
new file mode 100644
index 0000000..6a42ea8
Binary files /dev/null and b/CS-MIC/csmic/csmic/obj/Debug/csmic.pdb differ