Skip to content

ygg-lang/serde-json5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yggdrasil Template

Build with CLI(Recommend)

  1. Install ycc
# require rust nightly
cargo install ycc --force

or download from release and add to $PATH.

  1. Written grammar definition file,
  1. Run build command
ycc build

Build with RUST dependence

  1. Written grammar definition file,
  1. Define build dependencies in cargo(require rust nightly)
[build-dependencies.yggdrasil-shared]
version = "0.2.3"
# git = "https://github.com/ygg-lang/yggdrasil.rs"
# branch = "dev"
  1. Write the build.rs
  1. Run cargo build and reexport needed symbols

Tools

Language Tutorial

  • basic syntax
Name Description
a? Optional element
a* Zero or more elements
a+ One or more elements
a b Sequence of elements
a | b Alternative of branch
name:e Mark element with given name
#Name Mark branch with given name
^rule Remark element
@macro() Macro call
ANY Any unicode characters
IGNORED All rules marked as ignored
  • class vs union

The same syntax A | B performs differently in class and union context.

// expand `A | B` as class
class TestA {
    | tag_a:A 
    | tag_b:B
}
// expand `A | B` as union
union TestB {
    | A #BranchA
    | B #BranchB
}
struct TestA {
    tag_a: A,
    tag_b: B,
}

enum TestB {
    BranchA(A),
    BranchB(B),
}
  • examples

You can learn more from project-yggdrasil.

Community

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages