This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##[[ | |
cflags '-I/usr/include/tensorflow' | |
linklib 'tensorflow' | |
cinclude '<tensorflow/c/c_api.h>' | |
]] | |
global TF_AttrType: type <cimport, nodecl, using> = @enum(cint){ | |
TF_ATTR_STRING = 0, | |
TF_ATTR_INT = 1, | |
TF_ATTR_FLOAT = 2, | |
TF_ATTR_BOOL = 3, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local fs = require 'nelua.utils.fs' | |
local traits = require 'nelua.utils.traits' | |
local stringer = require 'nelua.utils.stringer' | |
local parser = require 'nelua.syntaxdefs'().parser | |
local re = require 'nelua.thirdparty.relabel' | |
local filename = 'lib/string.nelua' | |
local filecode = fs.ereadfile(filename) | |
local ast = parser:parse(filecode, filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
collectgarbage('stop') -- we don't want the GC to generate noise in the benchmarks | |
local function bench(f, n) | |
collectgarbage('collect') | |
n = n or 1000000 | |
local rdtsc = require 'rdtsc' | |
local s = rdtsc() | |
for _=1,n do | |
f() | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##[=[ | |
linklib 'lua' | |
cinclude '<lua.h>' | |
cinclude '<lauxlib.h>' | |
cinclude '<lualib.h>' | |
local ccdefs = require 'nelua.ccompiler'.get_cc_defines('<lua.h>') | |
static_assert(ccdefs.LUA_VERSION_NUM == 504, 'unsupported Lua version') | |
local c2nelua = { | |
['double'] = float64, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'arduino' | |
-- user configurable defines | |
local CELL_SIZE: cint <comptime> = 4 -- the height and width of each cell | |
local DELAY: cint <comptime> = 50 -- number of milliseconds delay between the display of each generation | |
-- end of user configurable defines | |
local ROWS: cint <comptime> = (DISPLAY_HEIGHT // CELL_SIZE) | |
local COLUMNS: cint <comptime> = (DISPLAY_WIDTH // CELL_SIZE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package = "luacov" | |
version = "scm-1" | |
source = { | |
url = "git+https://github.com/keplerproject/luacov.git", | |
} | |
description = { | |
summary = "Coverage analysis tool for Lua scripts", | |
detailed = [[ | |
LuaCov is a simple coverage analysis tool for Lua scripts. | |
When a Lua script is run with the luacov module, it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __KERNEL__ | |
#define __KERNEL__ | |
#endif | |
#ifndef MODULE | |
#define MODULE | |
#endif | |
#include <generated/autoconf.h> | |
#include <linux/kernel.h> | |
#include <linux/module.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local re = require 'relabel' | |
local file = require 'pl.file' | |
local stringx = require 'pl.stringx' | |
local grammar = [[ | |
body <- {| line+ |} | |
line <- (extern / anyline) | |
anyline <- linerest | |
linerest<- [^;]* ';' sp | |
sp <- %s* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------------------------------- | |
-- meta programming utilities for inheritance | |
##[[ | |
local function check_record_type(sym) | |
staticassert(sym and sym.type and sym.type:is_type() and sym.value:is_record(), | |
"symbol '%s' must be a type holding a record type", sym.name) | |
return sym.value | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdio.h> | |
struct Shape { | |
Shape(int64_t x, int64_t y): x(x), y(y) {} | |
virtual int64_t area() {return 0;} | |
int64_t x, y; | |
}; | |
struct Rectangle : public Shape { |