Skip to content

Instantly share code, notes, and snippets.

View KvanTTT's full-sized avatar

Ivan Kochurkin KvanTTT

View GitHub Profile
This file has been truncated, but you can view the full file.
// Generated from C:\Users\User\AppData\Local\Temp\BaseCppTest-main-1643540272050\L.g4 by ANTLR 4.9.3
#include "L.h"
using namespace antlr4;
This file has been truncated, but you can view the full file.
// Generated from C:\Users\User\AppData\Local\Temp\BaseJavaTest-main-1643656434572\L.g4 by ANTLR 4.9.3
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@KvanTTT
KvanTTT / LargeLexer.g4
Created March 21, 2022 16:33
atnStatesSizeMoreThan65535Descriptor
lexer grammar L;
T_000000: 'T_000000______________________________________________________________________';
T_000001: 'T_000001______________________________________________________________________';
T_000002: 'T_000002______________________________________________________________________';
T_000003: 'T_000003______________________________________________________________________';
T_000004: 'T_000004______________________________________________________________________';
T_000005: 'T_000005______________________________________________________________________';
T_000006: 'T_000006______________________________________________________________________';
T_000007: 'T_000007______________________________________________________________________';
@KvanTTT
KvanTTT / check-range-vs-mask.py
Last active July 4, 2022 08:57
Constant folding benchmark
from dis import dis
import sys
import timeit
warm_up_count = 4
iteration_count = 256
class C:
C0=0
C1=1
# Generated from /tmp/Python3Runner-ForkJoinPool-1-worker-7-1661867391485/P.g4 by ANTLR 4.10.2-SNAPSHOT
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
@KvanTTT
KvanTTT / PolygonTriangulator.cs
Created October 8, 2012 21:31
Short solution for splitting concave polygon on convex polygons or triangles with other utils (SelfIntersection checking).
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>