Skip to content

[PLOD] Base entities and semantics#15

Open
LAV3002 wants to merge 2 commits intoProteusLab:masterfrom
LAV3002:master
Open

[PLOD] Base entities and semantics#15
LAV3002 wants to merge 2 commits intoProteusLab:masterfrom
LAV3002:master

Conversation

@LAV3002
Copy link

@LAV3002 LAV3002 commented Feb 16, 2026

No description provided.

@@ -1,35 +1,8 @@
require_relative "scope"
require_relative "../Common/scope"
Copy link
Contributor

Choose a reason for hiding this comment

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

I am convinced that it is not right to use require_relative. I think it will be better to use
require "Common/scope"

Copy link
Author

Choose a reason for hiding this comment

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

fixed

lib/SDL/plod.rb Outdated
@@ -0,0 +1,225 @@
require_relative '../Common/scope'
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Author

Choose a reason for hiding this comment

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

fixed

lib/SDL/plod.rb Outdated
Comment on lines 5 to 133
# class Oper
# attr_accessor :kind, :ret, :opds

# def initialize(kind, ret, *opds)
# @kind = kind
# @ret = ret
# @opds = opds
# end
# end

# class ConstExpr
# attr_accessor :type, :kind, :value

# def initialize(type, value)
# @type = type
# @kind = :const
# @value = value
# end
# end

# class VarExpr
# attr_accessor :type, :kind, :name

# def initialize(type, name)
# @type = type
# @kind = :var
# @value = name
# end
# end

# class ExprWrapper
# attr_accessor :expr

# class << self
# attr_accessor :currentScope
# end

# @@tmpCounter = 0
# @@currentScope = nil

# def initialize(expr)
# @expr = expr
# end

# def self.setScope(scope)
# @@currentScope = scope
# end

# def self.nthOp(n, kind, retType, *args)
# var = VarExpr(retType, "tmp_#{@@tmpCounter}".to_sym)
# @@tmpCounter += 1

# @@currentScope < Oper(kind, var, *(args.map { |arg| arg.expr }))

# return ExprWrapper.new(var)
# end

# def self.binOp(lhs, rhs, kind, retType = nil)
# if lhs.type != rhs.type
# raise "Bad bin op args"
# end

# if retType.nil?
# retType = lhs.type
# end

# return nthOp(2, kind, retType, lhs, rhs)
# end

# def+(other); binOp(self, other, :add); end
# def-(other); binOp(self, other, :sub); end
# def<<(other); binOp(self, other, :shl); end
# def<(other); binOp(self, other, :lt, bv(1)); end
# def>(other); binOp(self, other, :gt, bv(1)); end
# def^(other); binOp(self, other, :xor); end
# def>>(other); binOp(self, other, :shr); end
# def|(other); binOp(self, other, :or) end
# def&(other); binOp(self, other, :and) end
# def==(other); binOp(self, other, :eq, bv(1)); end
# def!=(other); binOp(self, other, :ne, bv(1)); end
# # def[](r, l); @scope.extract(self, r, l); end

# end

# class Statement < Utils::BaseInfo(:retVar, :op, :args)
# def initialize()
# super(nil, nil, [])
# end
# end

# class CallHandler
# attr_accessor :symbolName, :args, :next

# def initialize(name, *args)
# @symbolName = name
# @args = args
# @next = nil

# stmt = Statement.new()
# obj = getTmp()
# stmt.retVar = obj
# stmt.op = :getObj
# stmt.args = [callHandler.symbolName.to_sym]
# @@scopeInstance << stmt

# if !callHandler.args.empty?
# callStmt = Statement.new()
# stmt.retVar = getTmp()
# stmt.op = :call
# stmt.args = [obj] + callHandler.args
# @@scopeInstance << callStmt
# end

# puts @symbolName
# puts @args
# end

# def method_missing(name, *args)
# @next = CallHandler.new(name, *args)

# return @next
# end
# end

# module Scope
# def self.method_missing(name, *args)
# return ExprWrapper.new(name, *args)
# end
# end
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this code?

Copy link
Author

Choose a reason for hiding this comment

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

removed

Comment on lines 1 to 4
require_relative "encoding"
require_relative "../../ADL/base"
require_relative "../../Common/base"
require_relative "../../ADL/builder"

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you fix this too? I think that it is okey to use require_relative for files in the same directory

Copy link
Author

Choose a reason for hiding this comment

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

Agree. Fixed

end

module SimInfra
module LangInfra
Copy link
Contributor

Choose a reason for hiding this comment

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

Our language is named Protea. Maybe we can use?
module Protea

Copy link
Author

Choose a reason for hiding this comment

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

Agree. Fixed

Comment on lines 79 to 81
# Function(:lol, int(:lol), bv(64, :dom), void) {

# }
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove it please. We will support cuttom functions later.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines +144 to +145
def get_field(expr, lsb, type) = stmt(:get_field, [tmpvar(type), expr, lsb])

Copy link
Contributor

Choose a reason for hiding this comment

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

In my opinion It is a great idea to add get_field statement for scope. I will add this to agenda. However maybe it is unnecessary

Copy link
Author

Choose a reason for hiding this comment

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

Agree

lib/SDL/plod.rb Outdated
scope = initScope
scope.instance_eval(&block[2])
block[0][block[1]] = scope.to_h
# puts block[0]
Copy link
Contributor

@egorshamshura egorshamshura Feb 16, 2026

Choose a reason for hiding this comment

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

remove comment please

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines +3 to +7
require 'yaml'

require 'Devices/ns16550'

puts Devices.getDesc.to_yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

We are going to add cmake build. So I think it is better to wait it shipped and then rewrite current generator.

Copy link
Author

Choose a reason for hiding this comment

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

Agree

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.

2 participants