Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ macro expansion and preprocessing/dependency arguments.
Each backend keeps its generator entry point and core node dispatch in
`src/generator/<backend>/generator.rs`; `generator/aggregate.rs`, `globals.rs`,
`atomic.rs` and `inline_asm.rs` contain the corresponding target-specific operations.
The C build driver starts in `src/bin/dynamite-cc/main.rs`, with argument handling
in `arguments.rs`. Its LLVM tools module keeps lowering and backend selection
in `llvm_tools.rs`, with native linking in `llvm_tools/gnu.rs` and `darwin.rs`.

The image workflow runs only when `dockerfiles/dev.Dockerfile`, `.dockerignore`,
or `.github/workflows/publish.yaml` changes, or when started manually. Image
Expand Down
110 changes: 55 additions & 55 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,61 @@ mod validation;
mod varargs;
mod vla;

pub struct AstBuilderImpl<'a> {
error_logger: &'a dyn error::ErrorLogger,
tokens: &'a Vec<Token>,
cur: usize,
offset_size: usize,
loop_stack: Vec<usize>,
labels: HashMap<String, usize>,
defined_labels: HashSet<String>,
switch_stack: Vec<Vec<Node>>,
switch_types: Vec<Type>,
return_type: Option<Type>,
current_function: Option<Token>,
mutable_static: Option<Token>,
return_pointer: Option<usize>,
variadic_parameters: Option<Vec<Type>>,
variadic_last: Option<usize>,
pending_bounds: Vec<Node>,
parameter_depth: usize,
declaration_attributes_state: Option<DeclarationAttributes>,
dynamic_objects: Vec<Node>,
vla_active: Vec<usize>,
jump_depths: Vec<usize>,
continue_depths: HashMap<usize, usize>,
switch_vla_depths: Vec<usize>,
next_enum_id: usize,
next_deferred_local: usize,
struct_definitions: Vec<Rc<RefCell<StructDefinition>>>,
scope_stack: Vec<HashMap<String, Identifier>>,
pub functions: HashMap<String, Func>,
pub global_variables: HashMap<String, GlobalVariable>,
pub string_literals: Vec<Token>,
pub symbol_names: HashMap<String, String>,
}

pub struct ProgramAst<'a> {
pub functions: &'a HashMap<String, Func>,
pub global_variables: &'a HashMap<String, GlobalVariable>,
pub string_literals: &'a Vec<Token>,
pub symbol_names: &'a HashMap<String, String>,
}

pub enum Identifier {
TypeDef(Type),
Constant(i64, Type),
EnumTag {
ty: Type,
fixed: bool,
defined: bool,
},
StaticObject(Type, String),
Local(Type, usize, bool, usize),
Dynamic(Type, usize, bool),
Static(Type),
}

#[derive(Clone, Copy, PartialEq)]
enum Nullability {
Nullable,
Expand Down Expand Up @@ -121,61 +176,6 @@ struct DeclarationAttributes {
hidden: bool,
}

pub struct AstBuilderImpl<'a> {
error_logger: &'a dyn error::ErrorLogger,
tokens: &'a Vec<Token>,
cur: usize,
offset_size: usize,
loop_stack: Vec<usize>,
labels: HashMap<String, usize>,
defined_labels: HashSet<String>,
switch_stack: Vec<Vec<Node>>,
switch_types: Vec<Type>,
return_type: Option<Type>,
current_function: Option<Token>,
mutable_static: Option<Token>,
return_pointer: Option<usize>,
variadic_parameters: Option<Vec<Type>>,
variadic_last: Option<usize>,
pending_bounds: Vec<Node>,
parameter_depth: usize,
declaration_attributes_state: Option<DeclarationAttributes>,
dynamic_objects: Vec<Node>,
vla_active: Vec<usize>,
jump_depths: Vec<usize>,
continue_depths: HashMap<usize, usize>,
switch_vla_depths: Vec<usize>,
next_enum_id: usize,
next_deferred_local: usize,
struct_definitions: Vec<Rc<RefCell<StructDefinition>>>,
scope_stack: Vec<HashMap<String, Identifier>>,
pub functions: HashMap<String, Func>,
pub global_variables: HashMap<String, GlobalVariable>,
pub string_literals: Vec<Token>,
pub symbol_names: HashMap<String, String>,
}

pub struct ProgramAst<'a> {
pub functions: &'a HashMap<String, Func>,
pub global_variables: &'a HashMap<String, GlobalVariable>,
pub string_literals: &'a Vec<Token>,
pub symbol_names: &'a HashMap<String, String>,
}

pub enum Identifier {
TypeDef(Type),
Constant(i64, Type),
EnumTag {
ty: Type,
fixed: bool,
defined: bool,
},
StaticObject(Type, String),
Local(Type, usize, bool, usize),
Dynamic(Type, usize, bool),
Static(Type),
}

pub(crate) const METADATA_ATTRIBUTES: &[&str] = &[
"availability",
"deprecated",
Expand Down
Loading
Loading