blambeau/finitio-rb

View on GitHub
lib/finitio/syntax/finitio.citrus

Summary

Maintainability
Test Coverage
require 'finitio/syntax/lexer'
require 'finitio/syntax/literals'
require 'finitio/syntax/types'
require 'finitio/syntax/expressions'

grammar Finitio::Syntax::Parser
  include Finitio::Syntax::Lexer
  include Finitio::Syntax::Literals
  include Finitio::Syntax::Expressions
  include Finitio::Syntax::Types

  rule system
    (spacing imports spacing definitions spacing main_type? spacing eof)
    <Finitio::Syntax::System>
  end

  rule imports
    (import (spacing import)*)?
    <Finitio::Syntax::Imports>
  end

  rule import
    ('@import' spaces import_url)
    <Finitio::Syntax::Import>
  end

  rule definitions
    (type_def (spacing type_def)*)?
    <Finitio::Syntax::Definitions>
  end

end