Skip to content

Instantly share code, notes, and snippets.

@martijndwars
Last active December 15, 2015 09:11
Show Gist options
  • Save martijndwars/e04d759d9ef36b434fde to your computer and use it in GitHub Desktop.
Save martijndwars/e04d759d9ef36b434fde to your computer and use it in GitHub Desktop.
NaBL required reference
module names
namespaces
Global
binding rules
Class(c, _):
defines Global c
of type ClassType(c)
scopes Global
Method(t, m, _):
defines Global m
// This is required for Call(e, m) to resolve the method? Why?!
NewObject(c):
refers to Global c
Call(e, m):
refers to Global m in Global c
where e has type ClassType(c)
module dummy
imports
Common
context-free start-symbols
Start
context-free syntax
Start.Program = Class*
Class.Class = <
class <ID> {
<Method>
}>
Method.Method = <
<Type> <ID>() {
<Stmt*>
}>
Type.ClassType = <<ID>>
Stmt.Call = <<Exp>.<ID>();>
Exp.NewObject = <new <ID>()>
test [[
class Foo {
int [[m]]() {
}
}
class Bar {
int n() {
new Foo().[[m]]();
}
}
]] resolve #2 to #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment