Sha256: fbddfcb8370d794b2963f7762223d16509211d88044081b193cad538bce76eb2

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

require 'citrus'
require_relative 'syntax/node'
require_relative 'syntax/literal'
require_relative 'syntax/expr'
require_relative 'syntax/type'
require_relative 'syntax/import'
require_relative 'syntax/imports'
require_relative 'syntax/definitions'
require_relative 'syntax/system'
module Finitio
  module Syntax

    Citrus.load File.expand_path('../syntax/lexer.citrus', __FILE__)
    Citrus.load File.expand_path('../syntax/literals.citrus', __FILE__)
    Citrus.load File.expand_path('../syntax/expressions.citrus', __FILE__)
    Citrus.load File.expand_path('../syntax/finitio.citrus', __FILE__)

    def self.parse(source, *args, &bl)
      source = File.read(source) if source.respond_to?(:to_path)
      Parser.parse(source, *args, &bl)
    end

    def self.ast(source)
      parse(source, root: "system").to_ast
    end

    def self.compile(source, cpl = nil)
      cpl = Compilation.coerce(cpl, source)
      parse(source, root: "system").compile(cpl)
      cpl.resolve_proxies
    end

    def self.compile_type(source, cpl = nil)
      cpl = Compilation.coerce(cpl, source)
      parse(source, root: "type").compile(cpl)
    end

  end # module Syntax
end # module Finitio

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
finitio-0.11.3 lib/finitio/syntax.rb
finitio-0.11.2 lib/finitio/syntax.rb
finitio-0.11.1 lib/finitio/syntax.rb
finitio-0.10.0 lib/finitio/syntax.rb
finitio-0.9.1 lib/finitio/syntax.rb
finitio-0.9.0 lib/finitio/syntax.rb
finitio-0.8.0 lib/finitio/syntax.rb