This project is read-only.
Project Members: Please make sure you have read the Developers Information.


Development Documentation
Release: 0.1
Started Date: 08/05/2013
Author: Daniel J. Samson

Table Of Contents


Sharp is an application or tool used to convert a programming language into another programming language or into machine code that can be executed by the computer. Sharp was creating with the intention to allow software engineers to develop system level software such as operating systems using very high level languages. This document describes Sharp and the features of this release.

Table Of Contents


Most system level tasks are written in assembly or in C. The intention of sharp is to allow a person to be able to write system level software using programming languages like C#. ECMAScript, Python, Perl, and Basic. These languages often have a cleaner style, which makes them easier to read. Some of these languages are designed to allow rapid application development. This implies that system level tasks could be developed faster by using these high level languages.

Table Of Contents

Release Features

  • ECMA-334 Support - The C# Language Specification.
  • Write out to an Assembly Language.
  • Syntax validation.
  • Reporting of errors, warnings.
  • Reporting of unsupported features.

Table Of Contents

Understanding the compilation process

A program consist of one or more source files called compilation units. A source file is an ordered sequence of statements (or lines of code) which are made up of Unicode characters. During compilation, the source file is then converted into an intermediate language, which is then in turn converted into machine code. The compiler undergoes the following steps to make this possible:
Transformation prepares the compilation unit by converting its character encoding into the Unicode encoding. So if a file is encoded using ASCII characters, then the compiler must first convert the characters over into Unicode characters.

Lexical Analysis breaks up the source file stream into a set of tokens.

Syntactical Analysis validates the tokens and then translates them into an intermediate data structure. It is responsible for reporting errors, warnings and unsupported features at this point.

Intermediate Language Analysis uses the intermediate data structure to create the intermediate language. In this release, Sharp writes it out into an assembly language.

Linking involves taking the intermediate language and producing the final executable machine code.

The compiler may also include other stages in its implementation to produce the resultant output.

Table Of Contents

The .NET Framework and C#

C# and the .NET Framework are two separate entities. The .NET Framework is a collection of namespaces and classes, that have been pre written by companies such as microsoft to allow developers to access the different parts of the windows operating system. The .NET Framework also implements the Common Language Interface and the Common Intermediate Language. Monodevelop is a project that enables developers to use .NET on other operatings systems such as Unix, Apple MAC OSX and Linux.

C# is an international standard. This international standard is based on a submission from Hewlett-Packard, Intel, and Microsoft, that described a language called C#, which was developed within Microsoft. The principal inventors of this language are Anders Hejlsberg, Scott Wiltamuth, and Peter Golde.

Table Of Contents

Sharp and the .NET Framework

For the minor release 0.1, Sharp will not support the .NET Framework. However, it will support the C# standard library as described in ECMA-334. The purpose of release 0.1 is simply to provide the groundwork for future development of Sharp. Sharp will fully support C# which make it possible to add features like the .NET framework to the compiler. This can be done by extending the standard library namespace called "System".

Table Of Contents

Managed Code and Sharp

Managed code is a term coined by Microsoft to identify computer program source code that requires and will only execute under the management of a Common Language Runtime virtual machine (resulting in bytecode). Sharp does not use a Common Language Runtime virtual machine. The code given to Sharp will become native code resulting in raw executable binary code (referred to as machine code).

Table Of Contents

Memory Management and Sharp

In order to comply with the ECMA-334 international standard Sharp will provide the automatic memory management feature. This involves creating a garbage collector for the developers code and including it in the intermediate language as native code. Which is good news for developers as it means that you do not have to worry about memory management. If a developer wishes to control memory then they can use the unsafe code block feature to control memory in a custom fashion.

Table Of Contents

C# Standard Library

The standard library provides the basic set of types and hosts the predefined System namespace. This is what makes C# useful. It adds the following features:
  • Build In types eg integer, char, real numbers, enums...
  • Predefined reference types eg string, objects, dynamic, class, interface, delegates, attributes...
  • Type Conversion.
  • Boxing and unboxing.
  • Exceptions.
  • Locking.
  • Collections, Enumerators, Generics.
See Sharp's C# Standard Library documentation for more information.

Table Of Contents

Supported keywords

abstract as base bool break
byte case catch char checked
class const continue decimal default
delegate do double else enum
event explicit extern false finally
fixed float for foreach goto
if implicit in int interface
internal is lock long namespace
new null object operator out
override params private protected public
readonly ref return sbyte sealed
short sizeof stackalloc static string
struct switch this throw true
try typeof uint ulong unchecked
unsafe ushort using virtual void
volatile while

Table Of Contents

Lexical Tokens

  • Error
  • Unsupported
  • WhiteSpace
    • WhiteSpaceLineEnding
  • Punctuator
    • PunctuatorCodeBlockStart
    • PunctuatorCodeBlockEnd
    • PunctuatorBracketStart
    • PunctuatorBracketEnd
    • PunctuatorSquareBracketStart
    • PunctuatorSquareBracketEnd
    • PunctuatorComma
    • PunctuatorAccessor
    • PunctuatorColon
    • PunctuatorColonColon
    • PunctuatorSemicolon
  • Operator
    • OperatorLogical
    • OperatorBitwise
    • OperatorMultiplicative
    • OperatorAssignment
    • OperatorLambda
    • OperatorUnary
    • OperatorConditional
    • OperatorEquallity
    • OperatorAddition
    • OperatorShift
    • OperatorTypeTesting
    • OperatorRelational
    • OperatorIncremental
  • Literal
    • LiteralString
    • LiteralCharacter
    • LiteralNumeric
    • LiteralIntegerDecimal
    • LiteralIntegerHexidecimal
    • LiteralReal
    • LiteralRealFloat
    • LiteralRealDouble
    • LiteralRealDecimal
  • Comment
    • CommentSingleLine
    • CommentDelimitedLine
  • PreProcessorDirective
  • Keyword
    • KeywordTypesBuiltIn
    • KeywordTypesReferences
    • KeywordTypeless
    • KeywordModifiers
    • KeywordStatementSelection
    • KeywordStatementIteration
    • KeywordStatementJump
    • KeywordStatementException
    • KeywordStatementChecked
    • KeywordStatementFixed
    • KeywordStatementLock
    • KeywordMethodParameters
    • KeywordNamespace
    • KeywordOperators
    • KeywordConversion
    • KeywordAccess
    • KeywordLiteral
    • KeywordContextual
    • KeywordAcesssModifier
  • Identifier

Table Of Contents


ECMA 334

Last edited May 22, 2013 at 12:15 AM by danieljsamson, version 86


No comments yet.