Archived
1
0
Commit Graph

30 Commits

Author SHA1 Message Date
Jacob Alexander
f610d0fb15 KLL Compiler Re-Write
This was many months of efforts in re-designing how the KLL compiler should work.
The major problem with the original compiler was how difficult it was to extend language wise.
This lead to many delays in KLL 0.4 and 0.5 being implemented.

The new design is a multi-staged compiler, where even tokenization occurs over multiple stages.
This allows individual parsing and token regexes to be expressed more simply without affect other expressions.

Another area of change is the concept of Contexts.
In the original KLL compiler the idea of a cache assigned was "hacked" on when I realized the language was "broken" (after nearly finishing the compiler).
Since assignment order is generally considered not to matter for keymappings, I created a "cached" assignment where the whole file is read into a sub-datastructure, then apply to the master datastructure.
Unfortunately, this wasn't really all that clear, so it was annoying to work with.
To remedy this, I created KLL Contexts, which contain information about a group of expressions.
Not only can these groups can be merged with other Contexts, they have historical data about how they were generated allowing for errors very late in processing to be pin-pointed back to the offending kll file.

Backends work nearly the same as they did before.
However, all call-backs for capability evaluations have been removed.
This makes the interface much cleaner as Contexts can only be symbolically merged now.
(Previously datastructures did evaluation merges where the ScanCode or Capability was looked up right before passing to the backend, but this required additional information from the backend).

Many of the old parsing and tokenization rules have been reused, along with the hid_dict.py code.

The new design takes advantage of processor pools to handle multithreading where it makes sense.
For example, all specified files are loaded into ram simulatenously rather than sparingly reading from.
The reason for this is so that each Context always has all the information it requires at all times.

kll
- Program entry point (previously kll.py)
- Very small now, does some setting up of command-line args
- Most command-line args are specified by the corresponding processing stage

common/channel.py
- Pixel Channel container classes

common/context.py
- Context container classes
- As is usual with other files, blank classes inherit a base class
- These blank classes are identified by the class name itself to handle special behaviour
- And if/when necessary functions are re-implemented
- MergeConext class facilitates merging of contexts while maintaining lineage

common/expression.py
- Expression container classes
  * Expression base class
  * AssignmentExpression
  * NameAssociationExpression
  * DataAssociationExpression
  * MapExpression
- These classes are used to store expressions after they have finished parsing and tokenization

common/file.py
- Container class for files being read by the KLL compiler

common/emitter.py
- Base class for all KLL emitters
- TextEmitter for dealing with text file templates

common/hid_dict.py
- Slightly modified version of kll_lib/hid_dict.py

common/id.py
- Identification container classes
- Used to indentify different types of elements used within the KLL language

common/modifier.py
- Container classes for animation and pixel change functions

common/organization.py
- Data structure merging container classes
- Contains all the sub-datastructure classes as well
- The Organization class handles the merge orchestration and expression insertion

common/parse.py
- Parsing rules for funcparserlib
- Much of this file was taken from the original kll.py
- Many changes to support the multi-stage processing and support KLL 0.5

common/position.py
- Container class dealing with physical positions

common/schedule.py
- Container class dealing with scheduling and timing events

common/stage.py
- Contains ControlStage and main Stage classes
  * CompilerConfigurationStage
  * FileImportStage
  * PreprocessorStage
  * OperationClassificationStage
  * OperationSpecificsStage
  * OperationOrganizationStage
  * DataOrganziationStage
  * DataFinalizationStage
  * DataAnalysisStage
  * CodeGenerationStage
  * ReportGenerationStage
- Each of these classes controls the life-cycle of each stage
- If multi-threading is desired, it must be handled within the class
  * The next stage will not start until the current stage is finished
- Errors are handled such that as many errors as possible are recorded before forcing an exit
  * The exit is handled at the end of each stage if necessary
- Command-line arguments for each stage can be defined if necessary (they are given their own grouping)
- Each stage can pull variables and functions from other stages if necessary using a name lookup
  * This means you don't have to worry about over-arching datastructures

emitters/emitters.py
- Container class for KLL emitters
- Handles emitter setup and selection

emitters/kiibohd/kiibohd.py
- kiibohd .h file KLL emitter
- Re-uses some backend code from the original KLL compiler

funcparserlib/parser.py
- Added debug mode control

examples/assignment.kll
examples/defaultMapExample.kll
examples/example.kll
examples/hhkbpro2.kll
examples/leds.kll
examples/mapping.kll
examples/simple1.kll
examples/simple2.kll
examples/simpleExample.kll
examples/state_scheduling.kll
- Updating/Adding rules for new compiler and KLL 0.4 + KLL 0.5 support
2016-09-01 23:48:13 -07:00
Jacob Alexander
c2a798f1cb First pass at parsing rules for KLL 0.4
(Yep, definitely started 0.5 first :P)

- Not functional yet, do not use
2016-01-25 00:33:52 -08:00
Jacob Alexander
b6cf0f13a8 Adding support for kll 0.3d
- Adding brightness control hid extension http://www.usb.org/developers/hidpage/HUTRR41.pdf
- Adding next keyboard layout support http://www.usb.org/developers/hidpage/HUTRR56B_Application_Keyboard_Layout_Selector.pdf
2015-10-17 15:08:34 -07:00
Jacob Alexander
a18ed32ca3 Adding aliases for international keys 2015-10-09 23:12:04 -07:00
Jacob Alexander
26437c35ad Fixing ascii string macro processing
- Fixing very old naming convention Brace to Bracket
- For now, accepting the old Brace names (will be deprecated at some point)
2015-10-07 20:05:44 -07:00
Jacob Alexander
e381131176 Adding support for "Soft Replace" kll 0.3c
- Updated both FuncMaps to use Soft Replace
- Only used for layers, default and base maps are not affected by soft replace (works like a normal replace)
2015-09-30 00:04:30 -07:00
Jacob Alexander
57d01ed872 Adding layer rotation (next/prev) support
- Includes symbolic names
2015-09-28 20:00:22 -07:00
Jacob Alexander
cf5bba7039 Adding Lock and Latch symbolic names (e.g. Function)
- Like Function, these are not valid USB codes, but can be used to easily refer a particular key (no possible with exact name)

U"Lock1"  : layerLock( 1 );
U"Latch1" : layerLatch( 1 );
2015-09-20 14:45:42 -07:00
Jacob Alexander
114d666bd8 Adding support for Interconnect Nodes
- Required changing the ScanCode node datastructure
- Interconnect Id's must be stored until the end as it's not possible to calculate the max per node ScanCode until after all the assignments are complete
- Should make future additions more straight-forward (that require per ScanCode information to be stored)
2015-08-15 21:29:18 -07:00
Jacob Alexander
f40c189980 Fixing naming issues with some of the symbolic names. 2015-05-14 21:06:44 -07:00
Jacob Alexander
d05f7ae820 Adding None keyword (0.3b)
- Prevents fall-through
- Cannot be combined with other result capabilities
2015-05-10 15:32:15 -07:00
Jacob Alexander
d91c0fb23f Adding media key support to KLL compiler (0.3b)
- Full HID dictionaries for LED, Consumer Control and System Control
- Re-organized parameter passing (will help with future kll spec additions)
2015-05-10 14:52:07 -07:00
Steve McMaster
97ae458c4b Add USB Code support for combination and sequence triggers 2015-02-27 23:26:01 -05:00
Jacob Alexander
4adb8a1386 Adding a few more symbolic names. 2015-02-25 23:51:49 -08:00
Jacob Alexander
727b5bd745 Adding more symbolic names to the kll lookup.
- These will be added to the KLL Spec 0.4
2015-02-25 23:47:17 -08:00
Jacob Alexander
8442567937 Adding backend specific template and output defaults. 2015-02-21 23:34:14 -08:00
Jacob Alexander
5af3e3a0b5 Simplifying template arguments
- Command Line arguments have slightly changed (will require controller git update)
- In preparation for JSON I/O
2015-02-21 23:19:35 -08:00
Jacob Alexander
7d0094ed3a Adding inheritance to Backend class
- Preparing for JSON->kll and kll->JSON compilation modes
2015-02-21 21:45:20 -08:00
Jacob Alexander
25043fa0ee Adding KEYPAD_ASTERISK (also internally renaming ASTERIX to ASTERISK)
- When possible, use the symbolic names for keys in generatedKeymap.h
  e.g. KEY_A instead of 0x04
2015-02-20 21:04:05 -08:00
Jacob Alexander
5696fc5dfb Adding name and file stacks and layer naming
- Name and kll filenames are treated as special variables
- Using the order of the stacks the compilation order can be inferred (useful for debugging)
- Layer names are finally implemented (instead of Layer 1, Layer 2, etc.)
2015-02-16 13:29:26 -08:00
Jacob Alexander
6454917b11 Adding define support to KLL compiler.
- Variable support is not complete
- However PartialMap support is basically ready
2014-11-20 13:52:58 -08:00
Jacob Alexander
b4e4a13811 Fixing layered assignment bug.
- Layered assignments were lost due to how the cached assignments were replayed
- Replaying each assignment cache after each file is done processing
2014-09-16 18:14:06 -07:00
Jacob Alexander
59a4b27de5 Adding support for firstScanCode calculation and initial Variable container implementation
- To better support RAM/Flash packing adding support for first scan code calculation
- This way if the first scan code is high (e.g. 0x40) RAM is not used for the scan codes without keys assigned

- Some initial work for KLL variables
- Will be used to influence runtime and compiler features of the firmware
2014-09-16 17:01:40 -07:00
Jacob Alexander
bbf2c3ffaf Adding full partial layer support.
- Layers never worked previously due to backend bug
- Added base configuration which is automatically clone for replacement, then subtracted for layers if scancode is unused (this allows for partial layer functionality)
- Added default map argument to define a combined map that is different than the typical ANSI map that is used for the base configuration
2014-09-09 17:49:46 -07:00
Jacob Alexander
e8d498a0d6 Fixed layer generation to only build trigger lists from the given layer.
- Required more complex correlation to get the layer ownership right for each trigger macro from the global list
2014-09-08 23:51:44 -07:00
Jacob Alexander
ff6ba9198b Adding basic layer support
- Not yet complete
- Partial layers are not compiling properly (adding too many macros, wasting memory)
- Adding example hhkb layout to try out as a layer
2014-09-07 23:22:07 -07:00
Jacob Alexander
0fe79f3418 Adding support for USB Code trigger assignment
- Added USBCode "cached assignment"
- Added ANSI -> Colemak USBCode assignment kll file
- Removed debug printing
2014-09-07 21:32:36 -07:00
Jacob Alexander
81231a708e kll compiler now working!
- Basic ScanCode to USBCode mapping now generating for the kiibohd controller
- Small fix to template
- Backend
- Macro correlation and transformation

TODO
- More testing
- Analog support
- LED support
- Layer support (only supports default layer currently)
2014-09-06 20:56:46 -07:00
Jacob Alexander
a005ad49ad Adding list to tuple conversion and USBCode to Capabiltiy conversion. 2014-09-06 12:35:22 -07:00
Jacob Alexander
1f0bf65417 Initial source dump.
- Not quite complete.
- Most of the parser is done (excluding analog) for 0.3 of the KLL spec
- Transformation and correlation isn't complete yet.
- Backend generation for Kiibohd capabilties is complete.
2014-09-02 10:03:50 -07:00