Skip to content

Instantly share code, notes, and snippets.

Ondřej Čertík certik

Block or report user

Report or block certik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ast.h
#ifndef LFORTRAN_AST_H
#define LFORTRAN_AST_H
// Generated by grammar/asdl_cpp.py
#include <lfortran/parser/alloc.h>
#include <lfortran/parser/location.h>
#include <lfortran/casts.h>
#include <lfortran/colors.h>
#include <lfortran/exception.h>
View generated_1.py
This file has been truncated, but you can view the full file.
# -*- coding: utf-8 -*-
from sympy import *
from matchpy import *
from sympy.integrals.rubi.utility_function import *
from sympy.integrals.rubi.constraints import *
# from sympy.integrals.rubi.symbol import *
from matchpy.matching.many_to_one import CommutativeMatcher
from collections import deque
@certik
certik / README.md
Last active Aug 7, 2019
std::move benchmark
View README.md

Compile and run using:

$ g++ -Wall -O3 -march=native -funroll-loops bench.cpp move.cpp && ./a.out 
1
1705032704
4034ms
2
1705032704
3466ms
View gist:058dd145a0d0b83ce8086ab47d405445
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# What is the difference between an AST and ASR?\n",
"\n",
"Let us take a simple Fortran code:\n",
"```fortran\n",
View c.f90
program exceptions
implicit none
integer :: s, stat_manual
integer, status :: stat
call mysum(5, s, stat_manual)
if (stat_manual /= 0) error stop
print *, s
! Equivalent to the above
View b.f90
program exceptions
implicit none
integer :: s, stat
call mysum(5, s, stat)
if (stat /= 0) error stop
print *, s
! Equivalent to the above
try mysum(5, s, stat)
View a.f90
program exceptions
implicit none
integer :: s, stat
call mysum(5, s, stat)
if (stat /= 0) error stop
print *, s
call mysum(5, s)
print *, s
View gist:448a7b18e567c2036068720feca00bcb
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Installation\n",
"\n",
"Install `xeus-cling`:\n",
"\n",
View gist:bfe3dc99c4b6c4c4c778c51646114104
In file included from input_line_7:1:
/home/certik/ext/miniconda3/envs/cling/bin/../lib/gcc/../../gcc/include/c++/variant:238:46: error: cannot cast 'std::variant<int, float>' to its private base class
'std::__detail::__variant::_Variant_storage<true, int, float>'
return __get(std::in_place_index<_Np>, std::forward<_Variant>(__v)._M_u);
^
/home/certik/ext/miniconda3/envs/cling/bin/../lib/gcc/../../gcc/include/c++/variant:1198:35: note: in instantiation of function template specialization
'std::__detail::__variant::__get<0, std::variant<int, float> &>' requested
here
return __detail::__variant::__get<_Np>(__v);
^
View gist:afb931f4f72ad171cab83b9141cdcfcc
$ py.test ../tests/
============================= test session starts ==============================
platform linux -- Python 3.7.0, pytest-3.8.2, py-1.7.0, pluggy-0.7.1
rootdir: /tmp/flit, inifile:
plugins: cov-2.6.0
collected 83 items
../tests/test_build.py .. [ 2%]
../tests/test_buildapi.py .... [ 7%]
../tests/test_command.py FF [ 9%]
You can’t perform that action at this time.