Example #1
0
		/// <summary>
		/// The entry point method.
		/// </summary>
		/// <param name="args">The command line arguments.</param>
		private static void Main(string[] args)
		{
			var pargs = ProgramArguments.Parse(args);

			Contract.Assert(pargs.ParseTablePath != null);

			var termFactory = new TrivialTermFactory();

			var productionFormat = new TermProductionFormat(termFactory);

			var parserFactory = new ParserFactory(
				new SpoofaxParseTableFormat(termFactory, productionFormat),
				new TrivialParseNodeFactory(),
				new AsFixTreeBuilder(termFactory, productionFormat));
			
			var parser = parserFactory.Create(pargs.ParseTablePath);
			
			ITerm ast;
			using (var reader = new StreamReader(FileExt.OpenInput(pargs.InputPath)))
			{
				ast = parser.Parse(reader);
			}

			// TODO: Print the ast.


			Program.trace.TraceData(TraceEventType.Information, 0, ast);
		}
Example #2
0
		private static Sglr Create()
		{
			var termFactory = new TrivialTermFactory();
			var productionFormat = new TermProductionFormat(termFactory);
			var sut = new SpoofaxParseTableFormat(termFactory, productionFormat);
			ParseTable parseTable;
			using (var input = Assembly.GetExecutingAssembly().GetManifestResourceStream("Virtlink.Noofax.SglrParser.Module.tbl"))
			{
				parseTable = sut.Read(input);
			}
			return new Sglr(parseTable, new TrivialParseNodeFactory(), new AsFixTreeBuilder(termFactory, productionFormat));
		}
		/// <summary>
		/// Creates a new instance of the subject under test.
		/// </summary>
		/// <returns>The created instance.</returns>
		private static SpoofaxParseTableFormat Create()
		{
			var termFactory = new TrivialTermFactory();
			return new SpoofaxParseTableFormat(termFactory, new TermProductionFormat(termFactory));
		}