1st project: CCSS parser
Overview: CCSS is a CSS superset with a syntax to link selectors with constraints which later is solved by GSS and Cassowary constraint solver. It takes text input and outputs simple Abstract Syntax Tree. Most of the features are described in CCSS documentation on official site: (http://gridstylesheets.org/guides/ccss/
Goal: Rewrite CCSS parser in conformance with existing specs (https://github.com/gss/parser/tree/master/spec). The new parser should avoid using intermediate abstractions (like PEGs) for best performance, but still should retain extensibility. It should be friendly to developer and produce information needed for debugging.
Parsing:
- CSS3 Values, should parse 99% of modern CSS grammar into AST (including things like gradients, units, and calc expressions)
- Selectors. All CSS3 selectors + GSS virtuals
- CSS3 constructs (rules and media queries, font face, conditions).
- Constraints and variables definition (free-form expressions)
Post processing
- Variable/Virtual hoisting (variables implicitly point to the topmost level where they were used)
- 2d properties (
#h1[top-left] == #h2[center]generates 2 constraints) - Plugin system - At-declarations should be able to provide custom parser (like we do with @v and @h vfl hooks) and normalize the output meta data (like line/char no)
Other requirements
- Parser should be able to produce helpful error messages in all cases. Messages should state what is wrong with the code, which line, character and file triggered it. This information should be retained on final output as object properties.
- Parser should not hardcode names of commands into parsing routines, so it could be extended in the future.
- It would be nice if we could get tokenization output if we wanted. It would probably help us with syntax highlightning. Maybe we can infer that from parser output?