Skip to content

css-raku/CSS-Specification-Compiler-raku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSS-Specification-Compiler

Synopsis

use CSS::Specification::Compiler;
my CSS::Specification::Compiler $compiler .= new;
use JSON::Fast;
$compiler.load-defs: :file<examples/css21-aural.txt>;

# output Raku code
mkdir 'lib/MyCSS';

# output main grammar
'lib/MyCSS/Grammar.rakumod'.IO.spurt: .DEPARSE
    given $compiler.build-grammar: <MyCSS Grammar>;

# output grammar actions
'lib/MyCSS/Actions.rakumod'.IO.spurt: .DEPARSE
    given $compiler.build-actions: <MyCSS Actions>;

# output stubs for external rule references
'lib/MyCSS/External.rakumod'.IO.spurt: .DEPARSE
    given $compiler.build-external: <MyCSS External>;

# output associated metadata
mkdir 'resources';
'resources/MyCSSMeta.json'.IO.spurt: to-json($compiler.metadata, :sorted-keys);

Description

This module is used to compile CSS property definitions to Raku Grammars, Actions and Roles, and to extract meta-data.

CSS::Module, or similar, can then be used to bundle the definitions for use by CSS::Properties and other CSS related modules.

Status

This module is experimental, internal and subject to change. It uses the experimental RakuAST API, the current version is known to build against Rakudo v2025.10.

About

A Raku compiler for W3C CSS property specification syntax

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages