View CSharpAntlrParser.cs
List<IToken> codeTokens = new List<IToken>();
List<IToken> commentTokens = new List<IToken>();
Lexer preprocessorLexer = new CSharpLexer(new AntlrInputStream(sourceCode));
// Collect all tokens with lexer (CSharpLexer.g4).
var tokens = preprocessorLexer.GetAllTokens();
var directiveTokens = new List<IToken>();
var directiveTokenSource = new ListTokenSource(directiveTokens);
var directiveTokenStream = new CommonTokenStream(directiveTokenSource, CSharpLexer.DIRECTIVE);
CSharpPreprocessorParser preprocessorParser = new CSharpPreprocessorParser(directiveTokenStream);
View PolynomialRegression.cs
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Generic;
public class PolynomialRegression
{
private int _order;
private Vector<double> _coefs;
/// <summary>
/// Calculates polynom regression for xData = [x1, x2, ... , xn] and yData = [y1, y2, ... , yn].
View Kotlin.md

Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

View PolygonTriangulator.cs
using System.Collections.Generic;
using System.Drawing;
public class PolygonTriangulator
{
/// <summary>
/// Calculate list of convex polygons or triangles.
/// </summary>
/// <param name="Polygon">Input polygon without self-intersections (it can be checked with SelfIntersection().</param>
/// <param name="triangulate">true: splitting on triangles; false: splitting on convex polygons.</param>
View remarks.md

Функциональность

  • Некорректная обработка чисел больше размерности int. Например, 9999999999999999999=-1981284353.
  • IndexOutOfRangeException в случае пустого ввода и в случае если оператор умножения или сложения находятся в начале: +2, *2.
  • Программа не покрыта тестами.
  • Дублирование логики в switch - case. Символьный тип элементарно перевести в число, а блок с проверкой от '0' до '9' заменяется одной строчкой. То же самое относится к операторам '*' и '+'.
View Tetration.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
View CSharp6_features.cs
using static System.Console;
using static System.Math;
using static System.DayOfWeek;
using static System.Linq.Enumerable;
namespace CSharp6Samples
{
public class Test
{
// Initializers for auto-properties
View Expression.cs
using System.Collections.Generic;
using static System.Console;
namespace Expressions
{
public enum Operation
{
Add,
Mult,
Int
View CSharp6FeaturiesWalker.cs
public class CSharp6FeaturiesWalker : CSharpSyntaxWalker
{
public bool CSharp6Featuries { get; private set; }
public CSharp6FeatureWalker()
{
}
public override void VisitPropertyDeclaration(PropertyDeclarationSyntax node)
{
View ProgrammerCoffe.cs
using System;
using static System.Console;
namespace ProgrammerCoffe
{
class Program
{
static void Main(string[] args)
{
do