├── Binaries
├── test-examples
│ ├── empty.b
│ ├── error.b
│ ├── string-decl-crash.b
│ ├── array-crash.b
│ ├── break-b.b
│ ├── test-label-crash.b
│ ├── break-pre.b
│ ├── test-register-assignment.b
│ ├── offset-of-test.b
│ ├── asm-blocks.b
│ ├── struct-in-structs.b
│ ├── error2.b
│ ├── debug-pre
│ ├── strip-test.b
│ ├── array-init.b
│ ├── memberaccess-ssa-test.b
│ ├── test-logicalops.b
│ ├── function-scope-test.b
│ └── v-access.b
├── Emulator
│ └── Emulator
│ │ └── DefaultFont.dat
├── Running DCPUB Code.txt
├── techcompliant
│ ├── cycle_test_against_admiral.b
│ ├── base.b
│ ├── helloworld.b
│ ├── lps.b
│ ├── test-sqrt.b
│ ├── sqrt.b
│ ├── random.b
│ ├── lem.b
│ ├── test-vec3.b
│ ├── test-bitwise.b
│ ├── test-number32.b
│ ├── test-fixed.b
│ ├── test-framework.b
│ ├── hardware.b
│ ├── std.b
│ ├── itoa.b
│ ├── blit.b
│ ├── vec3.b
│ ├── spacehack.b
│ ├── vec.b
│ ├── keyboard.b
│ ├── fixed.b
│ ├── number32.b
│ ├── copy_disc.b
│ └── bitwise-icm-cd2.txt
├── debug-pre
├── keyboard_demo.dc
├── peepholedef.txt
└── vec3d.dc
├── b.zip
├── Irony
├── irony.snk
├── 010.Irony.2008.csproj.user
├── 010.Irony.2010.csproj.user
├── 100.IronySilverlight.2010.csproj.vspscc
├── Parsing
│ ├── Parser
│ │ ├── ParsingEventArgs.cs
│ │ ├── SyntaxError.cs
│ │ └── ParserStack.cs
│ ├── Terminals
│ │ ├── QuotedValueLiteral.cs
│ │ ├── WikiTerminals
│ │ │ ├── WikiBlockTerminal.cs
│ │ │ ├── WikiTagTerminal.cs
│ │ │ ├── _WikiTerminalBase.cs
│ │ │ └── WikiTextTerminal.cs
│ │ ├── FixedLengthLiteral.cs
│ │ ├── CustomTerminal.cs
│ │ ├── ImpliedSymbolTerminal.cs
│ │ ├── NewLineTerminal.cs
│ │ └── ConstantTerminal.cs
│ ├── Data
│ │ ├── ScannerData.cs
│ │ ├── LanguageData.cs
│ │ └── Construction
│ │ │ └── LanguageDataBuilder.cs
│ ├── Diagnostics
│ │ ├── ParserTrace.cs
│ │ └── ParserMessage.cs
│ ├── AstInterfaces.cs
│ ├── Grammar
│ │ ├── LanguageAttribute.cs
│ │ └── TermReportGroups.cs
│ └── Scanner
│ │ └── SourceLocation.cs
├── Interpreter
│ ├── ValuesTable.cs
│ ├── Ast
│ │ ├── SpecialNodes
│ │ │ ├── EmptyStatementNode.cs
│ │ │ ├── NullNode.cs
│ │ │ └── NotSupportedNode.cs
│ │ ├── Base
│ │ │ ├── AstException.cs
│ │ │ └── AstInterfaces.cs
│ │ ├── PrimitiveNodes
│ │ │ ├── LiteralValueNode.cs
│ │ │ └── IdentifierNode.cs
│ │ ├── Statements
│ │ │ ├── BlockNode.cs
│ │ │ ├── IfNode.cs
│ │ │ └── StatementListNode.cs
│ │ ├── Expressions
│ │ │ ├── ExpressionListNode.cs
│ │ │ ├── BinaryOperationNode.cs
│ │ │ └── UnaryOperationNode.cs
│ │ └── Functions
│ │ │ ├── ParamListNode.cs
│ │ │ ├── FunctionCallNode.cs
│ │ │ └── FunctionDefNode.cs
│ ├── RuntimeException.cs
│ ├── StackFrame.cs
│ └── DataStack.cs
├── SilverlightOnly
│ ├── Stopwatch.cs
│ └── HashSet.cs
└── 100.IronySilverlight.2010.csproj.user
├── Tools
├── Emulator
│ ├── DefaultFont.dat
│ ├── HardwareDevice.cs
│ ├── LEM1802Window.cs
│ ├── KeyboardWindow.cs
│ └── Keyboard.cs
└── DCPUBIDE
│ ├── app.config
│ ├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ └── AssemblyInfo.cs
│ ├── Program.cs
│ └── TextBoxStream.cs
├── Irony.GrammarExplorer
├── Highlighter
│ └── AboutCodeHighlighter.txt
├── 030.Irony.GrammarExplorer.2010.csproj.user
├── 030.Irony.GrammarExplorer.2010.csproj.vspscc
├── Properties
│ ├── Settings.settings
│ └── AssemblyInfo.cs
├── fmShowException.cs
├── app.config
├── Program.cs
└── fmShowException.Designer.cs
├── DCPUB
├── Intermediate
│ ├── Box.cs
│ ├── LabelNode.cs
│ ├── Label.cs
│ ├── Peephole
│ │ ├── Peepholes.cs
│ │ ├── Matcher.cs
│ │ ├── InstructionMatcher.cs
│ │ ├── Rule.cs
│ │ └── WholeInstructionMatcher.cs
│ ├── Annotation.cs
│ ├── Function.cs
│ ├── StaticData.cs
│ └── InlineStaticDataNode.cs
├── ConfigurationError.cs
├── EmissionStream.cs
├── Model
│ ├── Label.cs
│ ├── Struct.cs
│ ├── Member.cs
│ ├── Variable.cs
│ └── Function.cs
├── Testing
│ ├── HardwareDevice.cs
│ └── TeleTerminalHardware.cs
├── Ast
│ ├── AssignableNode.cs
│ ├── NullStatementNode.cs
│ ├── NotOperatorNode.cs
│ ├── NegateOperatorNode.cs
│ ├── IndexOperatorNode.cs
│ ├── Assembly
│ │ └── InstructionListAstNode.cs
│ ├── GotoNode.cs
│ ├── CastNode.cs
│ ├── LabelNode.cs
│ ├── ReturnStatementNode.cs
│ ├── CompilableNode.cs
│ ├── DereferenceNode.cs
│ ├── BreakNode.cs
│ ├── SizeofNode.cs
│ ├── RootProgramNode.cs
│ ├── OffsetOfNode.cs
│ ├── ArrayInitializationNode.cs
│ ├── Target.cs
│ └── StringLiteralNode.cs
├── InternalError.cs
├── SSA
│ ├── SSAValue.cs
│ ├── SSAValue_Constant.cs
│ ├── SSAValue_Variable.cs
│ ├── SSAValue_DerefOffsetVirtual.cs
│ ├── SSAValue_Virtual.cs
│ └── SSAInstruction.cs
├── Upsert.cs
├── CompileOptions.cs
├── Properties
│ └── AssemblyInfo.cs
├── Build.cs
├── OperandGrammar.cs
├── Preprocessor
│ └── PreprocessedLineLocationTable.cs
└── AssemblyGrammar.cs
├── .gitignore
├── DCPUBCL
├── FileEmissionStream.cs
└── Properties
│ └── AssemblyInfo.cs
└── DCPUBPreprocessor
├── Program.cs
└── Properties
└── AssemblyInfo.cs
/Binaries/test-examples/empty.b:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Binaries/test-examples/error.b:
--------------------------------------------------------------------------------
1 | #include error2.b
2 |
--------------------------------------------------------------------------------
/b.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blecki/DCPUB/HEAD/b.zip
--------------------------------------------------------------------------------
/Irony/irony.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blecki/DCPUB/HEAD/Irony/irony.snk
--------------------------------------------------------------------------------
/Binaries/test-examples/string-decl-crash.b:
--------------------------------------------------------------------------------
1 | local message = "string literal";
2 |
--------------------------------------------------------------------------------
/Binaries/test-examples/array-crash.b:
--------------------------------------------------------------------------------
1 | static foo;
2 | local bar[2] = {&foo,&foo};
3 |
--------------------------------------------------------------------------------
/Binaries/test-examples/break-b.b:
--------------------------------------------------------------------------------
1 | This program exists merely to test the compiler's error reporting.
2 |
--------------------------------------------------------------------------------
/Binaries/test-examples/test-label-crash.b:
--------------------------------------------------------------------------------
1 |
2 | goto ERROR;
3 |
4 | :ERROR
5 |
6 | goto ERROR;
7 |
8 |
--------------------------------------------------------------------------------
/Tools/Emulator/DefaultFont.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blecki/DCPUB/HEAD/Tools/Emulator/DefaultFont.dat
--------------------------------------------------------------------------------
/Binaries/Emulator/Emulator/DefaultFont.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Blecki/DCPUB/HEAD/Binaries/Emulator/Emulator/DefaultFont.dat
--------------------------------------------------------------------------------
/Binaries/test-examples/break-pre.b:
--------------------------------------------------------------------------------
1 | #define
2 |
3 | #define foo(a,b) whatever
4 |
5 | foo(a,b,c);
6 |
7 | #endif with extra stuff
8 |
9 |
--------------------------------------------------------------------------------
/Binaries/Running DCPUB Code.txt:
--------------------------------------------------------------------------------
1 | TO compile:
2 | bin\b "your file" -b
3 |
4 | To test:
5 | lettuce\lettuce --nowait --little-endian "yourfile.bin"
--------------------------------------------------------------------------------
/Binaries/test-examples/test-register-assignment.b:
--------------------------------------------------------------------------------
1 | local a = 5;
2 | local b = 20;
3 |
4 | local c = 0;
5 | c += a * b + 4 * a - b * a / b + a * b;
6 |
7 |
--------------------------------------------------------------------------------
/Irony.GrammarExplorer/Highlighter/AboutCodeHighlighter.txt:
--------------------------------------------------------------------------------
1 | This highlighter is not a real thing, just a sketch - good enough to highlight samples in Grammar Explorer
--------------------------------------------------------------------------------
/Binaries/test-examples/offset-of-test.b:
--------------------------------------------------------------------------------
1 | struct foo
2 | {
3 | bar;
4 | stool;
5 | }
6 |
7 | local x = offsetof stool in foo;
8 | local y = sizeof foo;
9 |
10 |
--------------------------------------------------------------------------------
/Binaries/techcompliant/cycle_test_against_admiral.b:
--------------------------------------------------------------------------------
1 | #include default_environment.b
2 |
3 | local x = 0;
4 | while (x < 101)
5 | {
6 | printf("%N", x);
7 | x += 1;
8 | }
9 |
--------------------------------------------------------------------------------
/Tools/DCPUBIDE/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Irony/010.Irony.2008.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 | ShowAllFiles
4 |
5 |
--------------------------------------------------------------------------------
/Binaries/test-examples/asm-blocks.b:
--------------------------------------------------------------------------------
1 | /* Test syntax of ASM blocks - All examples should be legal syntax. */
2 |
3 | asm ( A = 4 ) {}
4 | asm ( A = 4; B = 5 ) {}
5 | asm ( A = 4, B = 5 ) {}
6 | asm () {}
7 | asm {}
8 |
9 |
--------------------------------------------------------------------------------
/Binaries/test-examples/struct-in-structs.b:
--------------------------------------------------------------------------------
1 | struct foo
2 | {
3 | a;
4 | b;
5 | }
6 |
7 | struct bar
8 | {
9 | a:foo[sizeof foo];
10 | b:foo[sizeof foo];
11 | c;
12 | }
13 |
14 | local x = sizeof bar;
15 |
--------------------------------------------------------------------------------
/Binaries/debug-pre:
--------------------------------------------------------------------------------
1 | /* 0 */
2 | /* 1 */
3 | /* 2 */
4 | /* 3 */// This file has an error - and is included in another file!
5 | /* 4 */function foo(a, b)
6 | /* 5 */{
7 | /* 6 */ c = 5;
8 | /* 7 */}
9 | /* 8 */
10 |
11 |
--------------------------------------------------------------------------------
/Binaries/test-examples/error2.b:
--------------------------------------------------------------------------------
1 | /* 0 */
2 | /* 1 */
3 | /* 2 */
4 | /* 3 */// This file has an error - and is included in another file!
5 | /* 4 */function foo(a, b)
6 | /* 5 */{
7 | /* 6 */ c = 5;
8 | /* 7 */}
9 | /* 8 */
10 |
--------------------------------------------------------------------------------
/Binaries/test-examples/debug-pre:
--------------------------------------------------------------------------------
1 | /* 0 */
2 | /* 1 */
3 | /* 2 */
4 | /* 3 */// This file has an error - and is included in another file!
5 | /* 4 */function foo(a, b)
6 | /* 5 */{
7 | /* 6 */ c = 5;
8 | /* 7 */}
9 | /* 8 */
10 |
11 |
--------------------------------------------------------------------------------
/DCPUB/Intermediate/Box.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace DCPUB.Intermediate
7 | {
8 | public class Box where T : struct { public T data; }
9 | }
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
2 | bin
3 | obj
4 |
5 | # mstest test results
6 | TestResults
7 | *.suo
8 | *.lnk
9 | *.user
10 | *.bin
11 | *.dasm
12 | *.bat
13 | *.img
14 | *.pdc
15 | *.dll
16 | *.exe
17 |
--------------------------------------------------------------------------------
/Irony/010.Irony.2010.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ShowAllFiles
5 |
6 |
--------------------------------------------------------------------------------
/Binaries/test-examples/strip-test.b:
--------------------------------------------------------------------------------
1 | function a() {}
2 | function b() { c(); }
3 | function c() {}
4 | function d() { e(); }
5 | function e() { local a = &f; }
6 | function f() { }
7 | function g() { h(); }
8 | function h() { g(); }
9 |
10 |
11 | c();
12 | d();
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Binaries/test-examples/array-init.b:
--------------------------------------------------------------------------------
1 | static a;
2 | static b[2] = { 0xDEAD, 0xBEEF };
3 | static c = &a;
4 | static d[2] = { &a, b };
5 | function e() {}
6 | static f = &e;
7 | static g = "abcdef";
8 | static h[3] = { d, &e, &a };
9 | local i[2] = { 1, 2 };
10 | local j[1] = { 3 };
11 |
12 |
--------------------------------------------------------------------------------
/Irony.GrammarExplorer/030.Irony.GrammarExplorer.2010.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ShowAllFiles
5 |
6 |
--------------------------------------------------------------------------------
/Tools/DCPUBIDE/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DCPUB/ConfigurationError.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace DCPUB
7 | {
8 | public class ConfigurationError : Exception
9 | {
10 | public ConfigurationError(String msg) : base(msg) { }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/DCPUB/EmissionStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace DCPUB
7 | {
8 | public class EmissionStream
9 | {
10 | public int indentDepth = 0;
11 |
12 | public virtual void WriteLine(String line) { }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Irony/100.IronySilverlight.2010.csproj.vspscc:
--------------------------------------------------------------------------------
1 | ""
2 | {
3 | "FILE_VERSION" = "9237"
4 | "ENLISTMENT_CHOICE" = "NEVER"
5 | "PROJECT_FILE_RELATIVE_PATH" = ""
6 | "NUMBER_OF_EXCLUDED_FILES" = "0"
7 | "ORIGINAL_PROJECT_FILE_PATH" = ""
8 | "NUMBER_OF_NESTED_PROJECTS" = "0"
9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
10 | }
11 |
--------------------------------------------------------------------------------
/DCPUB/Model/Label.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Irony.Interpreter.Ast;
6 |
7 | namespace DCPUB.Model
8 | {
9 | public class Label
10 | {
11 | public String declaredName;
12 | public Intermediate.Label realName;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/DCPUB/Testing/HardwareDevice.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace DCPUB.Testing
3 | {
4 | public interface HardwareDevice
5 | {
6 | uint ManufacturerID { get; }
7 | uint HardwareID { get; }
8 | ushort Version { get; }
9 |
10 | void OnAttached(Emulator emu);
11 | void OnInterrupt(Emulator emu);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tools/Emulator/HardwareDevice.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace DCPUB.Emulator
3 | {
4 | public interface HardwareDevice
5 | {
6 | uint ManufacturerID { get; }
7 | uint HardwareID { get; }
8 | ushort Version { get; }
9 |
10 | void OnAttached(Emulator emu);
11 | void OnInterrupt(Emulator emu);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Irony.GrammarExplorer/030.Irony.GrammarExplorer.2010.csproj.vspscc:
--------------------------------------------------------------------------------
1 | ""
2 | {
3 | "FILE_VERSION" = "9237"
4 | "ENLISTMENT_CHOICE" = "NEVER"
5 | "PROJECT_FILE_RELATIVE_PATH" = ""
6 | "NUMBER_OF_EXCLUDED_FILES" = "0"
7 | "ORIGINAL_PROJECT_FILE_PATH" = ""
8 | "NUMBER_OF_NESTED_PROJECTS" = "0"
9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
10 | }
11 |
--------------------------------------------------------------------------------
/Binaries/test-examples/memberaccess-ssa-test.b:
--------------------------------------------------------------------------------
1 | // Do not run this code.
2 |
3 | struct foo
4 | {
5 | a;
6 | b;
7 | }
8 |
9 | local x:foo[sizeof foo];
10 |
11 | x.a = 4;
12 | x.b = 5;
13 |
14 | if (x.a > x.b)
15 | {
16 | x.a = 6;
17 | }
18 |
19 | local y:foo = 0x2000; // Don't do this.
20 |
21 | if (y.a != y.b)
22 | {
23 | y.b = x.a;
24 | }
25 |
26 |
27 |
--------------------------------------------------------------------------------
/DCPUB/Ast/AssignableNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace DCPUB.Ast
7 | {
8 | public interface AssignableNode
9 | {
10 | Intermediate.IRNode EmitAssignment(CompileContext context, Model.Scope scope, Intermediate.Operand from, Intermediate.Instructions opcode);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Irony/Parsing/Parser/ParsingEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Irony.Parsing {
7 | public class ParsingEventArgs : EventArgs {
8 | public readonly ParsingContext Context;
9 | public ParsingEventArgs(ParsingContext context) {
10 | Context = context;
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/DCPUB/InternalError.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace DCPUB
7 | {
8 | public class InternalError : Exception
9 | {
10 | public InternalError(String msg) : base(msg) { }
11 | public InternalError(Exception InnerException) : base("Internal Error", InnerException) { }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Irony/Interpreter/ValuesTable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Irony.Parsing;
6 |
7 | namespace Irony.Interpreter {
8 | public class ValuesTable : Dictionary {
9 | public ValuesTable(int capacity) : base(capacity) { }
10 | }//class
11 |
12 | public class ValuesList : List