Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] Nova versão da geração de código #8

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Conversation

GChicha
Copy link
Collaborator

@GChicha GChicha commented Nov 24, 2018

  • Decl
    • Single
      • Global
      • Local
    • Array
      • Global
        • Declaration
        • Initiallization
      • Local
        • Declaration
        • Initialization
    • Function
      • Params
        • Single
        • Array
  • Expr
    • Variable
      • Single
      • Array
    • Add
    • Sub
    • Div
    • Mul
    • Mod
    • Ternary
  • Stmt
    • Attr
    • Stop
    • Skip
    • Read
    • Write
    • Call
    • If
    • While
    • For

@GChicha GChicha changed the title Nova versão da geração de código [wip] Nova versão da geração de código Nov 26, 2018
@GChicha
Copy link
Collaborator Author

GChicha commented Dec 3, 2018

Já propaguei os tipos e as localizções de todos elementos da AST, por enquanto eles não estão utilizados.

Acredito que se substituirmos as chamadas unwrap por algo que emita erros já é suficiente.

@GChicha
Copy link
Collaborator Author

GChicha commented Dec 11, 2018

Acho que tá legal para entregar, a unica coisa que não está funcionando (talvez não seja dificil corrigir) é a passagem de array por parametro, o resto, read write e todos os outros controless de fluxo estão funcionando.

Copy link
Collaborator

@andrmng andrmng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saco de vacilo

Copy link
Owner

@theosirian theosirian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments.

Op(Box<Expr>, Opcode, Box<Expr>),
Right(Opcode, Box<Expr>),
Ternary(Box<Expr>, Box<Expr>, Box<Expr>),
Number(u64, Location),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap Expr with a Location like:

enum Expr {
  ...
}
pub type Expr = (Expr, Location)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, after reading the rest of the files, you can do that with almost all the AST types.

pub module: *mut LLVMModule,
pub context: *mut LLVMContext,
pub builder: *mut LLVMBuilder,
pub actual_function: Option<(*mut LLVMValue, *mut LLVMBasicBlock)>, // (function, entry)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actual is not atual, that would be current.

impl Emit<*mut LLVMType> for Type {
unsafe fn emit(
self: &Self,
context: &mut Context,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Destructure Context like so:

Context {
  mut symbol_table,
  module,
  context,
  actual_function,
  builder,
}: &mut Context

Add mutables as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants