Skip to content

Instantly share code, notes, and snippets.

Working from home

Ivan Kochurkin KvanTTT

Working from home
View GitHub Profile
# 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
from import TextIO
KvanTTT /
Last active Jul 4, 2022
Constant folding benchmark
from dis import dis
import sys
import timeit
warm_up_count = 4
iteration_count = 256
class C:
KvanTTT / LargeLexer.g4
Created Mar 21, 2022
View LargeLexer.g4
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______________________________________________________________________';
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.*;
View LargeLexer.cpp
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;
KvanTTT / LargeLexerNew.cs
Created Jan 21, 2022
Old vs New Atn Serialization C#
View LargeLexerNew.cs
// <auto-generated>
// This code was generated by a tool.
// ANTLR Version: 4.9.3
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
Last active Feb 13, 2021
; R E SH I
; E S L I
; S I L E N
; Обявление уникальных букв
(declare-const R Int)
(declare-const E Int)
(declare-const SH Int)
(declare-const I Int)
View ReflectedTime.cs
using System;
class Program
static void Main()
int validTimeCount = 0;
for (int hour = 0; hour < 24; hour++)
KvanTTT / SwitchByObjectVsInt.cs
Created Mar 13, 2020
Compare generated code for switch by object vs switch by int
View SwitchByObjectVsInt.cs
using System;
public class C {
public const int C1Type = 1;
public const int C2Type = 2;
public const int C3Type = 3;
public const int C4Type = 4;
public abstract class Base
View MeowWoof.cs
class Program
class Animal
class Cat : Animal
public void Meow()