1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//! Welcome to `rgo`!
//!
//! Compilation is a pipeline, which works (roughly) like this:
//!
//! Lexical analysis -> Parsing -> Translation
//!
//! Each part should be loosely coupled with the others, only relying on a somewhat stable public
//! API.

#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]

#[macro_use]
extern crate log;
// XXX: do we still need it?
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate quick_error;

extern crate num;

mod pos;
pub use self::pos::Position;

pub mod token;
pub mod ast;
pub mod lexer;
pub mod parser;

pub use parser::Parser;

pub fn parse(src: &str) -> ast::SourceFile {
    let lexer = lexer::Lexer::new(src).collect();
    parser::parse_tokens(lexer)
}