# This file is part of the Coral project.
# Please read the copyright notice in the LICENSE file.

#
# smd2lang - In-memory SMD model to Language creator
#
# SYNOPSIS
#
# smd2lang filename    (for CLI)
# smd2lang(model)      (for Python, returns Language)
#
#
# DESCRIPTION
#
# smd2lang converts an SMD 0.1 model into a Language, in memory.
#
# The Language, which together with its consitutent AbstractElementDefinitions
# forms a metamodel, can then be used to create models for
# that specific language.
#
# For run-time creation of new metamodels, smd2lang
# is implemented in C++.
#
# NOTES
#
# This is really just a helper function. You probably want
# to use coral.Language.__getLanguage__ or a similar function,
# which returns an old instance of the Language object if available,
# and internally usese smd2lang if it doesn't.
# 
# AUTHORS
#
# Marcus Alanen <maalanen@abo.fi> 2003
#
#
#
#
from coral import kernel as coral

def smd2lang(M):
    return coral.smd2lang(M)

if __name__ == '__main__':
    import sys
    M = coral.loadModel(sys.argv[1])
    assert M
    L = smd2lang(M)
    assert L
