View elorn-raspi-part-1.lua
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 'sched' | |
require 'web.server' | |
require 'web.template' | |
require 'serial' | |
telnet = require 'shell.telnet' | |
uart = serial.open('/dev/ttyAMA0', { baudrate=19200 }) | |
-- Read enough data from the UART to extract two consecutive frames. | |
function get_raw_data() |
View gist:1301283
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
-{ extension "match" } | |
local M = { traverse = { }; tags = { }; debug = false } | |
-------------------------------------------------------------------------------- | |
-- Standard tags: can be used to guess the type of an AST, or to check | |
-- that the type of an AST is respected. | |
-------------------------------------------------------------------------------- | |
M.tags.stat = table.transpose{ |
View gist:1301275
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 walk = require 'metalua.treequery.walk' | |
local M = { } | |
-- support for old-style modules | |
treequery = M | |
-- ----------------------------------------------------------------------------- | |
-- ----------------------------------------------------------------------------- | |
-- | |
-- multimap helper mmap: associate a key to a set of values |
View gist:1264752
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
-- Low level AST traversal library. | |
-- This library is a helper for the higher-level treequery library. | |
-- It walks through every node of an AST, depth-first, and executes | |
-- some callbacks contained in its cfg config table: | |
-- | |
-- * cfg.down(...) is called when it walks down a node, and receive as | |
-- parameters the node just entered, followed by its parent, grand-parent | |
-- etc. until the root node. | |
-- | |
-- * cfg.up(...) is called when it walks back up a node, and receive as |
View gist:1264745
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 walk = require 'metalua.treequery.walk' | |
local M = { } | |
-- support for old-style modules | |
treequery = M | |
-- multimap helper mmap: associate a key to a set of values | |
local function mmap_add (mmap, node, x) | |
if node==nil then return false end | |
local set = mmap[node] |
View gist:1250474
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 'metalua.walk' | |
local M = { } | |
-- support for old-style modules | |
treequery=M | |
-- multimap helper mmap: associate a key to a set of values | |
local function mmap_add (mmap, node, x) | |
if node==nil then return false end | |
local set = mmap[node] |