Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View aolo2's full-sized avatar

Алексей Олохтонов aolo2

View GitHub Profile
#include "gcc-plugin.h"
int plugin_is_GLP_complatinle = 1;
static struct plugin_info gimple_print_info =
{
.version = "1",
.help = "Display the GIMPLE/IR in a readable manner",
};
#include <gcc-plugin.h>
#include <plugin-version.h>
#include <coretypes.h>
#include <tree.h>
#include <gimple.h>
#include <gimple-iterator.h>
#include <tree-pass.h>
#include <context.h>
#include <basic-block.h>
class Pos private(val prog: String, val offs: Int, val line: Int, val col: Int) {
def this(prog: String) = this(prog, 0, 1, 1)
def ch = if (offs == prog.length) -1 else prog(offs)
def inc = ch match {
case '\n' => new Pos(prog, offs + 1, line + 1, 1)
case -1 => this
case _ => new Pos(prog, offs + 1, line, col + 1)
}
class Pos private(val prog: String, val offs: Int, val line: Int, val col: Int) {
def this(prog: String) = this(prog, 0, 1, 1)
def ch = if (offs == prog.length) -1 else prog(offs)
def inc = ch match {
case '\n' => new Pos(prog, offs + 1, line + 1, 1)
case -1 => this
case _ => new Pos(prog, offs + 1, line, col + 1)
}
import java.util.regex.*;
public class Lab3 {
private static void test_match(String text) {
String stringLiteral = "`(`{2}|[.\\s])*`";
String numLiteral = "[0-9]+|[01]+b";
String ident = "[\\?\\*\\|][0-9\\?\\*\\|]";
String pattern = "(^" + stringLiteral + ")|(^" + numLiteral + ")|(^" + ident + ")";
Pattern p = Pattern.compile(pattern);
import java.util.regex.*;
public class Lab3 {
private static void test_match(String text) {
String stringLiteral = "`(?:(?:`{2})|(?:[^`])|(?:\\n))*`"; // correct
String numLiteral = "[01]+b|[0-9]+"; // correct
String ident = "[\\?\\*\\|][0-9\\?\\*\\|]*"; // correct?
String pattern = "(^" + stringLiteral + ")|(^" + numLiteral + ")|(^" + ident + ")";
Pattern p = Pattern.compile(pattern);
#include <cstdint>
#define internal static
typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef int64_t int64;
typedef uint8_t uint8;
#include <cstdio>
#include <cstdlib>
#include "token.cpp"
const int32 IDENT_CODE = 1;
internal char
cp(position &pos)
{
#include <cstdio>
int
main(void)
{
for (unsigned int i = 0; i < 5; ++i)
{
printf("%d\n", i);
}