mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-09 03:02:50 -06:00
gfse: added a new "matrix view" of grammars
This commit is contained in:
@@ -20,9 +20,9 @@ type Concrete = { langcode: Id,
|
||||
params: [{name: Id, rhs: String}],
|
||||
lincats : [{ cat: Cat, type: Term}],
|
||||
opers: [{name: Lhs, rhs: Term}],
|
||||
lins: [{fun: FunId, args: [Id], lin: Term}]
|
||||
lins: [Lin]
|
||||
}
|
||||
|
||||
type Lin = {fun: FunId, args: [Id], lin: Term}
|
||||
|
||||
type Lhs = String -- name and type of oper,
|
||||
-- e.g "regN : Str -> { s:Str,g:Gender} ="
|
||||
@@ -85,6 +85,13 @@ function cat_lincat(conc,cat) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the lin defined in a given concrete syntax for an abstract function
|
||||
// cat_lincat :: Concrete -> FunId -> Lin
|
||||
function fun_lin(conc,fun) {
|
||||
with(conc) for(var i in lins) if(lins[i].fun==fun) return lins[i]
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the index of the concrete syntax with a given langcode
|
||||
// conc_index :: Grammar -> Id -> Int
|
||||
function conc_index(g,langcode) {
|
||||
|
||||
Reference in New Issue
Block a user